How to change keyboard layout in windows console CMD or WSL?

Viewed 17160

When I open CMD in Windows 10, I get the wrong keyboard layout. Same with WSL (bash)

When powershell is used, it displays the correct one.

This is a screenshot when pressing the ; key in a standard US keyboard layout.

I have no idea how to change it, there's nothing in settings for the console.

Wrong keyboard

Edit:

This is the result of command:

Get-WinUserLanguageList | Format-Table -Property LanguageTag, InputMethodTips

Get-WinUserLanguageList | Format-Table -Property LanguageTag, InputMethodTips

LanguageTag InputMethodTips
----------- ---------------
en-US       {0409:00000409}
es-MX       {080A:0000080A}

This is the result of command chcp in both cmd and powershell: Active code page: 850

I tried chcp 437 as suggested by @IoCalisto but didn't work

SOLVED

Problem vanished when autohotkey was turned off.

For some reason, autohotkey doesn't work properly with CMD or WSL for some mappings.

3 Answers

To change keyboard layout to Arabic:

Set-WinUserLanguageList -LanguageList  ar-eg, en-US -force

To change keyboard layout to English:

Set-WinUserLanguageList -LanguageList  en-US, ar-EG -force

In my case the solution was to launch wsl through powershell (by simply typping wsl in it) as it detects the keyboard layout succesfully.

This may be an issue with code page number? Try typing chcp (without arguments) into cmdline and see what is returned (The code page number for US is 437). To set the code page number, type chcp follwoed by the CPN you would like to use example:

chcp 437

all windows code page numbers can be found here (to my knowledge):

https://en.wikipedia.org/wiki/Windows_code_page

Hope this helps

Related