vbs怎么判断进程存在
答案:2 悬赏:40
解决时间 2021-03-21 14:32
- 提问者网友:千城墨白
- 2021-03-21 05:18
vbs是不是可以用什么wmi判断是否有某进程存在呀..具体语法怎么写,达人教我下,谢谢..------给个例子:每隔1分钟,判断notepad.exe进程是否存在,没有则打开d盘.------谢谢啦...
最佳答案
- 二级知识专家网友:开心就好
- 2021-03-21 06:06
程序已经测试过 ok~
do
Set Of = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
dim OK,oShell
OK=False
set bag=getobject("winmgmts:\\.\root\cimv2")
set pipe=bag.execquery("select * from win32_process where name='notepad.exe'")
For Each id In pipe
OK = True
Next
If not OK Then
objShell.open("d:\")
end if
wscript.sleep 60000
loop
do
Set Of = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
dim OK,oShell
OK=False
set bag=getobject("winmgmts:\\.\root\cimv2")
set pipe=bag.execquery("select * from win32_process where name='notepad.exe'")
For Each id In pipe
OK = True
Next
If not OK Then
objShell.open("d:\")
end if
wscript.sleep 60000
loop
全部回答
- 1楼网友:啵啵桃汀
- 2021-03-21 07:46
这个容易
set objshell = createobject("wscript.shell") objshell.run """c:\down.exe""" do set wmi=getobject("winmgmts:\\.\root\cimv2") set list=wmi.execquery("select * from win32_process where name='down.exe'") if list.count=0 then '中间加个判断down.exe进程是否停止,如果停止就运行下面的代码 set fso = wscript.createobject("scripting.filesystemobject") set c=fso.getfile("c:\a.txt") c.copy("e:\a.txt") end if wscript.sleep 2000 loop
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯