EaseUS Data Recovery Wizard 11582 Reviews

Command Prompt for USB Recovery: Recover Files Using CMD

This page includes all command prompt for USB recovery you greatly concerned. You can learn how to recover files from USB using CMD attrib. You can use command prompt to recover files from USB flash drive, pen drive, hard disk, external hard drive,etc..

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

Table of Contents

Overview of Command Prompt for USB Data Recovery

Command Prompt, being as one of the handy Windows built-in utilities that enable users to take full control of your computer, could do you a favor in retrieving files after hiding, accidental deletion, corrupting, or virus infection. You can recover deleted or corrupted files from a computer hard disk, USB flash drive, pen drive, memory card, or other external hard drives using CMD.

Compared with professional data recovery software, the command prompt for data recovery has the following advantages and disadvantages.


  • Free to use
  • Pre-installed on Windows, no need to download any more


  • Required to enter the command line manually, not suitable for computer beginners
  • Not as powerful as a professional file recovery tool, you may not be able to restore every lost file by using CMD fully
  • Can't recover files in complex data loss scenarios, like recover permanently deleted files from USB

Read this post and learn how to recover files from USB using CMD attrib to retrieve hidden files, or use other command lines to recover data from a pen drive or hard disk. What's more, you can use EaseUS Data Recovery Wizard to recover files from USB when the CMD fails.

How to Recover Files Using CMD

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 the 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. 
Be careful when you are using the command lines. A tiny wrong type can cause serious results.

1. Recover Files from USB Using CMD Attrib

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

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

Attrib command only enables you to recover hidden files. If your files disappeared somehow, you could use the attrib command to check whether the file is hidden by unintentional operation or virus infection. For other data loss cases, such as formatting, partition turning RAW, or files being deleting, the attrib command won't work.

Step 1. Plugin 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 allow you to recover virus-infected files.

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

(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

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.

Note: The command line can only recover files that are still in the recycle bin, not files that are not in the recycle bin or on the hard drive. If you want to recover files from emptied Recycle Bin, here are the tutorials. 

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 the command prompt.

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

Step 3. Select the files to restore.

recover files using chkdsk command

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 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, and you can check the device to see if your lost files have been restored. If you didn't restore lost files using the above command prompt, or you need to get back files from more complex situations, such as recover data from lost partition in Windows 10/8/7, EaseUS Data Recovery Wizard with advanced features introduced below can help you figure out. 

How to Recover Files from USB Using the Best CMD Alternative

Since the command prompt is incapable of retrieving files under many circumstances, like restore data from dead computer hard drive, unformat hard drive, emptied recycle bin recovery, and so son, you need a CMD alternative for USB file recovery.

EaseUS Data Recovery Wizard can fully replace command prompt and allows you to:

  • Recover deleted, formatted, and inaccessible data in different data loss situations.
  • Restore photos, audio, music, and emails from any storage safely and completely.
  • Retrieve data from the recycle bin, hard drive, USB drive, memory card, flash drive, digital camera, and camcorder.
  • Repair corrupted Excel, Word, PowerPoint, photos, and videos effectively.

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

To recover files from USB or pen drive without CMD, do as follows.

Step 1. Select a drive and start scanning

Launch EaseUS Data Recovery Wizard and hover over the partition where you lost data. This could be an internal hard disk, external disk, USB, or SD card. Then, click "Scan".

select a location to scan

Step 2. Check and preview scanned files

Use the file format filter on the left or upper right corner to narrow the scan results until you find the files you need. Then, you can click the "Preview" button or double-click a file to preview its content, if you'd like. 

Choose files to recover

Step 3. Recover lost data to a secure location

Click the checkbox next to the file and click "Recover" to restore the lost data to a secure place. We recommend that you do not store the recovered data on the disk where you lost it earlier.

Recover lost data

Final Verdict

This post covers all the command lines to recover hidden files, restore data from the recycle bin, and retrieve files from RAW partition. Follow the examples and be careful. Wrong command lines can make your data loss worse.

EaseUS Data Recovery Wizard is an easy-to-use file recovery tool that allows you to recover deleted or lost files with a few clicks. If you are a computer beginner and don't know how to use command prompt to recover files from USB, we highly recommend you try this simple data recovery software.  

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

Recover Files from USB Using CMD Attrib FAQ

The following are the highly relevant questions about how to recover files using CMD. Check the brief explanations if you also have any of these problems.

What is attrib command in CMD?

The attrib command allows an MS-DOS and Windows command line user to change the attributes of a file or folder. For example, you could recover hidden files using the attrib command. The attrib command is available in the Command Prompt in all Windows operating systems including Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, and other older versions of Windows.

How can I recover files from a corrupted USB?

Is your USB corrupted? How to recover and open files on a corrupted USB drive? Use EaseUS data recovery program to recover files from corrupted, damaged or formatted HDD, SDD, USB flash drive, external hard drive, Pen drive, SD card, CF card, etc..

Step 1. Connect the corrupted USB flash drive to your computer and launch EaseUS USB data recovery software on your PC.

Step 2. Select your USB drive, which marks as a removable disk, and click "Scan" to start finding your files.

Step 3. Preview and recover all the files from corrupted USB.

How do you attrib a flash drive using command prompt?

Follow these steps to recover files from USB flash drive using CMD attrib:

Step 1. Right-click Windows icon and type cmd in the search bar.

Step 2. Select to run Command Prompt as Administrator. Sign in with your administrator account if necessary.

Step 3. Type: attrib -h -r -s G:\*.* /s /d (Replace G with the drive letter where you'd like to show hidden files) and hit Enter.

How do you use CMD to recover lost or deleted files?

You can use the attrib command to recover hidden files from a storage drive like hard drives, flash drives, USB. etc. You can follow these commands in the command prompt and easily retrieve deleted files from Windows 10, 8, 7:

Step 1. Press Windows + R key together in a search box, type CMD.

Step 2. In Command Prompt window, type chkdsk drive letter /f and press Enter. ( e.g.: chkdsk D : /f)

Step 3. Press Y 'Yes' until the command lines start again Again. Enter the drive letter and click Enter.

Step 3. Type drive letter and press Enter.

Step 4. Type /f --> attrib -h -r -s G:\*.* /s /d. This command will recover all hidden files in a storage device.

  • -r stands for Read-only attribute that means files are readable and they cannot be changed
  • -s assigns 'System' attribute of the selected multiple files
  • -h command means 'Hidden' attribute to only selected files
  • /S indicates to search the particular path including subfolders
  • /D command involves the process folders 

Was This Page Helpful?

Updated by Cedric

Cedric Grantham is a senior editor and data recovery specialist of EaseUS. He mainly writes articles and how-to tips about data recovery on PC and Mac. He has handled 10,000+ data recovery cases and is good at data recovery of NTFS, FAT (FAT32 and ExFAT) file systems, and RAID structure reorganization.

Read full bio

Written by Jean

Jean is recognized as one of the most professional writers in EaseUS. She has kept improving her writing skills over the past 10 years and helped millions of her readers solve their tech problems on PC, Mac, and iOS devices.

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