1
我想知道它是否可檢測Windows登錄腳本中的Windows CE(腳本在用戶帳戶中運行)。在vBScript中檢測Windows CE(登錄腳本)
我認爲它有可能通過檢查某個文件來檢測到這一點,但我希望有一點「更清潔」的解決方案。
我想知道它是否可檢測Windows登錄腳本中的Windows CE(腳本在用戶帳戶中運行)。在vBScript中檢測Windows CE(登錄腳本)
我認爲它有可能通過檢查某個文件來檢測到這一點,但我希望有一點「更清潔」的解決方案。
您可以使用下面的代碼來檢查使用WMI的VBscript中的Windows版本。用適當的版本號替換XXXXXXXXX。
strComputer = "." 'We are using computer "here"
set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2") 'Initialize WMI object for this computer
'Displays which operating system is installed on the current computer.
set colOperatingSystems = objWMIService.ExecQuery _
("Select Caption, Version from Win32_OperatingSystem") 'Query WMI for OS Version
'Validate that OS version is valid
for each objOperatingSystem in colOperatingSystems ' Parse results
if objOperatingSystem.Version = "XXXXXXXXX" Then
'Do something here
end if
next
如果你不知道的版本是什麼,嘗試暫時改變的if/then語句
WScript.Echo objOperatingSystem.Version
和手動運行它。這將爲您的系統輸出正確的版本號。