Windows provides a command line utility ‘defrag‘ to defragment disks. The usage of this command is explained below with examples.
To run defragmentation on a drive we need to run the below command.
For example, to defragment C: drive the command we should run is defrag C:
To just analyze the gains of defragmentation without actually performing defragmentation, we need to add -a switch.
For example to do defragmentation analysis for C: drive we need to run the below command.
defrag -a C: