• Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About jpeachman

  1. Excellent point about there being no need to set a variable! I confess I haven't written any AutoIT scripts and was just attempting a pretty literal translation of the original into a batch file. I didn't write the FOR loop so nicely, either. It can easily be done with a single iteration, and everything can go on one line with unwanted output suppressed too by using: @FOR /F "tokens=3 skip=4" %%a IN ('REG QUERY "HKCU\Control Panel\International" /v sLanguage') DO @IF "%%a"=="FRA" START /WAIT HS62001_LangFR.exe Yzöwl's example of piping through FIND is still slightly shorter than this, though. Where using FOR rather than FIND might be shorter and more straightforward is if you were testing for more than one condition. For a three-language example: @FOR /F "tokens=3 skip=4" %%a IN ('REG QUERY "HKCU\Control Panel\International" /v sLanguage') DO @IF "%%a"=="FRA" (START /WAIT HS62001_LangFR.exe) ELSE IF "%%a"=="DEU" (START /WAIT HS62001_LangDE.exe) ELSE IF "%%a"=="ENU" (START /WAIT HS62001_LangEN.exe)It's probably good to know both techniques; still, Yzöwl's method is shortest for the specific need expressed by coucou!
  2. Try: FOR /F "tokens=2*" %%a in ('REG QUERY "HKCU\Control Panel\International" /v sLanguage') DO @(SET Lang=%%b) IF "%Lang%"=="FRA" START /WAIT HS62001_LangFR.exe SET Lang=