我想知道它是否可以在Windows登录脚本中检测Windows CE(Scrip在用户帐户中运行)。
我认为可以通过检查某些文件检测到这一点,但我希望有一点“更清洁”的解决方案。
答案 0 :(得分:2)
您可以使用以下代码使用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
并手动运行。这将为您的系统输出正确的版本#。