CMD File Recovery - Recover Deleted Files Using Command Prompt

If your files are hidden or lost on your computer or USB drive due to human errors or virus infection, you can recover files using the command prompt. While if you have accidentally deleted, formatted, or lost files on Windows 10/8/7, you can use EaseUS data recovery software to get data back with simple clicks.

Table of Contents

How to recover deleted files from USB using CMD?

"Last night, when I connected my USB flash drive (Kingston 64G) to my computer to work on my unfinished Word document, but to my surprise, there was nothing found. I might mistakenly delete the Word file without any backup. Someone told me that I should try command line which may help me to recover the deleted files easily. The problem is that I know nothing about CMD! So can you tell me how to recover deleted files from USB flash drive using Command Prompt?"

Command Prompt, or also known as Command Line/CMD, is available in most Windows operating systems. It can execute entered commands to perform advanced administrative functions, and troubleshoot or resolve certain kinds of Windows issues. The CMD serves as a free Windows built-in tool for helping users recover lost files, repair bad sectors on storage devices or even convert file system from RAW to NTFS, etc. for free. And on this page, we will focus on how to recover files using command prompt

How to Recover Files from USB Flash Drive Using Command Prompt

The most popular command prompt is the attrib line. With this command, you can recover lost and hidden files from USB flash drive, hard drive, SD card, or other external hard drives due to mistaken settings, or virus attack (see how to recover files from shortcut virus).

Tip
This command prompt only allows you to recover files from USB flash drive if they are hidden instead of deleted. If your files are permanently deleted, the CMD won't be helpful, and you need to use data recovery software as CMD alternative.

1. Press Win + R keys and type: cmd, hit Enter to open Command Prompt window as an administrator.
2. Type: chkdsk E: /f and hit Enter. (Replace E with the drive letter of the device where you lost files or data)
3. Type: Y and hit Enter to continue.
4. Type: E: and hit Enter again. (Replace E with the drive letter of the device where you lost files or data)
5. Type: E:\>attrib -h -r -s /s /d *.* and hit Enter. (Replace E with the drive letter of the device where you lost files or data)

how to recover files using command prompt

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

Refresh your device after the process; then your lost files will appear on SD card, USB drive, or hard drive. If the CMD fails to recover your lost file, or if you need to recover deleted files from USB flash drive or other storage devices, move to the next part and let EaseUS Data Recover Wizard help you out. 

How to Recover Lost/Deleted Files with a CMD Alternative

EaseUS Data Recovery Wizard is the best CMD alternative to recover lost files due to accidental deletion, formatting, virus attack, file system crash, OS corruption, lost partition, or other complex circumstances. With this ultimate data recovery tool, you can recover deleted files from SD card, external hard drive, USB flash drive, pen drive, HDD, SSD, etc. 

If your lost data is much more than 2GB, you can upgrade it to EaseUS Data Recovery Pro version so to gain unlimited data recovery capacity. Download and install it on your Windows 10/8/7 and then follow the steps below to recover deleted files from USB flash drive. 

Step 1. Select a location and start scanning.

Launch EaseUS Data Recovery Wizard, hover on the partition where you lost data, then click "Scan".

select a location and click scan

Step 2. Preview and select the files.

Wait until the scanning completes. If you need to double-click the item to preview the file, then select the data you attempt to recover.

Choose files to recover

Step 3. Recover lost data.

Click "Recover", choose a location to save the recovered data, then click "OK". You should store the data in another place instead of the original one.

Recover lost data

Was This Page Helpful?

author icon

Updated by Cedric

Cedric Grantham is one of the senior editors of EaseUS who lives and works in Chengdu, China. He mainly writes articles about data recovery tutorials on PC and Mac and how-to tips for partition management. He always keeps an eye on new releases and likes various electronic products.

Read full bio

author icon

Written by Tracy King

Tracy joined in EaseUS in 2013 and has been working with EaseUS content team for over 7 years. Being enthusiastic in computing and technology, she writes tech how-to articles and share technical solutions about Windows & Mac data recovery, file/system backup and recovery, partition management and iOS/Android data recovery.

Read full bio

Product Reviews

TrustScore 4.7 | 323 reviews
  • EaseUS Data Recovery Wizard is a powerful system recovery software, designed to enable you to recover files you’ve deleted accidentally, potentially lost to malware or an entire hard drive partition.

    Read More
  • EaseUS Data Recovery Wizard is the best we have 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.

    Read More
  • EaseUS Data Recovery Wizard Pro has a reputation as one of the best data recovery software programs on the market. It comes with a selection of advanced features, including partition recovery, formatted drive restoration, and corrupted file repair.

    Read More