Using systeminfo to get the OS Name
- by WileCau
I need to find the flavor of Windows that is running using a batch file that will run on anything from Windows NT to Windows 7. I'm using a method based on this page with some minor changes.
Systeminfo gives the flavor of Windows that is running. Is there any authoritative list of names that can be returned? If so where would I find the list?
My intention is to do something like:
winVer=Unknown
rem NT doesn't have systeminfo
ver | find "Windows NT" > nul
if %errorlevel%==0 set winVer=WinNT
for /f "delims=: tokens=2" %%v in ('sysinfo ^| find "OS Name"') do (
set verStr=%%v
)
echo %verStr% | find "Windows XP" > nul
if %errorlevel%==0 set winVer=WinXP
echo %verStr% | find "Windows Vista" > nul
if %errorlevel%==0 set winVer=WinVista
... etc
Thanks