批处理和VBS检测进程是否存在并执行相关操作

2025-01-01 06:02:53
推荐回答(2个)
回答1:

tasklist/nh|find/i"ClientOfWatcher.exe" ifERRORLEVEL1(startC:\watcher\ClientOfWatcher.exe)else(exit) VBS定时检测进程是否存在,如果不存在就启动进程。

回答2:

on error resume nextset
y=getobject("winmgmts:\\.\root\cimv2")
set ws=createobject("wscript.shell")
set x=y.execquery("select * from win32_process where name='BaiduHi.exe'")
for each i in x
msgbox "BaiduHi进程存在"
wscript.quit
next
msgbox "BaiduHi进程不存在"