How to Find Duplicate Files in Windows 10 Using CMD or an Easier Way

Rosa Reyes
March 13, 2023 Preview 2.0K Preview 1
share it facebook share it Twitter

If there are a lot of duplicate files on your Windows PC, you may want to get rid of them. Unnecessary duplicate files waste space and can make file management harder. Windows doesn’t have a feature to directly find and remove them. But Windows’ CMD can help users with this task. This article mainly talks about how to find duplicate files in Windows 10 using CMD successfully.

 

How to find duplicate files in Windows 10 using CMD successfully

Windows’ Command Prompt (also known as CMD) is a command shell, an app that allows users to directly communicate with the operating system. With it, users can use commands to perform various tasks, such as finding duplicate files by hash.

PowerShell, which is the advanced version of CMD, replaces CMD in Windows 10 and later, but CMD is still available.

If you have done some searching, you may find that the “dir /s /b *.extension” command (for example, “dir /s /b *.jpg”) is said to be able to find a certain type of duplicate files (for example, duplicate JPG files). However, according to my tests, this command only lists all files of a certain extension on your PC or in a certain directory. It doesn’t identify duplicate files.

The steps below will show you how to successfully find duplicate files in Windows 10 and Windows 11 using CMD.

1. On your Windows computer, type PowerShell in the search box on the taskbar.

2. Open PowerShell.

3. Set the current location to the folder in which you want to delete duplicate files by typing the following command. Replace C:\Users\Administrator\Pictures with the folder of your choice.

set-location –path C:\Users\Administrator\Pictures

The PowerShell window showing that the Set-Location command is typed

4. Press the Enter key.

5. To compute the hash value for the files in the chosen folder with the SHA-256 hashing algorithm, use the following commands. Replace C:\Users\Administrator\Pictures with the chosen folder.

ls "C:\Users\Administrator\Pictures" -recurse | get-filehash | group -property hash | where { $_.count -gt 1 } | % { $_.group } | Out-File -FilePath "C:\Users\Administrator\Desktop\Duplicates.txt"

The PowerShell window showing that commands are typed

6. Press the Enter key. The time it takes depends on the number of files. When the process is done, open the Duplicates.txt file.

7. The text file displays the hash value and path of every file of the chosen folder. If two or more files have the same hash value, then they can be a group of duplicates.

The text file showing hash values of files that help Windows users find duplicate files by hash

The Out-File cmdlet (typed in step 5) creates the Duplicates.txt file in the specified path. If you see the “cannot be read” error after pressing Enter in step 6, then try changing the path to a different location, somewhere other than the folder where you search for duplicate files.

How to delete duplicate files in Windows 10 using CMD

After you get the text file that displays the duplicate files found by CMD, you can manually delete duplicate files. For each group of duplicate files, use a file’s path to locate it in File Explore, and delete the file if you don’t need it anymore. Keep one file in each group and delete the rest.

If you want, you can use commands to automatically remove duplicate files by entering the following commands. Replace C:\Users\Administrator\Pictures with your chosen folder.

ls "C:\Users\Administrator\Pictures" -recurse | get-filehash | group -property hash | where { $_.count -gt 1 } | % { $_.group | select -skip 1 } | del

Note: Using these commands doesn’t allow you to decide which files to delete and will remove duplicate files by deleting them permanently, which can be a bit risky.

How to get rid of duplicate files in the easiest way

Compared to using CMD, there is an easier method, which provides the following benefits.

  • Automatically find duplicate files
  • Automatically select duplicates for you to mass remove
  • Also let you decide which files to remove
  • Easy to use for everyone
  • Reliable and safe to use

The best way to get rid of duplicate files in Windows is to use duplicate file finder and remover software Cisdem Duplicate Finder. It’s easy to use, powerful and reliable.

Cisdem Duplicate Finder main features:

  • Find duplicate photos, videos, audios and all other types of duplicate files
  • Detect duplicate files by content, capable of finding duplicate files with different names
  • Also find similar photos
  • Scan PC and external storage devices for duplicate files
  • Scan one or multiple folders/drives for duplicate files at a time
  • Let you exclude folders and files from scan
  • Display the found duplicate files for you to preview and view
  • Automatically select duplicate files for mass removal
  • Allow you to decide which files to delete by offering customizable selection rules (such as Select Newest)
  • Offer Move to Recycle Bin as the default deletion option (so that files can be recovered)
  • Let you control what to find, where to find and how to delete
  • Available for Windows 10 and Windows 11

1. Download and install Cisdem Duplicate Finder on your Windows PC. Open it.

Free Download

2. To scan one or multiple folders for duplicate files, drag it or them into the software. Or, you can add locations by clicking the plus icon.

The software window showing that two folders are added to scan for duplicate files

3. Click Scan.

4. Once the scan is done, the All tab will display all the duplicate files that have been found. Sort, preview and view them as you like.

The All tab showing all the duplicate files that have been found in the added folders

5. The software already automatically selects duplicate files for mass deletion. If you want, you can adjust the selection by choosing a selection rule or by hand.

6. Click Delete in the bottom left corner to clean up the selected unwanted duplicate files on your Windows PC.

Clicking the Delete button deletes duplicate files

Tip: In step 2, if you want, you can do some customization by going to Settings the Settings icon. For example, you can set the software to ignore certain folders and files when it scans for duplicate files.

The Settings window showing General settings and Duplicate files settings

Conclusion

Cleaning duplicate files can free up storage space and help you manage files more easily. This article shows you how to find and delete duplicate files in Windows 10 using CMD. To get the job done easily, reliably and efficiently, it’s recommended to use dedicated software. Get rid of useless duplicates and enjoy a better PC experience.

avatar
Rosa Reyes
share it facebook share it Twitter

Rosa has worked in Mac software industry for more than eight years. She believes that the purpose of software is to make life better and work more productively. In addition to writing, Rosa is also an avid runner.

share it facebook share it Twitter
Comments (1) Leave a Reply

Name *

Comment *

  • Bernd Sucher

    Thank you for writing this useful article. it really found a lot of duplicate files on my pc. now my computer speeds up. thanks!

    0 months ago Reply

    Name *

    Comment *

Hot Articles

How to Find and Bulk Remove Duplicates in Google Photos 2023 VisiPics Review, Tutorial and the Best Alternative 2023 How to Find and Delete OneDrive Duplicate Files All at Once
Home > How to Find Duplicate Files in Windows 10 Using CMD or an Easier Way