I have writted this vbs script to get windows version from registry:
Runned at command prompt this way:get_version.vbs wrote:Option Explicit
Dim WSHShell, RegKey
Set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKLM\Software\Microsoft\Windows NT\CurrentVersion" & "CurrentVersion"
WScript.Echo WSHShell.RegRead (RegKey)

this will return, for exemple 5.1 for XP.at command prompt wrote:cscript.exe //nologo get_version.vbs
How to create a command script to execute different commands depending of OS?returned [b]CurrentVersion[/b] values wrote:Win2K - CurrentVersion = 5.0
WinXP - CurrentVersion = 5.1
Win2K3, WinXPx64 - CurrentVersion = 5.2
Vista - CurrentVersion = 6.0
Seven - CurrentVersion = 6.1