我是VBScript文件的初學者如果我嘗試驗證操作系統的版本,如果是Microsoft Windows XP Professional或Microsoft Windows 7 Professional我需要幫助我該如何解決以下代碼:如果在VBS中沒有驗證
set service = GetObject ("winmgmts:")
Dim os_7, os_xp
os_7="Microsoft Windows 7 Professional"
os_xp="Microsoft Windows XP Professional"
for each Process in Service.InstancesOf ("Win32_Process")
If Process.Name = "notes2.exe" then
WScript.Echo "Please Close the Lotus Notes Application and try again"
WScript.quit
End If
exit for
next
Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
for each System in SystemSet
WScript.Echo System.Caption
If System.Caption = os_7 Then
WScript.Echo "in 7"
Else If System.Caption = os_xp Then
WScript.Echo "in XP"
WScript.quit
Else
WScript.Echo "Is not supported "
End If
End If
Exit for
next
}
非常感謝你的幫助
什麼是代碼中的問題?請提供錯誤/警告? – Hiten004
以上代碼正在爲我工作 – Hiten004