4 Proven Methods to Use CMD Command to Recover Files from USB

Are you looking for a complete guide on how to use CMD to recover files from USB? This page covers everything you need to know about using CMD to retrieve files from USB.

By @Kelsey Last Updated October 17, 2024

How can I recover my files from USB via CMD command?

 

After a late night at work last night, I accidentally lost my day's work of files on my USB flash drive. I don't remember deleting them, but they disappeared. My colleagues say that lost USB files can be recovered with the CMD command. Do any of you know anything about using the CMD command to recover files from USB? Thank you very much!

Command Prompt, often abbreviated to CMD, is a command-line interpreter application available to Windows operating systems. It is used to execute entered commands to troubleshoot certain kinds of Windows issues like recovering hidden files, restoring files from accidental deletion, repairing corrupted disks, and so on.

CMD data recovery can work for local disks, USB flash drives, SD cards, or other external hard drives. If you are searching for how to recover USB using CMD, your search is over. This passage offers 3 solutions with step-by-step guides to make USB flash drive and pendrive recover data with CMD easily.

Part 1. Recover hidden files on USB using CMD

How to recover deleted files from USB without software but using CMD? First, you can try to recover hidden files from an external hard drive such as USB with the attrib command. The attrib command is used to modify the attributes of the files and folders in the selected location. There are four typical attributes of files and folders: read-only, hidden, archive, and system. The hidden attribute is to make data not displayed in a directory listing.

Thus, when your USB files are hidden due to mishandling or virus infection, they will disappear from the USB. In this case, what you need to do is use the attrib command to restore hidden files. Follow the guide below to recover files from USB using CMD attrib now.

Step 1. Connect your USB to the computer.

Step 2. Press Windows + X keys to expand the Power User menu and select Windows PowerShell (Admin).

Step 3. Input “attrib -h -r -s /s /d G:\*.*” in it and press Enter. (The G: represents the drive letter. For example, if your USB drive letter is D:, please replace G: with D:.)

Attrib command explanation

  • -h Clears the hidden attribute
  • -r Clears the read-only attribute
  • -s Clears the system attribute
  • /s Executes to display or change file attribute of data on the subfolders within the selected drive.
  • /d Applies attrib to include directories. You can only use /d with /s.

If the Attrib command is not working, either you made a typo on the command line, or the file has been deleted instead of being hidden. If it's the latter, turn to the other solutions in this article to recover pendrive data using CMD.

Part 2. Recover files from corrupted USB with CMD

There is a possibility that your data was lost due to a logical error or corrupted file system in the USB. You can run the CHKDSK command to recover corrupted hard drive.

CHKDSK (full name Microsoft Check Disk, which means disk check) is a command program for disk checking. It is commonly used to scan the integrity of the file system on the disk and to repair errors in the file system. How to recover files from USB using cmd with the CHKDSK command? Here is what to do:

Step 1. Plug in the USB to PC. Then, start Command Prompt and choose Run as administrator.

Step 2. Type “chkdsk F: /f” in the next window and click Enter (F: is the drive letter of the USB partition) to scan for drive errors and fix them.

Part 3. Restore deleted files from Recycle Bin via CMD

If your files are deleted, you can apply CMD to recover USB files from the Recycle Bin. Before executing this command, you need to check if the deleted USB files are still in Recycle Bin. If not, you cannot use this command to recover permanently deleted files.

The following is how to recover deleted files from USB using CMD:

Step 1. Search for “cmd” in the Windows search box and run Command Prompt.

Step 2. Type “start shell:RecycleBinFolder” and hit Enter. Then, the Recycle bin folder will come out and shows the deleted items. You can choose the ones you need to recover and click Restore.

CMD command alternative - An Easier Ways to Recover USB files

We have explained how to recover pendrive data using CMD in the above. But in fact, if you are not very computer savvy, we don't recommend you to use the CMD command to recover files from USB. On the one hand, it is a little difficult to perform USB data recovery through the command line; On the other hand, it may not be possible to recover all lost files using CMD.

MyRecover is a full-featured data recovery software that enables you to recover lost and deleted files in all situations with a high recovery rate. It comes with a user-friendly graphic interface that can be accessed by anyone.

Advantages of MyRecover: Easy to use: It entitles you to recover lost files in 3 steps with simple clicks. Widely compatible: It is supported to run on NTFS, FAT32, exFAT, and ReFS in Windows 11/10/8/7 and all kinds of Windows Servers. Powerful recovery features: It supports recovering files from formatted hard drives, emptied Recycle Bin, disk drives with logical corruption and sector failure, etc. Flexibility: It offers to restore more than 200 types of data, such as documents, photos, audio, emails, webpages, and so on.

Click the download button below to get this tool and recover USB files easily now.

Download SoftwareWin 11/10/8/7/Server
Secure Download

Step 1. Plug in the USB drive, run MyRecover, and hover the mouse over the USB Drive from which you want to recover files then click Scan.

Step 2. This wizard will scan all lost and deleted files on this drive. You can preview and restore files during the scanning.

Step 3. Select all the files that you wish to recover and click Recover x files. Then, choose a location for storing the files.

Final words

You can use the CMD command to recover files from USB with the complete guide on this page. But CMD USB recovery may cost you a lot of time and effort, and there is a possibility that you cannot recover data successfully with CMD. MyRecover makes data recovery from USB much easier. You can download it and give it a try.