Home > front end >  Utilize a command in batch to change the Output language of the CMD
Utilize a command in batch to change the Output language of the CMD

Time:11-10

I wrote a batch script and everything ran fine, however I encountered problems when I transfered the script to another computer which uses the cmd in english and I no longer could utilize the script as it looked for specific words in the german cmd output.

I currently have it set to english, and I was trying to figure out if there was a way for me to use a command which can be added at the beginning of a batch script to either check the language and change it or just ultimately change it.

On google I found something about "chcp" but that didnt seem to help either. If anyone knows of anyway to solve my problem I deeply thank you.

P.S. I am trying to change it to german if that helps.

https://github.com/Pedrov01/PingsCommandOrganiser

Feel free to ask any questions if needed! -Kind regards

CodePudding user response:

It's not possible to change the language if the other language is not installed. So you have to write your code language-independent. The following takes advantage that the hostname is immediately followed by the IPaddress (not sure if it's the same in all languages (although I guess it is) - tested with German and English):

language dependent text HOSTNAME [IPADDRESS] language dependent text

Code:

@ECHO OFF
setlocal 
set /p "destination=Enter destination: "
for /f "delims=" %%i in ('ping -4 -n 1            
  • Related