There was a similar topic and seems outdated where people suggested using powershell commands. I found another way with chatgpt but kinda stuck in a way that I want to combine two scripts from two separate batch files with adding and removing the input language in a single batch file, so on first or second launch it either removes either adds the lang. Chatgpt didnt give a proper solutions to that, nor of offered were working. I rely on your smart ideas of how to implement this. Thanks in advance.
For now I use separate two files to add and remove which is kinda inconvenient. I tried different versions from chatgpt that combined in its way these two scripts but none worked.
adding lang script:
@echo off
:: Add Ukrainian Keyboard Input Language using PowerShell
powershell -Command "Set-WinUILanguageOverride -Language uk-UA; Set-WinUserLanguageList -LanguageList uk-UA,en-US -Force"
:: Refresh Keyboard Layouts
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters
echo Ukrainian keyboard layout added successfully.
pause
removing lang script:
@echo off
:: Remove Ukrainian Keyboard Input Language using PowerShell
powershell -Command "Set-WinUILanguageOverride -Language en-US; Set-WinUserLanguageList -LanguageList en-US -Force"
:: Refresh Keyboard Layouts
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters
echo Ukrainian keyboard layout removed successfully.
pause
@echo off
:: Changing Keyboard Input Language using PowerShell
powershell -Command "if ((get-WinUserLanguageList).LanguageTag -like 'uk*'){Set-WinUILanguageOverride -Language en-US;Set-WinUserLanguageList -LanguageList en-US -Force}else{Set-WinUILanguageOverride -Language uk-UA;Set-WinUserLanguageList -LanguageList uk-UA,en-US -Force}"
:: Refresh Keyboard Layouts
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters
echo Keyboard Input Language changed successfully.
pause