Batch file issues set command
#1
Posted 21 December 2011 - 02:54 AM
SYSTEMINFO | FIND "System Type" > C:\sysType.txt
FOR /F "usebackq delims=: tokens=3" %%c IN (C:\sysType.txt) DO SET arch=%%c
ECHO %arch% | FIND "86" > NUL
IF %ERRORLEVEL% == 0 (
GOTO VISTA
) ELSE (
GOTO 64
)
I also use this and it works fine:
SYSTEMINFO | FIND "OS Name" > C:\osName.txt
FOR /F "usebackq delims=: tokens=2" %%c IN (C:\osName.txt) DO SET vers=%%c
vers always has a proper value. What am I doing wrong?
#2
Posted 21 December 2011 - 06:25 AM
:OS-check
FOR /F "tokens=2*" %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber') DO SET build=%%B
if /I "%build%"=="2600" set OSbuild=XP
if /I "%build%"=="6000" set OSbuild=Vista
if /I "%build%"=="6001" set OSbuild=Vista
if /I "%build%"=="6002" set OSbuild=Vista
if /I "%build%"=="7600" set OSbuild=Win7
if /I "%build%"=="7601" set OSbuild=Win7
if /I "%build%"=="7602" set OSbuild=Win7
FOR /F "tokens=2*" %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName') DO SET prodname=%%B
SET ARCH=86
IF EXIST "%SystemRoot%\SysWOW64" set ARCH=64The above code assumes a 32-bit host unless the syswow64 folder exists, then 64-bit.http://www.windows-c...om-command.html
Scanning systeminfo is kind of clunky when lots of environment variables exist to help you.
%OS%
%PROCESSOR_ARCHITECTURE%
%PROCESSOR_IDENTIFIER%
Edited by Mr_Smartepants, 21 December 2011 - 06:31 AM.
#3
Posted 22 December 2011 - 05:06 AM
http://www.windows-c...om-command.html
Scanning systeminfo is kind of clunky when lots of environment variables exist to help you.
%OS%
%PROCESSOR_ARCHITECTURE%
%PROCESSOR_IDENTIFIER%
This link comes up not found.
Also, I need to know the version of windows installed, not the type of cpu installed. I'm running windows 7 64bit, %os% = Windows_NT. Doesn't help.
#4
Posted 22 December 2011 - 05:16 AM
IF EXIST "%SystemRoot%\SysWOW64" set ARCH=64[/code]
The above code assumes a 32-bit host unless the syswow64 folder exists, then 64-bit.
This I like and thank you! I hadn't thought of that.
#5
Posted 26 December 2011 - 06:16 PM
I think you can find more info at this link:This link comes up not found.
Also, I need to know the version of windows installed, not the type of cpu installed. I'm running windows 7 64bit, %os% = Windows_NT. Doesn't help.
http://www.windows-c...om-command.html
http://www.windows-c...fo-command.html
However with my localized Windows 7 French version I must use French language inside the command prompt, like this example:
C:\>SYSTEMINFO | FINDSTR /C:"Version du système"
C:\>systeminfo | findstr /C:"Version du système" Version du système: 6.1.7601 Service Pack 1 version 7601
You also can use:
C:\>SYSTEMINFO /FO LIST >C:\SysInfo.txt
To read all informations inside the text file and select the one you need to use !
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













