(view source code of killntpr.bat as plain text)
:: KILLNTPR.BAT, Version 1.03
:: KILL NT PRocess by its executable file name
:: Written by Rob van der Woude
:: Dependencies:  MS Windows NT Resource Kit
::  ENGLISH version of NT
:: Explain usage if no parameter was given.
:: Initialize main variable.
:: Display which process is about to get killed.
:: Lines with CMD.EXE are filtered out, because
:: otherwise this batch file might accidently
:: kill itself later.
TLIST | FIND /I " %1 " | FIND /I /V "CMD.EXE"
:: Ask confirmation unless /Y parameter was specified.
ECHO Are you sure you want to kill this process?
:: Redirect the line we just displayed to a temporary batch file.
:: By first feeding the line to TIME, we make sure the displayed
:: line will be preceded by a fixed string (Enter the new time:),
:: which makes it easier to store the FIRST word in the line (the
:: process ID) in an environment variable PID.
TLIST | FIND /I " %1 " | FIND /I /V "CMD.EXE" | TIME | FIND /I "%1" > TEMP.BAT
:: Create another temporary batch file, ENTER.BAT.
:: IMPORTANT: The string "Enter the new time:" is, of course,
:: language dependant, so modify and rename this batch
:: file accordingly if you use a non-English NT version.
:: Now call TEMP.BAT, which in turn call ENTER.BAT, which sets the
:: value of environment variable PID to the wanted process ID.
:: Kill the process by its process ID.
:: Clean up the mess.
:: And quit.
:: Display help screen
ECHO KILLNTPR.BAT, Version 1.03
ECHO KILL NT PRocess
ECHO Written by Rob van der Woude
ECHO Usage: KILLPRNT program_name [ /Y ]
ECHO program_name is the file name of the executable
ECHO with extension but without path
ECHO This batch file uses some utilities from the MS Windows NT Resource Kit.
:: Modify or remove the next command line if you
:: adapted this batch file to any other language.
|page last uploaded: 2017-07-06, 12:37|