Anybody know of a quick way of copying a log file used by a Windows XP service either before the service starts (during boot) or after the service has stopped (during shutdown)?

Preferably using the command prompt, but would consider any free tool to do this also.


You can add startup and shutdown scripts in windows. I think this is the easiest way to do what you want to do. Simply create a script which copies the service log to a location of your choosing. Simply execute the command from your boot or shutdown script.

This Page has some very illustrative instructions on how to enable the startup/shutdown script capability.

  • What happened to autoexec.bat?? – Umber Ferrule Aug 12 '09 at 19:44
  • Autoexec.bat still exists in windows, but it runs after the services are started up. I realized that would not do you any good. – Axxmasterr Aug 12 '09 at 20:21

A quick Google later and I've just come across Scripts (Startup/Shutdown) in the Group Policy editor (gpedit.msc). Under the headings: Local Computer Policy -> Computer Configuration -> Windows Settings -> Scripts (Startup/Shutdown). I opened Startup Properties and added a batch file to copy the desired file:

xcopy /v /c c:\service.log c:\

I've just rebooted and it did what I needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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