使用方法: killtask.bat process_name
比如: killtask.bat firefox杀掉所有firefox进程。
源代码如下:
- @echo off
- rem Usage: killtask.bat process_name
- set process_name=%1
- setlocal EnableDelayedExpansion
- tasklist > c:\tasks.txt
- for /F "tokens=1-6" %%i in ('findstr /I "%process_name%" c:\tasks.txt') do (
- set FIELD=%%j
- @echo TaskID: !
- if not "!FIELD!"=="" (
- rem kill the process
- @echo Start to kill the process !
- taskkill /F /PID !
- @echo process ! killed
- )
- )
《返璞归真--UNIX技术内幕》在全国各大书店及网城均有销售:
阅读(10284) | 评论(0) | 转发(0) |