@echo off
:loop
tasklist | find /i "qq.exe"&&echo [ %time:~,-3% ]存在进程QQ.exe||start "" "D:\123.exe"&&exit
ping -n 5 127.1>nul
goto :loop
执行上面的代码,如果不存在QQ.exe,就执行123。EXE,然后退出。
=======================================
@echo off
:loop
ping -n 6 127.0.0.1>nul
tasklist|find /i "qq.exe">nul
if %errorlevel%==1 (
start "" "123.exe"
)
goto :loop
==========================================
代码如上,其中start那一句中123.exe改成123.exe的完整路径