Command Prompt for Data Recovery: Recover Files Using CMD

Jean updated on Sep 18, 2019 to Data Recovery Solution | How-to Articles


This page includes all command prompt for data recovery you greatly concerned. Command line (CMD) provides a reliable way to recover files from memory card, hard disk or USB pen drive without software on Windows PC and laptop. If you prefer an easier and more effective way of data recovery, including restoring permanently deleted files, EaseUS Data Recovery Wizard is an ideal choice.

Overview of Command Prompt for Data Recovery

Can you use the command prompt to recover all lost or deleted files from computer hard drive, external HDD, memory card, flash drive or pen drive? Many people are asking the same help for command prompt for data recovery. But is there any command line available?

Though there are a great number of data recovery tools online which are developed to recover all types of files from various storage media on Windows 10, 8.1, 8, 7, Vista and XP, a personalized and free method is still highly required for getting lost files back.

Command Prompt, being as one of the most powerful and applicable Windows built-in utility that enables users to take full control of their computer, could do you a favor in terms of retrieving files after accidental deletion, formatting or virus infection.

All Data Recovery Command Lines Available to Use (Free)

In the following, you're going to learn all data recovery command lines that are available to use in some specific situations, including recover files from virus infected hard drive, recover files from corrupted drive with bad sectors and recover inaccessible files from RAW drive.

Command prompt's ability in recovering deleted files is restricted to a large extent, which means that you may not be able to fully restore every lost file by using CMD. 
If you fail to restore lost files using CMD command line, EaseUS data recovery software can be your best data recovery shot.

Method 1. Recover files using attrib command

Applicable to: Deleted, lost, hidden and even virus infected files recovery

Supported devices: Windows hard drive, external HDD, USB, SD card, etc. storage devices

Note: Be careful when you are following the command lines. A tiny wrong type can cause serious result. 

Step 1: Plug in your hard drive, memory card or USB drive to your computer.

Step 2: Go to the start menu, type in "cmd" in a search bar, hit Enter.

Then you can see something named "cmd. exe" under a list of programs.

type cmd and open command prompt in Windows

Step 3: Right click "cmd. exe" and then you will get the command windows that allows you to recover virus infected files.

Type in "attrib -h -r -s /s /d drive letter:\*.*", for example, "attrib -h -r -s /s /d G:\*.*".

(Replace G with the drive letter of your hard drive or external storage device where you lost files.)

recover virus infected files with attrib command

Attrib Command Alternative 

Manual input of the command line is suitable for computer professionals since wrong commands can cause more severe problems. Therefore, for security and usability, we strongly recommend you try an automatic command line alternative. EaseUS Tools M is a practical tool that enables you to check and fix files system error, enable/disable write protection and system update with one-click instead of typing intricate command lines.

Follow the simple steps below to show hidden files with this 1-click-fix software. 

Step 1.  DOWNLOAD EaseUS Tools M for Free.

Step 2. Start EaseUS Tools M, choose "File Showing" on the left pane. Next, choose the target drive for scanning.

show hidden files - step 2

Step 3. After the operation completes, click the View button to check the hidden files. 

show hidden files - step 3

Method 2. Recover deleted files from Recycle Bin using command prompt

Applicable to: Deleted file recovery, recycle bin file recovery

Supported devices: Windows hard drive, Desktop 

If you deleted files to the Recycle Bin, you can either choose to right-click files in the Recycle Bin or follow the command lines to restore them to the original location before emptying it:

Step 1: Go to the start menu, type: cmd in a search bar and hit Enter.

Click "cmd. exe" under a list of programs to open command prompt.

Step 2: Type: start shell:RecycleBinFolder and press Enter. 

Step 3: Select the files to restore.

Method 3. Recover files from RAW drive using chkdsk and rescan command

Applicable to: RAW file system or corrupted file system recovery

Supported devices: RAW drive, inaccessible external HDD/USB/SD

If you lost files on external storage devices, connect to your computer in advance and open the command prompt in Windows. Log in with your administrator account and password if necessary.

Step 1: On the command window, type in "chkdsk drive letter: /r/f" (e.g. chkdsk d: /r/f) and hit Enter. (Replace with the drive letter of your storage device where you lost files.)

recover files using chkdsk command

Step 2: On the command prompt window, type diskpart and then hit on Enter.

Step 3: Type rescan and then hit enter.

recover files using diskpart command

Step 4: Exit DiskPart, type chkdsk /f d: in CMD and hit Enter. (Replace with the drive letter of your storage device where you lost data.)

Wait for the process complete, you can check the device to see if your lost files have been restored.

If you didn't see the lost files or you need storing files from more complex situations such as to recover permanently deleted files or folder in Windows 10/8/7, professional data recovery software with advanced features as introduces here can help you.

Download CMD Alternative - Data Recovery Software for Help (3 Steps)

Besides deleted or hidden data recovery using command lines, actually, there are many more data recovery needs, for example: to recover photos from the formatted hard drive, unformat hard drive, restore data from dead computer hard drive, etc.

Since command prompt is incapable of solving these data loss situations, you need an alternative file recovery software to CMD. Here, EaseUS Data Recovery Wizard can fully replace the function of command prompt in data recovery. In addition, it provides more advanced data recovery solutions such as partition recovery, deleted file recovery, formatted hard drive recovery, etc.

To recover files when command prompt for data recovery cannot help, do as follows:

Step 1. Select a location to scan.

Launch EaseUS Data Recovery Wizard, hover on the partition, external hard drive, USB, or memory card from which you want to perform data recovery, and then click "Scan".

select a location and click scan

Step 2. Select the files you want to recover.

Wait until the scanning completes. Afterward, select the lost files you want to recover. If you need, double-click the file to preview its content.

Choose files to recover

Step 3. Recover lost data.

After choosing the files, click "Recover" and choose a location on another drive to save the recovered files.

Recover lost data

100% of people found this article helpful.


Frequently Asked Questions

1. Why choose EaseUS Data Recovery Wizard?

"EaseUS Data Recovery Wizard is the best we've seen. It's far from perfect, partly because today's advanced disk technology makes data-recovery more difficult than it was with the simpler technology of the past, but it's fast and efficient..."PCMag

"The first thing you'll notice about EaseUS Data Recovery Wizard Pro is that its interface is very clear and uncluttered, with only a small collection of self-explanatory controls. You won't find lots of extra options hidden in a system of hidden menus, either; what you see really is what you get."techradar

"Recover lost files, even after deleting a partition or formatting your drive."Macworld

2. Why cannot I recover 2GB data for free?

It is recommended to check the version installed is Free or Trial because they are different versions.

Trial has data preview function but cannot save any files, while the Free version enables to recover 2 GB files. The default free space is 500 MB and you may share the product on social media to get another 1.5 GB.

3. Why cannot the recovered files be opened?

A file is saved as 2 parts on the storage device: directory info (which is comprised by file name, time stamp and size info, etc.) and data content.

If the files with original file names and folder structures cannot be opened, one possible reason is the corrupted directory info. There is still a chance to recover the data content with the RAW Recovery method in our software.

4. Why isn't it suggested to recover the files back to the original drive?

The storage structure of the lost files would be altered or damaged by any changes on the drive. If you save the recovered files back to the same drive, the original data structures and data content would be corrupted or overwritten, which causes permanent data loss. So you should prepare another disk to save the files.

5. How can I check whether my data is recoverable or not before purchase?

The Free version helps you save 2GB files to better verify the recovery quality of our product before purchase.

6. How long does it take to scan the drive?

It strongly depends on the capacity of your hard drive and the performance of your computer. As reference,most drive recoveries can be completed in around 10 to 12 hours for a 1-TB healthy hard drive in general conditions.

About Data Recovery Wizard

It's super easy to recover 250+ types of files after deletion, disk formatting and virus infection. Click the links and compare the difference of each version.