This post introduces how to use defrag command to analyze or defrag hard drives on your Windows 10/11 PC. For other computer tips, tricks, and useful tools, you may visit MiniTool Software official website.

About Defrag Command

Defragmentation is the process that reduces the degree of fragmentation of a storage device to improve its performance. This process organizes the contents of the mass storage device and stores the files in the smallest number of contiguous regions. It also uses compaction to release more free space for the disk.

On Windows 10/11, you can use the defrag command via Windows Run or Windows Command Prompt to defrag Windows 10/11.

How to Use Defrag Command to Defrag a Windows 10/11 PC

Run the Windows defrag tool via Run:

  • Press Windows + R, type dfrgui in the Run dialog, and press Enter. Alternatively, you can also press Windows + S, type defrag, and select the Defragment and Optimize Drives App to open this tool.
  • Next, you can select the target drive you want to optimize and click the Optimize button to optimize the drive to make it work more efficiently.

Defragment and Optimize Drives App

Run defrag command from Command Prompt:

  • Press Windows + R, type cmd, and press Ctrl + Shift + Enter to open the elevated Command Prompt.
  • Type defrag.exe or defrag -? in Command Prompt and press Enter to list all the command line parameters of the Windows defragment tool.
  • Then you can type the corresponding command lines to analyze or defrag the hard drives. For instance, you can type defrag –c to defragment all volumes on your computer, type defrag c: -a to analyze the C: drive, type defrag c: -w to perform a full defragment, type defrag c: -f to force the defragment when the free space is less than 15% on the C partition, etc. You can replace c: with any drive letter on your computer to analyze or optimize other drives of your PC.

defrag commands

Tip: You can also use some third-party professional disk defragmentation tools to defrag disks. You may try Defraggler, Smart Defrag, Auslogics Disk Defrag, Puran Defrag, Disk SpeedUp, UltraDefrag, etc.

Professional Windows 10/11 Hard Drive Space Analyzer

To analyze and optimize hard drive space, you can use a professional hard drive space analyzer.

MiniTool Partition Wizard is a professional disk partition manager that lets you manage hard disks from all aspects. It also includes a disk space analyzer utility. You can use it to easily select a hard drive to analyze its space usage. It helps you easily identify the large files that use the most space on the drive. You can directly delete those unnecessary large files to free up disk space on Windows 10/11.

MiniTool Partition Wizard also lets you easily create, delete, extend, resize, merge, split, format, or wipe partitions. You can also use it to migrate OS to SSD/HD, test hard drive speed, check and fix disk errors, and more.


You can run defrag commands on Windows 10/11 to easily defrag or analyze your hard drive space.

For other computer tips and tricks, you can visit MiniTool News Center.

To download and try software programs from MiniTool Software, you can visit its official website. You can find MiniTool Power Data Recovery, MiniTool ShadowMaker, MiniTool MovieMaker, MiniTool Video Converter, MiniTool Video Repair, and more.

  • linkedin
  • reddit