Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The command Defrag %SystemDrive% /b really works to optimize Windows boot time? (The defrag /b option is not documented by Microsoft).

I am trying to use it in an attempt to optimize the files on the hard disk that Windows use to boot up the system. I suspect that I need to schedule defrag before Windows boot, however I am not succeeding on it with defrag. Anyone knows another software that works for it?

share|improve this question
up vote 5 down vote accepted

Defrag is a windows program and runs while windows is running. You can schedule a scan disk for before windows completely loads, but not defrag. There are tools you can use that defragment outside of windows, but windows built-in defrag is more than sufficient for most needs.

I schedule defrag to run for a few hours a couple nights each week. That way it keeps the disk to a very low level of fragmentation.

Regarding the -b option, I found this explanation:

The Prefetch directory has one additional salutary function when used in conjunction with the built-in defragmenting tool. Every three days, during idle times, this utility rearranges program code, moving it to the outside of the disk to make it more efficient when loading (to force Windows to perform this optimization without having to do a full defragmentation, use the Defrag.exe command with the -b switch. For instance: defrag c: -b).

Apparently your computer already does this regularly, and unless you move massive files frequently across your harddisk and restart several times each day, you're not going to notice must of a benefit.

In my experience, people turn to defrag to speed up their systems much too quickly. I can count on one hand the times defragging has actually sped up systems that I have observed. And as a veteran of corporate and consumer IT support, that's saying something.

Set a scheduled defrag, don't bother with the -b option, and leave it at that. If you have computer slowness there are a myriad other options you should look into that will be much more effective in speeding the system up.

share|improve this answer
windows 7 has a scheduled defragmentation run by default, iirc – Journeyman Geek May 17 '11 at 5:45

As you note, defrag at boot time allows you to move files that are normally in use by the system after boot. There is actually one case where these files need to be moved... if you are attempting to Shrink a partition to recover space for other uses. Say your C: drive needs more space and you wasted a lot of junk that can be removed on an F: drive. I used to be able to do this, but in Windows 2008, I might free up 75% of the space on a drive and end up only being able to Shrink the drive to half the size. It sounds like the -b option now works against any attempt to help free space at the end of a drive, so it can shrink, by moving program files out.

I find virtual disks are constantly in need of such maintenance when space gets tight. Oh well, at least in Hyper-V I can compact a dynamic drive to recover the empty space in the middle. It just introduces a false sense of capacity when you look at what the VM thinks is available.

share|improve this answer

Actually you can run defrag before Windows starts, just boot into the Recovery Environment, open a command prompt, go into de drive where Windows is installed something like: C:\windows\system32\ then type defrag and it will be running.

share|improve this answer

So long as you do it properly it's not going to hurt, but the benefit of it really depends on the condition of your system.

Enter this in to notepad:

Rundll32.exe advapi32.dll,ProcessIdleTasks
defrag -b %SystemDrive%

save it as 1.bat on your desktop then right click it and run as admin. the first line tells it to wait until you've closed all running applications so it will just sit there if you have anything running.

share|improve this answer

It depends on what you're trying to defrag. The point of boot time defrag is to attempt to defragment things like the master file table, and the pagefile (which is can be done using system internal's page defrag or other tools). I've never noticed a huge performance difference after defragmenting my page file (on the other hand on XP era systems, a normal defrag can seem like magic).

In short - there's no advantage to boot time defrag, over a good regular schedule of good old fashioned online defragmentation.

share|improve this answer

Your Answer


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.