help please ! To check O/S and version and goto menu

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kevinbarker
Posts: 7
Joined: 06 Mar 2012 08:02

help please ! To check O/S and version and goto menu

#1 Post by kevinbarker » 30 Oct 2012 04:21

This is what i have so far, how can i get it to check if it is 32 or 64 bit?

thanks for any help

echo

ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto ver_2003

ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp

ver | find "2000" > nul
if %ERRORLEVEL% == 0 goto ver_2000

ver | find "NT" > nul
if %ERRORLEVEL% == 0 goto ver_nt

if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexit

FOR /F "delims=: tokens=2" %%i IN ('systeminfo 2^>NUL ^| find "OS Name"') DO set vers=%%i

Name"') DO set vers=%%i

echo %vers% | find "Windows 8" > nul
if %ERRORLEVEL% == 0 goto ver_8

echo %vers% | find "Windows 7" > nul
if %ERRORLEVEL% == 0 goto ver_7

echo %vers% | find "Windows Server 2008" > nul
if %ERRORLEVEL% == 0 goto ver_2008

echo %vers% | find "Windows Vista" > nul
if %ERRORLEVEL% == 0 goto ver_vista

goto warnthenexit

:ver_8
:Run Windows 8 specific commands here.
echo Windows 8
goto exit

:ver_7
:Run Windows 7 specific commands here.
echo Windows 7
goto exit

:ver_2008
:Run Windows Server 2008 specific commands here.
echo Windows Server 2008
goto exit

:ver_vista
:Run Windows Vista specific commands here.
echo Windows Vista
goto exit

:ver_2003
:Run Windows Server 2003 specific commands here.
echo Windows Server 2003
goto exit

:ver_xp
:Run Windows XP specific commands here.
echo Windows XP
goto exit

:ver_2000
:Run Windows 2000 specific commands here.
echo Windows 2000
goto exit

:ver_nt
:Run Windows NT specific commands here.
echo Windows NT
goto exit

:warnthenexit
echo Machine undetermined.

:exit
PAUSE

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: help please ! To check O/S and version and goto menu

#2 Post by foxidrive » 30 Oct 2012 04:23

You can check for the program files (x32) folder, or environment variable whatever it is called.

Boombox
Posts: 80
Joined: 18 Oct 2012 05:51

Re: help please ! To check O/S and version and goto menu

#3 Post by Boombox » 30 Oct 2012 04:52

.
Foxi means 'Program Files (x86)'...

Code: Select all

echo %processor_architecture%


Code: Select all

wmic cpu get datawidth


More CPU info...

Code: Select all

wmic cpu get /format:list


...............

WMIC /? will give you plenty of stuff to play with...

I often use...

Code: Select all

@echo off
color 4f
:start
echo ----------
echo OPERATING SYSTEM...
echo ----------
wmic os get /format:list | findstr "Version= CSDVersion= NumberOfProcesses= OSArchitecture= SerialNumber= SizeStoredInPagingFiles= Caption="
echo ----------
echo CD/DVD/VIRTUAL DEVICES...
echo ----------
wmic cdrom get /format:list | findstr "Caption="
echo ----------
echo MOTHERBOARD...
echo ----------
wmic computersystem get /format:list | findstr "Manufacturer= Model= Username="
echo ----------
echo CPU...
echo ----------
wmic cpu get /format:list | findstr "@ Cache"
echo ----------
echo GROUP POLICIES...
echo ----------
wmic group get /format:list | findstr "Caption="
echo ----------
echo LOGICAL DISKS...
echo ----------
wmic logicaldisk get /format:list | findstr "DeviceID= FreeSpace= Size= VolumeName="
echo ----------
echo RAM...
echo ----------
wmic memorychip get /format:list | findstr "Capacity= Speed="
wmic memphysical get /format:list | findstr "MemoryDevices="
echo ----------
echo CRASH HANDLING...
echo ----------
wmic recoveros get /format:list | findstr "AutoReboot= ExpandedD"
echo.
pause>nul

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: help please ! To check O/S and version and goto menu

#4 Post by abc0502 » 30 Oct 2012 05:04

The code Boombox posted is nice and easy

Code: Select all

echo %processor_architecture%

Post Reply