1

I got a windows 10 with 2 keyboard layout. I would like to switch progrmatically the current used keyboard via a bat file. Does anyone know what command does it?

to make it clear, I do not want to install a new language pack, I would like to change the input keyboard without making the user press alt+shift

edit: this is not a dup! the question which linked in the header asks about adding new language ,not changing existing lang pack!

Mr P
  • 13
  • 1
  • 5
  • See also [How to Set Default Keyboard Layout in Windows 10](https://winaero.com/blog/set-default-keyboard-layout-windows-10/) – DavidPostill Jun 06 '20 at 12:40
  • @DavidPostill this is a completely different question. please remove the dup header. see the edit notes. – Mr P Jun 06 '20 at 12:41
  • I want to mimic what the alt shift does not installing a new lang! – Mr P Jun 06 '20 at 12:43
  • Read the other answers and the other link I gave you. It can be done with powershell. – DavidPostill Jun 06 '20 at 12:43
  • @DavidPostill you have sent me a guide to how to install a new lang via powershell. – Mr P Jun 06 '20 at 12:45
  • I would like the change the current typing language, not adding a new one! – Mr P Jun 06 '20 at 12:46
  • No it doesn't. Please read them again carefully. "For example, the following command will set Russian as my default keyboard layout: `Set-WinUserLanguageList -LanguageList ru, en-US -Force`" – DavidPostill Jun 06 '20 at 12:47
  • @DavidPostill I do not want the change my default keyboard. I merely want that my program will be able to do an alt shift without user intervention. – Mr P Jun 06 '20 at 12:48
  • Reopened. Good luck getting an answer. You cannot switch layout with user intervention. A user would have to run the batch file if it is possible. – DavidPostill Jun 06 '20 at 12:50
  • I want to create a batch to do an alt shift and then open a program. – Mr P Jun 06 '20 at 12:51
  • @harrymc again this is not a dup! – Mr P Jun 06 '20 at 14:42
  • You're getting an answer from that same post... [Edit](https://superuser.com/posts/1558431/edit) your post so it's different from the link and ask for reopen. – harrymc Jun 06 '20 at 15:07

1 Answers1

0

As you are using windows 10, you have got powershell 5. Now you can't do this using cmd. You have to use powershell: Set-WinUserLanguageList -Force Layout.

You can specify more than one layouts seperated by comma as an array. The language given as the firstto the array will be selected as the active language, so this can be an efficient way to change both active language and the overall list of keyboard languages available.

Also you can use Set-WinUILanguageOverrode. If you want to send the key strokes you can use Wscript.Shell com object send keys method.

Wasif
  • 7,984
  • 2
  • 19
  • 32