Echo Please wait.... detecting Windows OS version...
ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto done
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
ver | find "2000" > nul
if %ERRORLEVEL% == 0 goto done
ver | find "NT" > nul
if %ERRORLEVEL% == 0 goto done
if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexit
systeminfo | find "OS Name" > %TEMP%\osname.txt
FOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%i
echo %vers% | find "Windows 7" > nul
if %ERRORLEVEL% == 0 goto ver_7
echo %vers% | find "Windows Server 2008" > nul
if %ERRORLEVEL% == 0 goto done
echo %vers% | find "Windows Vista" > nul
if %ERRORLEVEL% == 0 goto ver_7
goto warnthenexit
Wednesday, January 30, 2013
Finding Windows OS version using Batch file
Subscribe to:
Post Comments (Atom)
No comments:
New comments are not allowed.