How to Retrieve Files in USB Using CMD

I first learned how useful Command Prompt could be after losing important work files on a USB drive during a tight deadline. Like many people, my first instinct was to look for paid recovery software—but I quickly realized Windows already had powerful built-in tools that most users overlook. Through trial, error, and real data loss situations, I discovered that simple CMD commands like ATTRIB and CHKDSK can often recover hidden, deleted, or corrupted files without spending any money. In this article, I’ll share the exact methods I’ve personally used to retrieve files in USB using CMD. You’ll learn when these commands work, how to use them safely, and what problems they can fix—from accidental deletion to file system errors. Whether you’re a beginner or an experienced user, this practical guide will help you recover your data quickly and avoid unnecessary recovery costs.
Key Takeaways
- Built-in Cost-Free Recovery: Windows offers powerful native tools like Command Prompt (CMD) that can retrieve files in USB without the need for expensive third-party software.
- The ATTRIB Command for Hidden Files: Often, files aren’t deleted but hidden by malware. The
attrib -h -r -s /s /dcommand is the most effective way to restore visibility to these “missing” files. - CHKDSK for File System Errors: If a USB drive becomes inaccessible due to corruption, the
chkdsk /rcommand can repair the file system metadata and recover data stored in bad sectors. - Windows File Recovery (Winfr): For files that are permanently deleted (Shift+Delete), Microsoft’s official winfr command-line tool provides a deep-scan solution for local drives and USBs.
- WinfrGUI – The Graphical Advantage: If you find command-line syntax too complex, WinfrGUI offers a 100% free, user-friendly interface that automates the Windows File Recovery process with just a few clicks.
- Success Rate Factors: Recovery success depends on acting quickly. Stop writing new data to the USB drive immediately to prevent your deleted files from being overwritten.
What Is Command Prompt (CMD)?
Windows uses Command Prompt as its default command interpreter. Most users use a graphical user interface, however CMD offers powerful capabilities for flash drive recovery and other commands. This document covers CMD file repair methods.

Common Reasons for Missing USB Files
- Files may vanish from your USB due to accidental deletion or unintended formatting.
- Virus infections can hide or alter file attributes, making them invisible in the file explorer.
- A corrupted file system can damage directory structures, rendering files inaccessible.
- Additionally, files saved in unsupported formats may not display correctly, causing users to assume they are missing.
4 Methods to Retrieve Files in USB Using CMD
Method 1: Recycle the tank
This method is the best way to retrieve files in usb using cmd that still appear in the recycle tank. To access the recycling tank using CMD, follow the following steps:
- Open the Start menu and type “cmd” and then press Enter.

- In the Command Prompt window, enter “start shell:RecycleBinFolder” and press Enter.

- Select the file you want to recover from the recycle box. Right click on the selected file and click Restore. Another way you can drag it back to the desired flash drive or location.
⚠️ Important: This method only works if the files are still present in the Recycle Bin. If the files were deleted using Shift + Delete, removed via CMD, or the Recycle Bin has been emptied, this method will not be effective. In such cases, other CMD-based or recovery methods are required.
Method 2: ATTRIB command
The ATTRIB command is useful for recovering file access after a malware infection. Malware can change the properties of files in the flash drive, making them look like they are missing. However, the files remain, but are hidden from view. You can use CMD and the Attrib command to fix this problem:
- Open the Start menu and type “cmd” and then press Enter.

- Enter the specified character on your USB flash drive followed by a column (e.g. “E:” or “D:”) and press Enter.
- Enter the command and press Enter.
attrib -h -r -s /s /d
(replace “DRIVE_LETTER” with the specified letter on your flash drive)
- Open the file detector and navigate to your flash drive. The missing files should be visible and accessible again.
The ATTRIB command deletes the properties of the hidden and read-only system file so that you can access the file again.
Method 3: CHKDSK command
The CHKDSK command is useful to retrieve files in usb using cmd. When the data of the Flash drive is corrupted, access to the file may be difficult. To use CHKDSK for file repairs, follow these steps:
- Open the Start menu and type “cmd” and then press Enter.

- Enter the command:
chkdsk DRIVE_LETTER: /r
(replace “DRIVE_ LETTER” with the character specified on your flash drive) and press Enter.
- Soon, CHKDSK will scan and repair.
CHKDSK scans the flash drive’s file system and metadata for errors and tries to fix them. If it detects any missing files, it saves them as CHK files on the Flash drive. You can use utilities such as UnCHK, FileCHK or CHK-Mate to recover these CHK file.
Method 4: Windows File Recovery
For permanently deleted file recovery, Microsoft provides a CMD program called Windows File Recovery, which can be downloaded for free from the Microsoft Store. Here’s how to use it:
- Install Windows File Recovery from Microsoft Store
- Open the Start menu and type “cmd” and then press Enter.

- Enter the command and press Enter.
winfr DRIVE_LETTER: C: /x
(replace “DRIVE_ LETTER” with the character specified on your flash drive)
- Soon, Windows File Recovery will finish scanning your flash drive.
- Open the file survey and go to the destination folder to access the recovered files.
If you prefer a graphical interface instead of using command lines, the next section introduces WinfrGUI, a user-friendly version of Windows File Recovery that simplifies the recovery process.
A Smoother Alternative to Retrieve Files in USB Using CMD: WinfrGUI
It is important to note that Windows File Recovery is still in its early stages and may have limitations in terms of supported file formats and recovery results. For more comprehensive data recovery solutions, consider using modern programs such as WinfrGUI.
Pros and Cons Compared to CMD Methods:
- ✔️User-Friendly Interface:
WinfrGUI offers a clean, graphical interface that removes the need to remember or type out complex command-line syntax. This makes it much easier for less technical users to perform recovery tasks with just a few mouse clicks. - ✔️Reduced Learning Curve:
With visual menus, mode selections (such as Quick Scan vs. Deep/Extensive Scan), and filter options, it simplifies the setup process compared to manually composing commands in CMD. - ✔️Minimized Human Error:
The GUI helps avoid syntax mistakes (for example, missing flags or incorrect drive letters) that can occur when entering commands manually. This can lead to more reliable outcomes for casual users. - ✔️Ease of Use for One-Off Recoveries:
If you only occasionally need to recover files, the GUI lets you quickly select target partitions and filters without having to learn the command structure. - ✔️100% Free for all users:
It offers full functionality at no cost—no hidden fees, subscriptions, or trial limitations. It provides a user-friendly graphical interface for Windows File Recovery, allowing anyone to recover deleted files without paying anything. - ❌Less Flexibility for Scripting and Automation:
Command-line methods can be integrated into scripts or automated workflows, which is harder to achieve with a GUI application. - ❌Prerequisite Dependency:
Requires that the underlying Windows File Recovery tool (winfr) is properly installed and available. In some cases, the GUI may not check for or handle missing prerequisites as transparently as a seasoned user might manage via CMD.
WinfrGUI is a smooth and easy-to-use alternative to CMD for USB file recovery. It makes the process easier and eliminates the need to use complicated commands. It allows you to find your data easily.
Conclusion
In conclusion, using CMD to retrieve files from a USB drive is a practical and cost-free solution for many common data loss situations. Commands such as ATTRIB can help uncover hidden files, while CHKDSK can repair file system errors and restore access to damaged data. This approach is especially useful after accidental deletion, formatting, or minor corruption. Although it requires some familiarity with the command line, it remains a reliable alternative when dedicated recovery software is unavailable. Most importantly, maintaining regular backups is the best way to prevent future data loss and keep your important files safe.
🔗 More Tutorials: