How to Recover External Hard Disk Using CMD in Windows 10, 11

How to recover external hard disks using CMD in Windows 10 and 11? Command prompt could help you to troubleshoot external hard disk issues and restore data from external hard drives.


By Lora / Updated on April 3, 2024

Share this: instagram reddit

What is CMD?

Most Windows operating systems include a command line interpreter application called Command Prompt. The command prompt is officially known as Windows Command Processor, but it's also known as the command shell, cmd prompt, or even by its filename, cmd.exe. It is used to carry out kinds of commands.

The majority of those commands use scripts and batch files to automate tasks, perform advanced administrative functions, and troubleshoot or resolve specific Windows issues.

It has been an essential part of the Windows operating system since its inception and can assist you in resolving many Windows errors by executing various commands. Even if your external hard drive has become corrupt, you can repair it with CMD. So is it possible to recover files from an external hard drive using CMD?

Is it possible to recover files from an external hard disk using CMD?

How do I recover files from a formatted external hard disk? I was using the CMD method for the formatting and it takes quite a long about half a day. I'm afraid it was 'zero-filling' my hard disk.”

As known above, CMD is a useful and free tool to fix Windows issues, like hard drive recovery, external hard disk recovery, corrupted hard disk recovery, etc. How to recover an external hard disk using CMD?

You could use the command prompt to fix external hard disks. Besides, if the files in external hard disks are hidden due to some reason, you could use command prompts to recover files from external hard drives. To recover files from an external hard disk, you need to use the right commands. 

How to recover data from external hard drive for free?

If you deleted files accidentally from external hard disks, how to recover external hard disk using CMD?  Microsoft released a free command prompt utility from Microsoft Store. It’s called Windows File Recovery. With the command-line window, users only can input command lines to recover deleted or lost files from local storage devices. Windows File Recovery allows you to recover files from external hard disk using CMD.

Unfortunately, Windows File Recovery currently is only available for Windows 10 2004 and above. There are four different modes to use: Regular, Extensive, Segment, and Signature. You could choose the mode according to the file system of the hard disk and the scenarios of data loss. Here is the command format of Windows File Recovery.

winfr source-drive: destination-drive: [/mode] [/switches]

Step 1. Get Windows File Recovery from Microsoft Store. Type “Windows File Recovery” in the search bar and select “Run as administrator”.

*View solutions to fix “WinFR requires admin privileges to run”.

Step 2. Right-click the external hard disk and select “Properties” to check the file system.

File system


Recommended mode


Deleted recently



Deleted a while ago



After formatting a disk



A corrupted disk


FAT and exFAT



Step 3. Here are some common switches to use. See the description and supported mode of each parameter or switch. Some examples will be listed to make you understand the command format clearly.

*View solutions to fix “Winfr.exe is not recognized as an internal or external command”.


1. If you want to recover an entire folder from E: drive to D: drive, you could input the command like the following:

winfr E: D: /n \Users\Stephanie\Documents\Test\

2. If you want to recover files with the string of “Test”, you could input:

winfr E: D: /r /n *Test*

Parameter / switch  


Supported mode(s)


Scans for a specific file by using a file name, file path, file type, or wildcards. For example: 

  • File name: /n myfile.docx
  • File path: /n /users//Documents/
  • Wildcard: /n myfile.*
  • /n *.docx
  • /n **


Recover specific extension groups, comma separated



Saves a log file of the recovery operation in a different location than the default location on the recovery drive (for example, D:\logfile).



Segment mode, recovery option for NTFS drives using file record segments



Signature mode, recovery option for all file system types using file headers


The easiest way to recover data from external hard disk 

When you delete some files from an external hard drive, the first thing you need to do is to check the Recycle Bin. But the problem is when most people realize they need to recover data, the files have been deleted permanently from the Recycle Bin. Or some users press the Shift + Delete keys to delete files. Need to mention that the data deleted from external hard disk will not be in Recycle Bin. Therefore, in these situations, to recover data from an external hard disk for free, you need a reliable data recovery tool.

MyRecover is that one! It's an excellent external hard drive recovery software because it can restore hundreds of file types within a few clicks, even for those computer beginners. MyRecover has a high recovery rate and fast scanning speed.


▶ Recover deleted files from SD cards, USB flash drives, HDDs, SSDs, external hard drives, and other storage media.
▶ Support for permanently deleted files recovery, formatted file recovery, and other data recovery methods.
▶ Recover lost Word, Excel, PowerPoint photos, videos, audios, emails, and hundreds of other file types.
▶ Compatible with Windows 7/8/10/11 and Windows Server.

Download SoftwareWin 11/10/8/7/Server
10,000 people have downloaded it

Step 1. Download and launch MyRecover on your computer. Hover the mouse over the drive saved deleted files before, and click Scan.


Step 2. The software runs the scanning process from quick scan to deep scan and finds deleted files and other missing files in the external hard disk.


Step 3. During scanning, you could recover any file you want. Select the file or the folder that you want to recover and click "Recover files".


Recover hidden files from external hard disks using CMD

When your computer is infected with viruses and your antivirus software fails to identify them, you may find the files on your external hard disks are lost. When you insert an external hard disk, all of the data on the device is hidden, and there are shortcuts to those files.  How to recover external hard disk using CMD in this case?

The files are not deleted. They just are hidden by some type of virus. If you format the drive, all of the data will be erased. Follow the steps below to recover hidden files and folders from external hard disks without losing the data.

Step 1. Run CMD as administrator.

Step 2. Input the drive letter of the external hard disk. For example G:, and press Enter.

Step 3. Then, type attrib -s -h -r /s /d *.* and press Enter. And then you will have access to all of the hidden files and folders in the external hard disk.


Bonus tips: how to repair external hard disks using CMD?

To repair external hard disks by command lines, you need to run CHKDSK, which means Check Disk. It’s an official Windows tool designed to check the integrity of a hard drive and fix the hard disk when it’s damaged or corrupted. CHKDSK is run in the CMD app and can be used to repair both internal and external hard disks, which can solve the problem of "how to recover external hard disk using CMD".

Follow the steps below to learn how to use CHKDSK in Command Prompt to repair a damaged external hard disk in Windows 10.

Step 1. Press the “win + Q” keys on your keyboard to open the search box. Type “cmd”. Select “Run as administrator”.


Step 2. Input the following command to check if there are logical errors on your external hard drive.

chkdsk G: (replace H with the drive letter of your external hard drive)

Step 3. If there are some logical errors or bad sectors on your external hard drive, input the commands in turn and press Enter.

chkdsk G: /f (“/f" is a CHKDSK parameter that will check and try to fix logical errors on the hard disk)

chkdsk G: /f /x /r ("/r" will search for bad sectors and restore any usable data. "/x" will unmount the hard disk before scanning to ensure that the procedure is not interrupted by any external factor.)


Step 4. Wait for the command to execute completely.

To sum up

How to recover external hard disk using CMD? Command Prompt offers numerous advantages to help users recover hidden files from an external hard drive. Besides, it’s useful to use CMD to repair external hard disks when the ere are logical errors or bad sectors.

Windows File Recovery, as a command-line app, makes external hard disk data recovery possible, but it's highly recommended to use MyRecover to restore data from external hard disks with a higher success rate. 

Unfortunately, the best data recovery tool couldn’t recover all lost or deleted data on hard disks. Making a regular backup is always the most effective way to avoid data loss. You could try freeware-AOMEI Backupper to create system backup, partition backup, file backup, etc to keep your data safe.

Lora · Editor
Lora is an editor of AOMEI Technology. She is also a tester and editor of AOMEI Data Recovery Tools. -- "Keep testing, write the most useful tutorials for helping people recover the lost data for Windows and phones" is the most meaningful thing for her. Dedicated to creating helpful tutorials, she hopes her tutorial can assist users to effortlessly solve data loss problems on their personal computers and mobile phones.