I have been looking for a way to run a batch script(just a single 'del' command) whenever the system shutdowns or reboots. The system is running a Windows XP Professional with Service Pack 2.

link|improve this question
feedback

2 Answers

up vote 7 down vote accepted

You can define a shutdown script from within the group policy editor (Local Computer Policy -> Computer Configuration -> Windows Settings -> Scripts).

link|improve this answer
+1. I use the startup/shutdown script on all servers (via GPO) to have an email sent when a machine is shutting down, and has then booted back up, on top of monitoring, just in case the reboot is too quick for Nagios to catch it. Handy. (Although I'd love it if it didn't matter which servers were shut down :) – Andrew H Jul 18 '09 at 8:28
feedback

You can use scheduled tasks to run a command at system start or user log on. http://support.microsoft.com/kb/308569

link|improve this answer
Does not cover shutdown/logoff. – Richard Jul 18 '09 at 9:04
But can be combined with the other approach. – Joey Jul 18 '09 at 13:37
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.