Defragment Boot Files on Windows 7

Last Updated on January 23, 2012 by CSch

Apart from the usual file defragmentation on Windows 7, there is another undocumented function that rearranges boot files to grant faster access on them, resulting in shorter boot times. The usual boot options can be viewed by entering defrag -? into a command line window (this can be done in any command line window; to actually start the defragmentation however you need an elevated command prompt - therefore search for cmd in the menu, right-click it and choose Run as Administrator).
The one we need to use, the /b switch, is not listed there. This undoubtedly has its reasons and you should back-up files before you run it. Do not run it if you fear loss of data.

defrag /b C:

I hereby assume that C: is the drive you have your boot-files on. I ran the command on a Windows 7 Enterprise 64-bit machine and it worked flawlessly.
If upon entering the defrag command you get the errorcode 0x89000017, stating that some registry entries are missing, run the following in an elevated command prompt, wait up to 20 minutes and try again afterwards:

Rundll32.exe advapi32.dll,ProcessIdleTasks

This will initiate some services to start that usually only run when the system is idle, one of them being a service of Superfetch that needs to be run before the defrag /b command.

Leave a Comment