.BAT file to kill all running programs and log off?

Soldato
Joined
20 Jan 2005
Posts
2,722
Location
Whitley Bay
Trying to write a .BAT file to kill off all my programs at the end of the day and log off.
I've got one to launch all of my programs and I want one to basically do the opposite.
I'm aware of the KILLTASK command but unfortunately I'm on Win2k which puts a stop to that.
Not allowed to install any additional software so really need to use the existing utils within Windows.

Any ideas?

TIA

Si.
 
go to sysinternals.com and download pstools ;)

pskill.exe for the programs
psshutdown.exe for the logoff

best commandline toolkit site ever, so good MS has now made the guys employees!

freeware
 
What bledd. said above ^ :D

psshutdown has an option -o which logs off the console user on the machine. I would have thought logoff should in effect kill most running tasks (other than any services started). :)
 
shutdown -L -F

Logs the machine off and forces the termination of all tasks.

Easy.

Burnsy

Edit: and use the 'at' command for specifying a time. I think thats now depriciated, but there's a direct replacement.
 
Last edited:
good thing to use is the pstools, inconjunction with scheduled tasks, you can tell it exactly when to launch then..
 
Ended up with pskill.exe from sysinternals and logoff.exe from the win2k resource kit.
Shutdown isn't recognised as a command - may have been disabled by IS :/
 
InsomniaCalls said:
Ended up with pskill.exe from sysinternals and logoff.exe from the win2k resource kit.
Shutdown isn't recognised as a command - may have been disabled by IS :/


psshutdown from pstools does work :)
 
Getting a bit of an issue with the .BAT where it seems to be looping.
It'll end all of the programs but then try and run the commands again.
Because the process no longer exists it asks if I want to abort the operation and just keeps looping for each process.

The .bat file is basically:

pskill SalesGUI.exe
pskill outlook.exe
pskill iexplore.exe
pskill Virtual PC.exe

logoff /n /f

Any ideas?
 
hmm..

might need

pskill "virtual pc"


if you whack the pstools into windows\system32 folder, then you can just type pskill sol.exe

in run box or form a bat file from anywhere :)
 
Last edited:
Back
Top Bottom