This is a quick way to get the version string from the output of the Command Prompt ver command within a VBScript.
Dim oShell, oExec
Dim sText, bQuit
Dim iIndexStart, iIndexEnd
sText = ""
bQuit = False
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec("%comspec% /c ver")
Do While bQuit = False
If Not oExec.StdOut.AtEndOfStream Then
sText = sText & oExec.StdOut.ReadAll()
End If
If oExec.Status = 1 Then
bQuit = True
Else
WScript.Sleep(100)
End If
Loop
'ver returns Microsoft Windows [Version 6.0.6001]
'parse it to return only the version number string
iIndexStart = InStr(1, sText, "[", 1)
iIndexEnd = InStr(1, sText, "]", 1)
MsgBox Mid(sText, iIndexStart+9, iIndexEnd-iIndexStart-9)
Version Strings for Windows Releases
| Windows 2000 | Microsoft Windows 2000 [Version 5.00.2195] |
| Windows XP | Microsoft Windows XP [Version 5.1.2600] |
| Windows Vista | Microsoft Windows [Version 6.0.6001] |
| Windows 2008 | Microsoft Windows [Version 6.0.6001] |