Introduction: Process Sniper - Batch File

This is a small program I have been working on.  I have been working on it for a few hours in total so it still might have some bugs, but anyway.
The batch file contains two functions, 1.) it will list all the processes that are running on your computer and 2.) it can kill the process that you type in by either name (process.processextension e.g notepad.exe) or PID.  It also outputs all the process names you type in to an external file that is written over when you start the batch file again, the name of this file is configurable in the code under the variables at the top of the code.  It could easily save it anywhere on your hard drive with only very minor tweaks to the code.
here is the code:

:: This is origional code writen by John Allen
:: Permission to use this code without payment is given to anyone as long as credit is given
:: on the following conditions:
:: 1.) If this code is used as part of a program intended for comercial use, the writer (John Allen)
:: must be contacted and notified of this and he reserves the write to deny the useage of the code to anyone
:: 2.) This message and the title block is left in the code
@ECHO OFF
set version=1.6
set outputfile=log
set outfileext=txt
color 0a
title Process Sniper v%version%
echo Processes attempted to shut down in the last session:>%outputfile%.%outfileext%
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo ::    Process Sniper v%version%        ::
echo ::          writen by John Allen        ::
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo.
goto choice
exit /b
:list
wmic process get Name, ProcessID
goto choice
:kill
set /p input=Enter the process name/PID you wish to snipe:
taskkill /pid %input%
echo %input%>>%outputfile%.txt
goto choice
:close
cls
color 0c
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo ::    You have been using        ::
echo ::    Process Sniper v%version%        ::
echo ::           writen by John Allen        ::
echo ::         Press any key to close...        ::
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
pause>null
DEL null
exit
:choice
echo Choose from the following:
echo 1.) List processes currently running
echo 2.) Snipe a process by name/PID
echo 3.) Exit Process Sniper v%version%
choice /c 123 /n
if errorlevel 1 set gt=list
if errorlevel 2 set gt=kill
if errorlevel 3 set gt=close:
goto %gt%








Step 1: Outro

Any help on improving it would be much appreciated, this is my first batch application and I am looking into doing more in the future, maybe some small games or some more complex processes to do with administation on servers or something, but what ever.

Comments

author
Prof. Pickle (author)2012-12-15

Interesting, personally I'd just use command prompt, but for the less technically savvy, this is an excellent tool

Keep in mind though, this is basically just taskmanager, try to add more to be better than it. That way more people will use it.

About This Instructable

4,534views

7favorites

License:

More by Jallen1337:Process sniper - batch file
Add instructable to: