SmartFAQ is developed by The SmartFactory (http://www.smartfactory.ca), a division of InBox Solutions (http://www.inboxsolutions.net)
How To Determine The Operating System?
Requested and Answered by Frank-Peter Schultze [webmaster] on 06-Sep-2005 17:40 (14425 reads)
The VER command displays the operating system version, for example:
C:\TEMP>ver
Microsoft Windows XP [Version 5.1.2600]
C:\TEMP>_
If you need to check the OS in a batch file you just have to examine VER's output with FIND or FINDSTR. The code below shows how to check if a batch file runs on Windows 9x or Windows NT/2K/XP:
@Echo Off
Ver | Find "95" >NUL
If Not ErrorLevel 1 Goto Win9x
Ver | Find "98" >NUL
If Not ErrorLevel 1 Goto Win9x
Ver | Find "Millennium" >NUL
If Not ErrorLevel 1 Goto Win9x
Ver | Find "NT" >NUL
If Not ErrorLevel 1 Goto WinNT
Ver | Find "2000" >NUL
If Not ErrorLevel 1 Goto WinNT
Ver | Find "XP" >NUL
If Not ErrorLevel 1 Goto WinNT
Echo Unsupported Operating System
Goto :EOF
:Win9x
::Windows 9x/ME code
:
:
Goto :EOF
:WinNT
::Windows NT code
:
:
Goto :EOF
|
|






