If you prefer the command line to the graphical interface, you can avoid maneuvering through menus and dialog screens to defragment your hard drive. (Using the command line also gives you greater control over the defragmentation process, as you’ll see in this hack.) To defragment a hard drive, type defrag C: at a command prompt, where C is the hard drive you want to defragment. When you use the command line, you won’t see a visual display of the defragmentation process, and you won’t be able to pause it or cancel it.

defrag also does work invisibly in the background to make sure that your programs load more quickly. It’s set up so that every three days, when your computer is otherwise idle, it moves program code to the outside of the disk to make programs load more quickly. You can force it to do that manually, without having to do a full defragment, by using the -b switch, like this:

defrag C: -b

It takes only a few minutes for defrag to do this, in contrast with a full defragmentation, which can easily take more than 20 minutes, depending on how defragmented your system is and the speed of your processor.

There are several other command-line switches you can use with the defrag command:

Analyzes the drive you want to defragment and shows you a brief analysis report, summarizing the hard disk size and total fragmentation. It only displays the report, however; it does not defragment the drive.

Analyzes the drive you want to defragment and shows you a comprehensive analysis report, detailing the size of the hard disk, percent of free and used space, total fragmentation, and total number of fragments, among other details. It gives the analysis report, defragments the hard disk, and then gives an analysis of the hard disk after defragmentation.

Forces the drive to be defragmented, even if there isn’t a certain minimum amount of space. Normally, you can defragment the drive only if your hard disk has at least 15% space free.

Post By Gishore J Kallarackal (2,121 Posts)

Gishore J Kallarackal is the founder of techgurulive. The purpose of this site is to share information about free resources that techies can use for reference. You can follow me on the social web, subscribe to the RSS Feed or sign up for the email newsletter for your daily dose of tech tips & tutorials. You can content me via @twitter or e-mail.

Website: → Techgurulive