本帖最后由 qq2501 于 2011-12-22 14:24 编辑
方法1 效率、代码少- @echo off
- set "web=http://www.163.com/ http://www.qq.com/ http://www.baidu.com/"
- for %%i in (%web%) do explorer %%i
- ping 127.1 -n 10 & taskkill /F /IM iexplore.exe
复制代码 方法2 准确判断PID关闭进程,缺点代码多,资源消耗高- @echo off
-
- (WMIC PROCESS CALL CREATE "C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.baidu.com"
- WMIC PROCESS CALL CREATE "C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.163.com"
- WMIC PROCESS CALL CREATE "C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.sina.com.cn") | findstr "ProcessId" >PID.TXT
- for /f "tokens=1,2,3 delims= " %%i in (PID.TXT) do echo %%k >>PID2.TXT
- for /f "tokens=1,2 delims=;" %%i in (PID2.TXT) do echo %%i >>PID3.TXT
- ping 127.1 -n 3
- for /f %%i in (PID3.TXT) do WMIC PROCESS where processid=%%i call terminate
- del PID.TXT PID2.TXT PID3.TXT
- exit
复制代码
|