How to Use CMD Command to Recover Files from USB [Full Tutorial]

When you want to recover files but don’t want to download extra software, CMD will be your best assistant. In this guide, you'll learn step-by-step how to use CMD command to recover files from USB drive, along with another tool to ensure a higher recovery success rate.

By @Aria
Last Updated July 31, 2025

Overview of Command Prompt for USB Data Recovery

Windows Command Prompt, often called CMD, is a built-in command-line tool in Windows. You can perform tasks like file management, system configuration, and program execution by entering specific commands. It requires no extra software installation and is suitable for both basic and advanced system-related tasks. It can be a powerful tool in the hands of those who know how to use it, even for data recovery from USB drive.

While CMD is a highly effective tool, it isn’t a one-size-fits-all solution when it comes to data recovery. However, you can use system utilities like CHKDSK, ATTRIB, access Recycle Bin and Windows File Recovery in certain specific situations to recover data effectively. The next section will explain in detail which situations each command tool is suitable for.

How to Use CMD Command to Recover Files from USB

This section will present 4 command-line tools for data recovery from USB flash drive in different scenarios, covering cases such as accidental deletion, permanent deletion of files, or inaccessibility caused by logical errors. Perfect for users who prefer a straightforward, tool-free method to get back their important files from USB. Let's explorer more details.

Recycle Bin Command

💡Applicable to: accidentally deleted (not using "Shift + Delete") files from desktop, folders

Supported Devices: USB drive with NTFS file system, Windows hard drive

If you just accidentally deleted files from your desktop or a USB with NTFS file system, they are likely to be sent to the Recycle Bin until they are restored or the Recycle Bin is emptied. You can simply open the Recycle Bin using CMD command and manually restore the deleted files. Follow these steps to recover deleted files with CMD:

Step 1. Type "Command Prompt" in the Start menu and open it.

Step 2. Enter the command "start shell:RecycleBinFolder" and press "Enter".

Step 3. Browse through in the Recycle Bin folder and select the files you wish to recover.

Step 4. Right click on it and choose "Restore" to return it to its original location.

Notes:✎...
Deleted files from USB drives with FAT32 or exFAT file systems won’t go to the Windows Recycle Bin. If you want to recover them, please move to other methods below.

Run CHKDSK Command

💡Applicable to: USB files inaccessible due to logical errors such as file system issues

Supported Devices: RAW drive, inaccessible external HDD/USB/SD card, corrupted drive

CHKDSK (Check Disk) is a built-in Windows command that scan disk logic error on USB drive or other internal/external hard drive and attempts to repair any issues that may be hiding your files. It can help fix file system errors, bad sectors and regain file access from inaccessible hard drive.

Step 1. Open "Command Prompt" and run it as administrator.

Step 2. Enter the command "chkdsk G: /f /r" and press "Enter" to recover data from USB. Replace the drive letter "G" with your USB drive letter.

Step 3. Wait for the scan to complete, then check your USB drive to see if the files have reappeared.

★Tips:
/f: fix detected logical error on the USB drive.
/r: scan and recover accessible data on the bad sectors.
Don’t forget the most important step before performing the operation: connect the USB to the computer with a suitable adapter.

Use ATTRIB Command

💡Applicable to: missing or hidden files due to virus infection or file system errors

Supported Devices: all storage devices

The ATTRIB command in Command Prompt allows users to view, set, or clear file and directory attributes. It's used to manage characteristics like read-only, archive, system, and hidden status of files and folders. It is particularly useful for recovering hidden files from USB caused by malware, system errors, or accidental changes.

Step 1. Open "Command Prompt" and run it as administrator.

Step 2. Type the command "attrib -h -r -s /s /d E:\*.*" and press "Enter". Replace the drive letter "E" with your USB drive letter.

Step 3. When the process is completed, check the USB for restored or visible files.

Run Windows File Recovery Command

💡Applicable to: accidentally or permanently deleted files recovery

Supported Devices: formatted drive, all storage devices

As mentioned earlier, the three methods above can only recover data with CMD commands under specific circumstances. The data loss scenarios they can cover are extremely limited. They will not work when files are permanently deleted or when you need to recover data from a formatted drive.

Windows File Recovery, a professional command-line data recovery tool provided by Microsoft, will come in handy. Designed specifically for data loss on Windows, it can cover most data loss scenarios on the Windows system. It can scan the local storage device like USB drive, SD card, HDDs and recover files from these devices.

Step 1. Download and install Windows File Recovery on your computer from the Microsoft official channel.

Step 2. Open "Windows File Recovery" and run it as administrator.

Step 3. Type the command "Winfr F: E: /regular" and press "Enter". Replace the drive letters "F" (the source drive letter) and "E" (the destination drive letter) with your actual drive letters. You can also switch to "extensive" mode for a more comprehensive scan to recover more files.

Windows File Recovery also supports recovering specific files, folders, or file types. You just need to add a filter command after the basic Windows File Recovery command. For example: If you want to recover files in the "Videos" folder within the "Documents" directory, you can enter the following command "Winfr F: E: /regular /n documets\video\".

When the process is completed, you can press "y" to check the recovered files in the destination folder.

MyRecover: The Best CMD Alternative for USB Data Recovery

In fact, for most non-professionals and computer beginners, command lines are hard to master in a short time. If you prefer GUI-based data recovery tools, MyRecover is tailor-made for you. To meet the needs of most users, MyRecover simplifies the data recovery process, allowing users to complete data recovery just by clicking icons.

Why Choose MyRecover?

✔️No Command Line Needed – Simple GUI (graphical interface) for easy file recovery.

✔️500+ Devices Support – Recover files from all types of devices like SSD, HDD, USB flash drive, SD card, cameras and more.

✔️Handle 500+ Data Loss ScenariosRecover from deleted partition, formatted hard drive, emptied Recycle Bin, system crash (only available for paid version), virus attack, etc.

✔️Supports over 1,000 File Types – Including documents, photos, videos, audio, archives, and Outlook data files.

✔️OS Compatibility – Work not only on Windows 11 /10, but also on Windows 8.1/ 8/ 7 and all Servers.

4 Steps to Recover Lost Files from USB Drive

Step 1. Download and install MyRecover on your computer from secure channel. Connect the USB drive with lost files to the computer.

Step 2. Launch it and select the USB drive to scan for lost files, then click "Scan".

Step 3. Choose files you want to recover from the recoverable lists and click "Recover".

Step 4. Select a safe location to save the recovered files.

Once the process is finished, the message indicating successful recovery will pop out. You can access and check the recovered files by clicking "Browse" or the destination folder.

Conclusion

Running a CMD command to recover deleted files from USB drive is definitely possible. But obviously, they come with limitations and require some technical experience. If you’re not comfortable using command-line tools or want a faster, more visual experience, MyRecover is the best alternative for USB data recovery.

Upgrade to the Professional edition of MyRecover to enjoy unlimited recovery capacity with no restrictions on how much you can retrieve, and the invaluable ability to preview files before restoring them.