remrem Batch OS Detection routinesrem by Matt Borcherding, matt@borchtech.comremrem last updated 11-18-09rem updates posted on borchtech.blogspot.comremremrem Make sure temp directory exists - need it below routines...rem If not (for whatever reason), create it!remif not exist "%temp%" md "%temp%" > nul:Determine_Operating_Systemremrem Determine the current Windows operating system.remrem Detection routines based on some from:rem http://www.amset.info/loginscripts/os-id.aspremrem But fixed a few bugs, and added support forrem Vista/2008/7/2008R2 detection, Server Core detection,rem and 32/64-bit detection.remset opsys=win9xset bits=32set servercore=falseif %os%==Windows_NT goto NT_ver_checkremrem If the %OS% environmental variable doesn't exist, then the OSrem must be Win9x or Win ME.remgoto 64_bit_check:NT_ver_checkver > "%temp%\osver.txt"if exist "%windir%\system32\reg.exe" reg.exe query"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName >> "%temp%\osver.txt"remrem Vista and Server 2008 show identically in VER.EXErem Windows 7 and Server 2008 R2 also show identicallyrem in VER.EXE. So we need to check a registry keyrem instead to tell the difference.remrem Reg.exe doesn't get installed on NT or 2k, but VER.EXErem sufficies to identify those.
Leave a Comment