- 1 year ago
How to temporarily change locale from command prompt
To temporarily change the locale from the command prompt in Windows, you can use the chcp
command. The chcp
command is used to change the active code page of the command prompt, which affects the character encoding and locale settings. Here's how you can use it:
Open the command prompt: Press Win + R, type "cmd", and press Enter to open the command prompt.
View the current locale: To view the current locale, use the
chcp
command without any arguments. It will display the active code page and the corresponding locale.shellchcp
Change the locale: To temporarily change the locale, use the
chcp
command followed by the code page number corresponding to the desired locale. For example, to change the locale to US English, you can use the code page 437:shellchcp 437
The new locale settings will take effect immediately and affect the display of characters in the command prompt.
Verify the locale change: You can verify that the locale has been changed by running the
chcp
command again to display the active code page and locale.
Note: The changes made using the chcp
command are temporary and apply only to the current command prompt session. When you close the command prompt or open a new one, the locale settings will revert to the system default.
Keep in mind that changing the locale affects the character encoding and can lead to display issues if the characters in the command output or file names are not supported by the selected code page. It's important to choose a code page that matches the encoding used by the content you're working with.
Additionally, if you need to change the locale system-wide or permanently, you would need to modify the system settings through the Control Panel or other system configuration tools.