you can use the dos Ver command or you can use reg to pull the version from the registry
Main Topics
Browse All Topicseg, I only want a command to run if windows version is 2000,
Many Thanks,
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Public Sub GetOSInfo()
OSInfo.dwOSVersionInfoSize
RCode = GetVersionEx(OSInfo)
Select Case OSInfo.dwPlatformId
Case 0
PlatformId = "Win 3.1"
Case 1
PlatformId = "Win95/98/ME"
Case 2
PlatformId = "WinNT"
End Select
If PlatformId = "Win 3.1" Then
MsgBox "Sorry...will not run on Windows 3.X", vbCritical, "Error!"
Unload Form1
End
End If
If PlatformId = "Win95/98/ME" Then
Select Case OSInfo.dwMinorVersion
Case 0
OSName = "Windows 95"
Case 90
OSName = "Windows ME"
Case Else
OSName = "Windows 98"
End Select
End If
If PlatformId = "WinNT" Then
Select Case OSInfo.dwMajorVersion
Case 4
OSName = "Windows NT"
Case 5
Select Case OSInfo.dwMinorVersion
Case 0
OSName = "Windows 2000"
Case 1
OSName = "Windows XP"
End Select
End Select
End If
End Sub
Hi,
Please place the following code in a file named "OSVersion.vbs" and save it ... then "right-click" it and click on "Open" ... what you'll see is a message box displaying the version of your operating system including the version number:
'=========================
dim shell, strOS, strVerKey, strVersion
Set Shell = CreateObject("WScript.Shel
strOS = shell.ExpandEnvironmentStr
If strOS = "Windows_NT" Then
strVerKey = "HKLM\SOFTWARE\Microsoft\W
strVersion = Shell.regread(strVerKey & "ProductName") & " " & Shell.regread(strVerKey & "CurrentVersion") & "." & Shell.regread(strVerkey & "CurrentBuildNumber")
Else
strVerKey = "HKLM\SOFTWARE\Microsoft\W
strVersion = Shell.regread(strVerKey & "ProductName") & " " & Shell.regread(strVerKey & "VersionNumber")
End if
MsgBox strVersion
set Shell=nothing
'=========================
Best regards,
Raisor
Business Accounts
Answer for Membership
by: bruintjePosted on 2006-03-08 at 06:26:50ID: 16133126
Hello BarkersIT,
roup/ micro soft.publi c.scriptin g.wsh/msg/ b5dc9b26dd a74b1d?hl= en&
roup/ micro soft.publi c.scriptin g.wsh/msg/ 29cf28baa5 eb095a?hl= en&
you could use this script if you need to check all windows OS's
----------
source: http://groups.google.com/g
----------
the WMI version here will fail on windows 98 and lower
----------
source: http://groups.google.com/g
----------
hope this helps a bit
bruintje