Determine Os In Vbscript? 追蹤

0

Is there a way to tell using VBScipting if the computer it's running on is XP or Windows7? 

 

thanks,

Valerie

1 意見

0
Avatar
Ian Cummings
版主
評論操作 永久連結

A quick Google search on getting the Windows version number in VBS gave me the below example code:

 

Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")

For Each os in oss
   value =  "Version: " & os.Version
Next

It seems to do the trick.  The below link gives the full name to what each version of Windows is:

 

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx

登入寫評論。