Defrag a drive in Windows 7 using command line [How-to]
Although windows comes with a powerful defragmentation utility, there might be instances when you would want to defrag your drive using the command line. Even when you don’t have a reason to use the command line for defragmenting your drive, you might wanna do it because it’s cool and you can show off your power user status in front of your friends.
Let’s see how to defrag a drive using command line in Windows 7.
1. To view the fragmentation analysis of your drive (say C:),
type the following at the command prompt:
defrag c: -a -v
-a tells the defragger to perform a fragmentation analysis on the drive in question (C: in this case). -v tells it to be verbose in its report. You can change the drive letter to check the fragmentation analysis for that drive.
2. To defrag a drive (in this case c:)
defrag c: -v -r
-r says the defrag utility to treat files that are fragmented with 64 MB fragments or larger as though they are not fragmented. This is default in Windows 7.
3. To defrag every file irrespective of it’s size
defrag c: -v -w
-w tell the defrag utility to defrag everything.
This option is not available in the GUI defragmenter utility on Windows 7 and hence command line gives you better option to defrag your drive.