Command Line to Recover Lost Files on Windows

Last updated on 15/03/2017

This article shares how to recover lost files from different media on Windows PC including Windows 10, 8.1/8, 7, Vista and XP using command prompt.

Table of Contents

Can You Recover Lost Data with Command Prompt?

Is it possible for you to recover lost files from a hard drive, external HDD, USB flash drive or memory card with help of command prompt?

More than one person has asked the same question. See following case:

"My external hard drive stopped working after dropping on floor. I am wondering if I can run command prompt to recover lost data from the corrupted external HDD."

This user ran into one of the most common data loss situations. As you know, files probably got lost from various digital devices due to more other reasons like deleting, formatting. Then, can you restore all lost files using CMD in every data loss problem?

Well, every lost file in any case is recoverable, but CMD has no ability to recover any data. Although you cannot use command prompt directly for file recovery, it is able to help you get rid of data loss problem sometimes. We will introduce this point later.

Data Recovery Software for Files Recovery without CMD

Here, we would like to share an alternative, namely a data recovery tool, for lost files recovery when command prompt fails. Whether you believe it or not, a data recovery utility always provides the best solution for data recovery in all situations. Here, it is recommended to use iCare Data Recovery Pro. It is a user-friendly data recovery program, which can work on all Windows OS for deleted files recovery, format recovery, RAW drive recovery and resolve almost all data loss issues from any media like memory card, flash drive, pen stick, USB hard drive, etc.

Follow this guide for files recovery with software:

download data recovery software

Step1. Free download, install and run iCare Recovery Pro. Select "Deep Scan Recovery" module.

select recovery
Step2. Select the device where data got lost and then wait the software to scan.

select drive
Step3. Preview and save the files you want to recover.

recover files

download data recovery software

How to Recover Deleted Files from Hard Drive/USB Disk/Memory

How do you restore deleted or erased files from an internal hard disk, USB hard drive, flash drive or memory card using CMD? Please stop thinking about it because it has no such a function. Instead of recovering files, CMD is able to help delete files effectively.

Files Deleted Using CMD

You can run CMD to delete files from a hard disk or USB disk following the tutorial below:

Step1. Click "Start" > "Run > type "cmd" to launch command prompt.

Step2. Type the command

E.g. If you want to delete a fine named 111.txt located in D drive 456 folder, you can type "del/f/s/q d:\456\111.txt" and press Enter button. This option delete the 111.txt file but not erase the 456 folder. If you want to delete the file with the folder containing it, you can type "rd/s/q d:\456" and press Enter button.

Files deleted using CMD won’t go to recycle bin, but be deleted immediately. Therefore, you cannot recover deleted files from recycle bin, but need to rely on data recovery software.

Data Recovery after Format Command Line

If you want to recover files after format, you cannot run command line to complete it because this command is not helpful with format recovery. A format recovery tool is needed for files restoring after formatting or reformatting.

You are not allowed to run CMD to recover formatted hard drive or other removable media, but you can run this command to format a disk including internal HDD and USB disk.

Recommend: This page guides you to format different media using CMD: Diskpart to format>>

Restore Data from Virus Infected Media by CMD

Virus infection may hide some or even all files stored on a storage media. In this situation, you can show hidden files and get back all of them by CMD. If it is a memory card or flash drive, you need to connect it to your Windows computer.

Then, follow this guide to show files hidden or missing due to virus: Run CMD > Type "attrib -s -h -r c:/*.* /s /d" (c: is the drive letter). This command will show all hidden files in C drive.

If the command line fails to find all hidden or missing files from a virus infected memory card, flash drive or hard disk, please try iCare Data Recovery Pro to find more lost files.

Convert RAW to NTFS / FAT32 without Losing Data Command Line

Running command line, users can fix some errors under different Windows operating system sometimes. Disk drive raw or says not formatted is a common problem that you can run CMD to fix.

When any storage device changes to RAW file system, you can run command line to convert RAW to NTFS or FAT32. Can you convert RAW drive to FAT32 / NTFS without losing files using command line? Yes! You can use the iCare Recovery Pro to perform file retrieval from the RAW drive firstly in case of data loss after file system conversion.
To change RAW to NTFS/FAT32 with CMD, you have to choices:

1. Format the RAW drive using CMD
2. Convert RAW to NTFS / FAT32 using CMD without formatting

Recommend: Here is the tutorial to use command line for RAW to NTFS or FAT32 conversion: Change RAW to NTFS FAT32 with CMD>>

CMD Fix Bad Sectors without Losing Files

When a hard disk or USB hard drive has bad sectors, you can run CHKDSK from command prompt to scan and repair bad sectors on it. After running CMD, you can type the command "chkdsk drive letter: /r/f" (e.g. chkdsk d: /r/f)

This command is able to fix bad sectors on the selected drive without touching any file. For the security of data, it is recommended to make a backup before using this command.

Command Line for Windows XP/Vista/7/8/10

CMD is a command that can be launched on any Windows operating system. The methods to access command line are various on different Windows. Here are some common methods:

1. Click "Start" button > "Run" > type "cmd.exe" and press Enter button

2. For different Windows

  • Go to "Start" button > "Programs" > "Accessories" > "Command Prompt" (Windows XP)
  • Go to "Start" menu > type "command prompt" to show this command and then click it (Windows 7, 8, 8.1 and 10)

3. Click "My Computer" and open C: > Windows > system32 > cmd.exe to create a command prompt shortcut


Hot Articles

Related Articles

Data Recovery Tool > Fix Problems > Howto > Command Line to Recover Lost Files on Windows