永发信息网

想让VBS程序 判断是否存在1.exe进程 没该进程就运行1.exe文件 有进程则不做操作退出脚本 要怎么写求代码

答案:3  悬赏:10  手机版
解决时间 2021-02-14 21:10
  • 提问者网友:末路
  • 2021-02-14 12:35
那么代码都无法启动Program Files下的文件啊 是不是VBS程序都不能打开这文件夹里面的文件?
最佳答案
  • 五星知识达人网友:风格不统一
  • 2021-02-14 13:03
Set wsh=createobject("wscript.shell")
Set wmiService = GetObject("winmgmts:\\.\root\cimv2")
name = "1.exe"
Set wmiObjects = wmiService.ExecQuery("SELECt * FROM Win32_process where name='"&name&"'")
If wmiObjects.count=0 then
wsh.Run "D:\1.exe" '这里写1.exe的路径
End If
全部回答
  • 1楼网友:山有枢
  • 2021-02-14 14:28
Set prow = GetObject("winmgmts:\\" & strComputer).InstancesOf("Win32_Process") set shell=createobject("wscript.shell") Public Function Prpath(ByVal Val) For Each i In prow If LCase(i.Name) = LCase(Val) Then Prpath = Prpath + 1 End If Next End Function if prpath("1.exe")<1 then shell.run "1.exe路径" else wscript.quit
  • 2楼网友:举杯邀酒敬孤独
  • 2021-02-14 13:41

set ws=wscript.createobject("wscript.shell") do set wmi=getobject("winmgmts:\\.\root\cimv2") set list=wmi.execquery("select * from win32_process where name='123.exe'") if list.count<>0 then ws.run """c:\333.exe""" exit do end if wscript.sleep 1000 loop

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯