引用
参考http://www.jbxue.com/article/6723.html
保存为monitor.bat
@echo off @echo 》》》进程监控开启 《《《 rem 功能描述:进程监控自动切换(循环) rem 注:iexplore.exe 模拟A进程;notepad.exe模拟B进程 rem @author Harry Chang rem @email [email protected] rem @date 2015-05-23 12:08:32 rem @version 1.0 :1 rem 如果 A进程 不存在则进入 2, 存在则关闭 A进程 并打开 B进程 并等待5秒 tasklist | find "iexplore.exe" || goto 2 echo A进程存在,关闭A并启动B进程 taskkill /f /im iexplore.exe start notepad.exe echo 等待5s ping 127.1 -n 5 >nul 2>nul goto 1 :2 rem 如果 B进程 不存在则进入 1, 存在则关闭 B进程 并打开 A进程 并等待5秒 tasklist | find "notepad.exe" || goto 1 echo B进程存在,关闭B并启动A进程 taskkill /f /im notepad.exe start iexplore.exe echo 等待5s ping 127.1 -n 5 >nul 2>nul goto 1