for each x in getobject("winmgmts:").execquery("select * from CIM_DataFile where FileName = 'qq' and Extension = 'exe'")
str = x.name
ws.run chr(34) & str & chr(34)
谁能帮我详细解释下这个代码,他会自动找到QQ.EXE并运行
for each x in getobject("winmgmts:").execquery("select * from CIM_DataFile where FileName = 'qq' and Extension = 'exe'")
str = x.name
ws.run chr(34) & str & chr(34)
谁能帮我详细解释下这个代码,他会自动找到QQ.EXE并运行
你写的不规范,应该这么写
set ws=wscript.createobject("wscript.shell")
set wmi=getobject("winmgmts:\\.\root\cimv2") '调用本机的WMI查询
set list=wmi.ExecQuery("select * from CIM_DataFile where FileName = 'qq' and Extension = 'exe'")'调用WQL查询语句,选用CIM_DataFile的类,查询文件名为QQ后缀为EXE的文件
for each uu in list
ws.run uu.name '运行此程序
next