Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use PageDefrag to keep my page-file healthy, and have it set to run at every boot with a 1sec timeout. I think it would be really handy to be able to defrag the rest of my machine every-time I tell my machine to shut-down (not restart). If it could activate after windows has killed all the background processes and provide a little information on it's progress it would be very useful.

Is there anything that can do this, or is there a way I can "hook" a batch file/command into the shut-down process to run "defrag.exe"?

Please Note: I'm not looking for something that can defrag then shutdown, but rather initiate the shutdown procedure (to close all running/background apps) and then pause the shutdown to run the defrag while there are no locked files.

share|improve this question
    
For whatever solution you find: ensure it doesn't interfere with Windows Update, which sometimes runs during shutdown as well? –  Arjan Feb 23 '10 at 10:53
add comment

2 Answers

I use O&O Defrag and it can do the equivalent: it can shutdown the computer after having run the boot-time defragmentation.

share|improve this answer
add comment

You could write a Batch-File which is running f.e. MyDefrag and shuts down the machine afterwards, like this:

C:\PathToMyDefrag\MyDefrag.exe -r "yourSxriptHere"
shutdown -s -f -t 00

The MyDefrag-Script does need the following line it:

WhenFinished(exit)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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