Wscript.Echo GetOSVersion()
' **********************************************************
' Windows 2000 : 5
' Windows XP : 5.1
' Windows 7 : 6.1
' Windows 8 : 6.2
' Windows 8.1 : 6.3
' Windows 10 : 10
' **********************************************************
Function GetOSVersion()
Dim obj,colTarget,objRow,str,aData,nData,I
Set obj = GetObject("winmgmts:\\.\root\cimv2")
Set colTarget = obj.ExecQuery( "select * from Win32_OperatingSystem" )
For Each objRow in colTarget
str = objRow.Version
Next
aData = Split( str, "." )
For I = 0 to Ubound( aData )
if I > 1 then
Exit For
end if
if I > 0 then
nTarget = nTarget & "."
end if
nTarget = nTarget & aData(I)
Next
GetOSVersion = CDbl( nTarget )
End Function
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme