Diewuxi

Belive tomorrow will be better, love science and technology, support communication and understanding, always ready for thought turn.

Blog / engineering_technology / computer / software / os / windows / Windows 区域语言设置脚本

Blog


Article^ Parent

Windows 区域语言设置脚本


Date: 2019-11-04 00:00:00
Description: 下载了一个单机版跑跑卡丁车,但是只能在系统设置为韩语时才能运行,编写了一个脚本,实现程序化切换系统语言为英语或韩语。
Keywords: Windows, 区域和语言, 批处理
Category: engineering_technology/computer/software/os/windows
Tag: windows, bat
Link: https://www.diewuxi.com/blog/article/95.html

简介

下载了一个单机版跑跑卡丁车,但是只能在系统设置为韩语时才能运行,编写了一个脚本,实现程序化切换系统语言为英语或韩语。

程序目录结构

bin/
    regionctl.bat       # 程序文件
share/
    regionctl/          # 配置文件目录
        Korean.xml      # 韩语配置文件
        English.xml     # 英语配置文件
                        

使用方法

把 bin 目录添加到环境变量,切换成韩语时,在 cmd 或"运行"中执行:

regionctl.bat Korean
                        

切换成英语,执行:

regionctl.bat English
                        

注意,切换回英语后,输入法状态条会多出来一些图标,手动调整一下即可。

如果有其它语言需求,可以自行查找相关的配置文件如何填写。

程序文件内容

程序文件 regionctl.bat 内容:

@ echo off

if "%1" == "" (
    echo Usage: %0 {Korean^|English}
    pause
) else (
    if "%1" == "Korean" (
        control.exe intl.cpl,, /f:"%~dp0..\share\regionctl\Korean.xml"
    ) else (
        if "%1" == "English" (
            control.exe intl.cpl,, /f:"%~dp0..\share\regionctl\English.xml"
        ) else (
            echo Wrong parameter
            pause
        )
    )
)
                        

英语配置文件 English.xml 内容:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

    <!-- user list -->
    <gs:UserList>
        <gs:User UserID="Current"/>
    </gs:UserList>

    <!-- input preferences -->
    <gs:InputPreferences>
        <!-- Remove "Korean(Extended Wansung) - Korea" -->
        <gs:InputLanguageID Action="add" ID="0409:00000409"/>
        <gs:InputLanguageID Action="remove" ID="0409:00000409"/>

        <!-- Remove "English - United States" -->
        <gs:InputLanguageID Action="add" ID="0412:{A028AE76-01B1-46C2-99C4-ACD9858AE02F}{B5FE1F02-D5F2-4445-9C03-C568F23C99A1}"/>
        <gs:InputLanguageID Action="remove" ID="0412:{A028AE76-01B1-46C2-99C4-ACD9858AE02F}{B5FE1F02-D5F2-4445-9C03-C568F23C99A1}"/>
    </gs:InputPreferences>

    <!-- user locale -->
    <gs:UserLocale>
        <gs:Locale Name="en-US" SetAsCurrent="true" ResetAllSettings="true">
            <gs:Win32>
                <gs:sShortTime>HH:mm</gs:sShortTime>
                <gs:sTimeFormat>HH:mm:ss</gs:sTimeFormat>
                <gs:sShortDate>yyyy-MM-dd</gs:sShortDate>
                <gs:sLongDate>dddd, MMMM dd, yyyy</gs:sLongDate>
                <gs:iFirstDayOfWeek>0</gs:iFirstDayOfWeek>
            </gs:Win32>
        </gs:Locale>
    </gs:UserLocale>
 </gs:GlobalizationServices>
                        

韩语配置文件 Korean.xml 内容:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

    <!-- user list -->
    <gs:UserList>
        <gs:User UserID="Current"/>
    </gs:UserList>

    <!-- user locale -->
    <gs:UserLocale>
        <gs:Locale Name="ko-KR" SetAsCurrent="true" ResetAllSettings="false">
        </gs:Locale>
    </gs:UserLocale>
 </gs:GlobalizationServices>
                        

Last Modified: 2019-11-04

Comments [1]

  • Anna Bayly[1#]
    Hi diewuxi.com webmaster, Your posts are always on topic and relevant.
    2024-09-01 21:05:34Reply

Write comment(* is necessary, and email is not shown to public)


Diewuxi 2017--2024