获取主机名的vbs(cmdlib.wsc)
程序员文章站
2022-04-29 09:34:38
复制代码 代码如下: strcomputer = "." set objcmdlib = createobject("microsoft.cmdlib") set objc...
复制代码 代码如下:
strcomputer = "."
set objcmdlib = createobject("microsoft.cmdlib")
set objcmdlib.scriptinghost = wscript.application
set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2")
wscript.echo objcmdlib.gethostname(objwmiservice)