进程监控自动切换

[quote]参考http://www.jbxue.com/article/6723.html[/quote]
保存为monitor.bat

@echo off
@echo 》》》进程监控开启 《《《

rem 功能描述:进程监控自动切换(循环)
rem 注:iexplore.exe 模拟A进程;notepad.exe模拟B进程
rem @author Harry Chang
rem @email cxiaolng@qq.com
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值