Adding / removing keyboard languages ​​via .bat

For some time, when I use win7, it regularly populates my keyboard languages, and I have to remotely add 3 keyboard languages, apply and delete them. So I was wondering if there is a way to do this via a .bat file automatically (add 3 specific keyboard languages, then delete them right away). However, I know almost nothing about .bat commands, so does anyone know if this is possible through a .bat file, and if so, which commands should I use?

Thanks in advance, George.

+6
source share
4 answers

It is possible.

http://blogs.msdn.com/b/shawnste/archive/2007/04/12/configuring-international-settings-from-the-command-line.aspx

http://msdn.microsoft.com/en-us/goglobal/bb964650#eyb

command line example:

control intl.cpl,, /f:"%CD%\AddKeyboardLanguage.xml" 

Example AddKeyboardLanguage.xml:

 <gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> <gs:UserList> <gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList> <gs:InputPreferences> <!--ch-Google--><gs:InputLanguageID Action="add" ID="0804:E0200804"/> </gs:InputPreferences> </gs:GlobalizationServices> 

Example RemoveKeyboardLanguage.xml:

 <gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> <gs:UserList> <gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList> <gs:InputPreferences> <!--ch-Google--><gs:InputLanguageID Action="remove" ID="0804:E0200804"/> </gs:InputPreferences> </gs:GlobalizationServices> 
+5
source

Keyboard languages ​​are stored in the registry under HKEY_CURRENT_USER\Keyboard Layout You can use REG.EXE in batch files to add / modify / delete registry keys. REG.EXE does not support the remote HKEY_CURRENT_USER key change, so the file must be run from the computer. We probably shouldn't do this. This is what I would do. When your computer works as it should, go to the CMD prompt by clicking the "Start" button and enter CMD in the launch field. At the cmd prompt, type:

  REG QUERY "HKCU\Keyboard Layout" /s 

This will show you what registry keys should look like when all is well. Now take a picture and save it to a file by typing:

  REG EXPORT "HKCU\Keyboard Layout" KeyboardLayout.reg 

This will create the KeyboardLayout.reg file in any directory in which the CMD prompt is CMD . I'm not sure why you will need to add 3 specific languages ​​and then delete them to return to working mode, but I have the feeling that just setting the registry on how it worked will fix the problem. The next time this happens, remotely navigate to the location of the KeyboardLayout.reg file and double-click it. It will tell you that the key has been updated and click "OK." See if this fixes it. If this is not the case, restart the computer and see if it will then. If it still does not work, send a comment and I will tell you what I will do next.

+2
source

Using @Ying tips / links ... I made a pt.xml file:

 <gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> <!--User List--> <gs:UserList> <gs:User UserID="Current"/> </gs:UserList> <!--input preferences--> <gs:InputPreferences> <!--add pt-BR keyboard input and set as default--> <gs:InputLanguageID Action="add" ID="0416:00010416" Default="true"/> </gs:InputPreferences> </gs:GlobalizationServices> 

and then just create .bat with this command inside:

 control intl.cpl,, /f:"%CD%\pt.xml" 

Double click on it and it should work instantly!

+2
source

I also had the same problem - en-US added automatically, and I had to add en-US and then delete it to get rid of the layout. Even with the batch file, I found that you cannot just delete it, you must first add the layout (even if it appears in the list of keyboard layouts) to delete it, as if you had done it manually.

Therefore, the Remove_en-US.xml first adds the layout, and then removes it:

 <gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> <!--User List--> <gs:UserList> <gs:User UserID="Current"/> </gs:UserList> <!--input preferences--> <gs:InputPreferences> <!--add en-US keyboard input--> <gs:InputLanguageID Action="add" ID="0409:00000409"/> <!--remove en-US keyboard input--> <gs:InputLanguageID Action="remove" ID="0409:00000409"/> </gs:InputPreferences> </gs:GlobalizationServices> 

Remove_en-US.bat :

 control intl.cpl,, /f:"%CD%\Add_en-US.xml" 

Here 0409 is the locale ID and 00000409 are the keyboard layout values. For a list of locale ID:keyboard layout value see https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/hh825682(v=win.10) .

+2
source

Source: https://habr.com/ru/post/944808/


All Articles