Tuesday, March 9, 2010

Defragment in Windows 7 using Command Prompt

By Bikash..
Although windows comes with a powerful defragmentation utility, there might be instances when you would want to defrag your drive using the command prompt. 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.(Well, don’t mind. It’s normal :’)
Let’s see how to defrag a drive using command line in Windows 7.
   Switch                             Description
     /a Perform analysis on the specified volumes.
     /c Perform the operation on all volumes.
     /e Perform the operation on all volumes except those specified.
     /h Run the operation at normal priority (default is low).
     /m Run the operation on each volume in parallel in the background.
     /t Track an operation already in progress on the specified volume.
     /u Print the progress of the operation on the screen.
     /v Print verbose output containing the fragmentation statistics.
     /x Perform free space consolidation on the specified volumes.
     /r Performs partial defragmentation (default). Attempts to consolidate only fragments smaller than 64 mb.
     /w Performs full defragmentation. Attempts to consolidate all file fragments, regardless of their size.
     /f Forces defragmentation of the volume when free space is low.
Several new switches or parameters are added to the defragmentation console tool (defrag.exe) in Windows 7. The switches are /E, /H, /M, /T, /U & /X. Here is the entire list of parameters supported by defrag.exe (v6.1) in Windows 7.
IMPORTANT:
To use defrag in command prompt, you have to run the “cmd” as administrator. Without admin privilege defrag.exe will not work.
Command
 
EXAMPLES:
1. To analyze a drive (say C:)  --   defrag c: /a /v
2. To defrag a drive (say E:) – defrag /v /r
3. To defrag every file irrespective of its size – defrag c: /v /w





No comments: