How to Recover Deleted Files Using Command Prompt

Accidentally deleted files or lost data from USB flash drive, hard drive, SD card on Windows 10/8/7? If so, do not worry. This article will show you how to recover deleted files from USB using CMD (Command Prompt) or using EaseUS data recovery software to recover deleted files with a few clicks.

 Download for Win Recovery Rate 99.7%
 Download for Mac Trustpilot Rating 4.8

Page Table of Contents

Updated By

Jaden

Written By

Tracy King

Updated on

24 September 2024

Min Reading

9 Min

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 EaseUS Data Recovery Wizard 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: G: and hit Enter again. (Replace E with the drive letter of the device where you lost files or data)
5. Type: attrib -h -r -s  G:\*.* /s /d and hit Enter. (Replace G with the drive letter of the device where you lost files or data)

Manual execution of the command line is suitable for computer professionals, since incorrect commands can do more harm than good. Therefore, for security and usability, we strongly recommend you try an automatic command line alternative - EaseUS CleanGenius. It is a practical tool that enables you to check and fix file system errors, enable/disable write protection and update your system 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 CleanGenius for Free.

Step 2. Start EaseUS CleanGenius, choose "Optimization" on the left panel. Next, click "File Showing" on the right panel. 

show hidden files - step 2

Step 3. Select the hard drive and click "Execute".

file fixing - step 2

Step 4. After the operation completes, click the here link to check the hidden files. 

show hidden files - step 3

Refresh your device after the process; then your lost files will appear on an 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 a 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 drives, USB flash drives, pen drives, 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. 

 Download for Win Recovery Rate 99.7%
 Download for Mac Trustpilot Rating 4.8

Step 1. Select a location and start scanning

Launch EaseUS Data Recovery Wizard, hover on the partition/drive where the deleted files were stored. Click "Search for Lost Data" to find lost files.

select a location where you deleted files

Step 2. Select the files you want to recover

When the scanning has finished, select the deleted files you want to recover. You can click on the filter to display only the file types you want. If you remember the file name, you can also search in the search box, which is the fastest way to find the target file.

Choose recoverable files

Step 3. Preview and recover deleted files

Preview the recoverable files. Then, select files you want to restore and click "Recover" to store the files at a new storage locations instead of the disk where the data was previously lost. You can choose a cloud storage, such as OneDrive, Google Drive, etc., and click "Save" to save your recovered files.

Recover deleted files

  • Updated by

    Jaden is one of the editors of EaseUS, who focuses on topics concerning PCs and Mac data recovery. Jaden is committed to enhancing professional IT knowledge and writing abilities. She is always keen on new and intelligent products.…
  • Written by

    Tracy became a member of the EaseUS content team in 2013. Being a technical writer for over 10 years, she is enthusiastic about sharing tips to assist readers in resolving complex issues in disk management, file transfer, PC & Mac performance optimization, etc., like an expert.…
Why Trust EaseUSEditor Reviews

20+

Years of experience

160+

Countries and regions

72 Million+

Downloads

4.8 +

Trustpilot Score

Data Recovery Service

Search