Command Prompt for Data Recovery: Recover Files Using CMD

Jean updated on May 08, 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 free 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 free 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

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 - Free 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 free 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:

1. Download and install EaseUS Data Recovery Wizard on your computer.

2. Use the data recovery tool to search for and recover your lost data.

  • Choose a storage location or a specific folder where your data was lost and then click the Scan button.
select a location and click scan
  • When the scan is complete, locate the recoverable files or folders from the list of scan results.
scan lost data
  • Select files and then click the Recover button. When choosing a location to save the recovered data, you should not use the original drive.
select wanted data and click recover

Note: You can use EaseUS Data Recovery Wizard Free Edition to recover up to 2GB files for 100% free by sharing a social media post on Facebook, Twitter.


100% of people found this article helful.


Frequently Asked Qusetions

1. 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.

2. 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.

3. 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.

4. 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.

5. 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.