To kill a process in a batch file, you can determine if it is running by parsing the output of
PuList. Extract the PID and use Kill from the
Windows 2000 Support Tools, or the Windows NT 4.0 Resource Kit.
I have scripted Killproc.bat which can be used with the following syntax:
Killproc <Process>
Example: To kill Microsoft Word, if it is running: call Killproc Winword.exe
NOTE: The batch is not case sensitive.
Killproc.bat contains:
@echo off setlocal set proc=%1 for /f "Skip=3 Tokens=1,2" %%i in ('pulist') do call :myproc %%i %%j endlocal goto :EOF :myproc If /i NOT "%1" EQU "%proc%" goto :EOF Kill /f %2NOTE: If you do not have Kill.exe, replace Kill /f %2 with pskill %2.
0 comments
Hide comments