Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Discover OS language and architecture of Windows 7 using command prompt

$
0
0

The problem: in a bat file a need make different think based on language an os architecture of windows 7 (are different setup program to be running).

Something like this:

IF OSLanguage = 1033 AND OSArchitecture == 32-bit DO
 ....
 ...
IF OSLanguage == 1033 AND OSArchitecture == 64-bit DO
 ....
 ....
and so on....

I have tried with this script:
FOR /f "tokens=1,2 delims==" %%A IN ('"wmic os get OSArchitecture,OSLanguage /format:list"') DO (
 IF /I %%A == "OSArchitecture"  SET MyArch = %%B
 IF /I %%A EQU "OSLanguage" SET MyLCID = %%B
)
ECHO %MyArch%
ECHO %MyLCID%

Result:
There are many blank row in the result of the wmic command (this is curiosity not problem)
%%A and %%B are well compiled (if I use ECHO %%A and ECHO %%B  inside the do the value are displayed)
%MyArch% and %MyLCID% are empty

Thanks for any idea

LSo


LSo Lorenzo Soncini Trento TN - Italy


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>