获取主机名的vbs(cmdlib.wsc)
程序员文章站
2022-08-27 17:57:44
复制代码 代码如下: 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)