I'm trying to find a way to run a command on shutdown on a windows XP system. I've got a task i would prefer to be ended gracefully (and there's a command that would let me do it). While i can run a command at boot up or log on, i can't seem to do so at shutdown. Having a batch file for shutdown as opposed to the button isn't a solution since i'd have to make sure anyone who shuts down the system knows, and i won't be onsite most of the time.
-
3Does "command" mean 'script' or '.exe'? That is, do you want a script to execute or an application to run when the computer is shut down? I don't believe you can (easily) run a program when the user shuts down the computer from Start > Shutdown. If you want to execute a script, you might want to investigate the Group Policy feature. Run gpedit.msc and go to Computer Configuration > Windows Settings > Scripts (Startup/Shutdown).– ScottFeb 24, 2010 at 3:56
-
i'd be fine with either. The specific use case is to give virtualbox (which i plan on running in headless mode) a chance to shutdown gracefully should someone switch off the computer 'properly'. This looks like the answer... pending testing at least- so could you put it down as a proper answer so i can select it as the right one, should it be so?– Journeyman Geek ♦Feb 24, 2010 at 23:43
-
hmm... also, what format do the scripts need to be?– Journeyman Geek ♦Feb 24, 2010 at 23:58
Add a comment
|
1 Answer
Task Scheduler can run tasks at "user session disconnect" (logging off) however nothing for Shutdown. If there is a user logged in you could use this, otherwise go for the Group Policy thing.