操作系统VBS脚本

时间:2009-08-18 19:35:25

标签: vbscript operating-system

是否有人拥有基于客户端操作系统是Windows XP,2000,NT还是95来创建switch语句的示例VBS代码?

2 个答案:

答案 0 :(得分:3)

这将为您提供操作系统版本:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
    Wscript.Echo objOperatingSystem.Caption & " " & _
        objOperatingSystem.Version
Next

从这里你可以设置一个Select Case Statement(交换机的VB语法)并检查.Version对着Case“OS”,其中“OS”是从.Version返回的各种类型

以下是完成此操作的示例:

http://www.computerperformance.co.uk/ezine/ezine52.htm

答案 1 :(得分:0)