Closing applications from the command line

Associate
Joined
23 Aug 2005
Posts
87
This is probably really simple, but I googled for about 40mins and found nothing useful. Maybe im really bad a googling, who knows. Anyway, I have written a hilariously simple file to replace my winamp shortcut with this "openwinamp.cmd":

START E:\"Program Files"\Winstick\Winstick.exe

START E:\"Program Files"\Winamp\winamp.exe

Thus opening both winamp and winstick (a program i need to open with winamp to use my remote) with a single shortcut. Now I need to extend this slightly so I have a PAUSE command, then afterwards tell winamp and winstick to close, so i can close them both when im done by just pressing enter, so it would look something like:

START E:\"Program Files"\Winstick\Winstick.exe

START E:\"Program Files"\Winamp\winamp.exe

PAUSE

(close winstick)
(close winamp)

Problem is I dont know how you tell a program to close from the command line. Can anyone help?
 
And literally minutes after writing that post I discover the TASKKILL command, now my file looks like:

START E:\"Program Files"\Winstick\Winstick.exe

START E:\"Program Files"\Winamp\winamp.exe

PAUSE

TASKKILL /im winamp.exe

TASKKILL /im winstick.exe

Just wondering if taskkill safely shutsdown the application or is it akin to the "end process" thing?
 
Same as killing the process in Task Manager, but for winamp and the like then there's no reason not to really :)
 
Also, check out PsTools - a freeware set of *very* useful command line tools for doing similar things. Most of which allow you to do them to the local and networked machines.
 
Harrigan said:
Thanks for the relpies, that pstools thing looks kind of interesting. Does anyone know of a "safe shutdown" command I could use though?

How do you mean "safe" ?

Standard windows 'shutdown' command will do a safe shutdown. Go to a command prompt and type shutdown /? for the parameters.
 
I kind of mean instead of killing the process (TASKKILL), I'd rather send it the message that I would like it to close, so it has time to "finish up" whatever it was doing, like when you just click the x to close a program, instead of going to task manager and killing it.
 
got a better way for ya ;)


make a shortcut to winamp and place it in c:\windows\system32

call it say "amp"

then, go start, run, amp, press enter and it'll open

now download pstools as said above, put pskill.exe into system32, now make a bat file that says..

pskill winamp.exe

save that in the s32 folder also, as say killamp.bat

now start run, killamp will end winamp



taskkill /IM winamp.exe will do the same and its part of windows by default


-edit, reread what you asked for, and its a bit different, lol, but taskill is your friend and it won't 'hurt' winamp
 
Back
Top Bottom