@Echo off goto :MAIN :USAGE echo. echo Usage: KillProc ^[ ^ ^| ^ ^] echo. echo Kills all matches to the process name entered. echo. echo Example: KillProc explorer echo Kills all EXPLORER.EXE processes. echo. echo ^/H - Displays this help screen. goto :eof :MAIN set FOUND= if {%1}=={/h} goto :USAGE if {%1}=={} goto :USAGE for /f "tokens=1" %%i in ('tlist ^| find /i "%1" ^| find /v /i "KillProc"') do ( kill %%i set FOUND=TRUE ) if not defined FOUND ( echo Process not found. goto :USAGE )