[2022] How to Run Defrag Command Windows 10?

Defragmentation of disk is always necessary, especially when your computer gets slow. This time, you’ll learn how to run defrag command Windows 10 along with another better alternative for disk defragmentation.


By Michael / Updated on May 12, 2023

Share this: instagram reddit

Help, my computer got really slow!

First of all, I should make a clarification that my PC has very good specs – 5700XT and 3700X – so it can’t be a hardware issue I think. No matter what I do with my computer, gaming or working, it’s literally as slow as a snail! I have tried replacing the HDD with a new SSD, clearing cookies and cache, and even upgrading to Windows 10, it didn’t work. Recently, I heard that I could possibly make my PC faster by defragmenting its disk via command line. However, I’m a complete novice for computing. So, how to run defrag command Windows 10? Can anyone give an answer?

Defragment disk to improve its performance

Over time, files on your hard disk could get scattered and exist in discontinuous clusters which badly affects read/write speed. In this case, defragmentation is imperative. Defragging your PC can both resolve and prevent a plenty of issues. If your computer runs slowly or if it takes a long time to boot into the OS every time you power it on, defragmentation may perfectly make it better. Otherwise, if your hard disk is too fragmented, you may encounter frequent freezing up or system crashes.

Under which circumstances to defragment a disk?

Usually, household users are suggested to defragment once per month while business users and servers do it every half month but it should be considered based on the fragmentation ratio. In the following situations, you’d defragment your disk.

1. A plenty of files have been added.

2. There’re only around 15% of available disk space.

3. A new program or a new version of Windows is installed.

4. Fragmentation over 15%.

Should I defragment an SSD?

The answer is negative. Defragmentation is to store files in contiguous areas of a hard disk so that they can be read immediately. The seek time of an HDD is relatively longer, so every time a file gets fragmented, it takes more time to read it. Therefore, it’s necessary to defragment an HDD to improve its performance.

However, what happens if you defragment an SSD? Due to the different working principle of SSD and HDD, SSD is able to read date spread on different sectors as quickly as read data adjacent to each other. Moreover, if you defragment an SSD, unnecessary wear and tear will be causes which reduce its lifespan.

The top 2 ways to defragment a hard disk

In general, if you want to defragment your hard disk, there’re 2 ways. One is using Windows 10’s inbuilt tool Command Prompt to perform the operation by using only 1 order; the other is using a powerful third-party utility to get it done more thoroughly and securely.

Method 1. Use defrag command Windows 10

Command Prompt is a Windows inbuilt utility with which you can execute various orders for disk management via command lines. Here, you’ll learn how to defrag with CMD Windows 10.

1. In the search box on the lower left of the desktop, type “diskpart” and hit “ENTER”.

2. In the command line environment, type “dfrgui” and hit “ENTER”.

3. Select a partition and hit “Analyze”.

4. After it’s completed, click on “Optimize”.

When it’s finished, your PC performance should be better.

Method 2. Use third-party software

Command Prompt might be a little bit complex if you’re a computing novice since it requires input of difficult orders. So, here I recommend an easier alternative – AOMEI Partition Assistant Professional –  that is capable of analyzing and defragmenting your hard disk within only a few clicks. Meanwhile, in the course of defragmentation, you can view details of partition scoring, total files and directories, fragmented files, fragments, and fragmentation rate. Moreover, if you don't want to defrag your hard drives manually every time, you can enable schedule defrag, making it work daily, weekly, or monthly.

Download the demo of the impressive disk manager to defragment your HDD more efficiently!

Download Demo Win 10/8.1/8/7/XP
Secure Download

Step 1. Install and launch AOMEI Partition Assistant Professional, right-click on the disk you want to defragment and select “Disk Defrag”.

install and launch

Step 2. Tick the partition you want to defragment and click on “Analyze”.


Note: The feature can only recognize NTFS partitions currently.

Step 3. After the analysis is completed, the partition will be scored. Then, hit “Defrag” to start defragmentation.


Step 4. After it’s completed, the partition will be scored again in terms of the result of the defragmentation.


Optional: Another way to improve the performance of SSD

Since you’re not suggested to improve SSD performance by defragmenting it. Here’s another workaround provided by AOMEI Partition Assistant. That’s SSD 4K alignment. By 4K aligning your SSD, the read and write time will be drastically reduced and the hard disk can perform in the best state.

4k alignment

1. Install and run AOMEI Partition Assistant Professional, right-click on the partition you want to align and hit “Partition Alignment” under “Advanced”.

2. In the popup window, set partition alignment to “4096 Sector” or set the default one. Hit “OK” to proceed.

3. Click on “Apply” where the screenshot shows to start the 4K alignment.


How to use defrag command Windows 10? The question is not hard to answer. In the post above, I explained why you should defragment your hard disk and how to get it done with both Command Prompt and third-party software AOMEI Partition Assistant Professional. Just select either of them based on your requirements.

As for AOMEI Partition Assistant Professional, it definitely provides an easier way for disk management including disk defragmentation. What’s more, it contains other features besides 4K alignment mentioned in the final part of the article such as app mover, partition splitting, and free space allocation. If you want to use this software on Server, please try the Server edition.

Michael · Staff Editor
Michael is a professinal editor of AOMEI editor team.