This guide explains how to use Command Prompt (CMD) to recover hidden files from a USB drive, especially when they are hidden due to virus infections. It covers simple yet effective CMD commands to unhide files, helping users retrieve important data.
USB files may become hidden for several reasons. One common cause is malware or virus infection, which can alter file attributes and hide your data without deleting it. In other cases, files are accidentally marked as hidden by users or operating system processes. Additionally, improper ejection of the USB drive or file system errors can make the USB files and drive inaccessible.
When this happens, your USB may appear empty, even though it still occupies storage space. This can be frustrating and even alarming, especially if the hidden files are important personal or work-related documents. To avoid data loss and unnecessary worry, it's essential to know how to recover hidden files from USB. Fortunately, you can use Command Prompt (CMD) to reveal and access those files without the need for third-party tools.
To recover hidden files from a USB drive using CMD, you don’t need any special software or technical expertise. With just a few simple commands, you can quickly unhide and restore your important files that may have been hidden due to viruses or accidental changes. Follow the detailed steps below to safely access your hidden files and regain control of your USB drive’s data.
1. Connect Your USB Drive
Insert the USB drive into your computer. Make sure it’s recognized and assigned a drive letter (e.g., "E:" or "F:").
2. Open Command Prompt
Press "Win + R", type "cmd", and press "Enter". Alternatively, you can search for "Command Prompt" in the Start menu and choose "Run as administrator" for full access.
3. Run the Attribute Command
In the Command Prompt window, type the following command and press "Enter": attrib -h -r -s /s /d E:\*.*
Explanation of the command
"-h": removes the hidden attribute
"-r": removes the read-only attribute
"-s": removes the system file attribute
"/s": applies to all files in subdirectories
"/d": applies to directories as well
"E:" your USB drive letter
4. Check Your USB Drive
Once the command completes, open the USB drive in File Explorer. Your hidden files should now be visible and accessible.
Short answer: No, not completely.
The "attrib" command is used to change file and folder attributes, such as Hidden, Read-only, and System. It operates only on the file attribute level and can help reveal files that have been hidden by viruses or accidental changes, such as files being mistakenly marked as hidden, system files being concealed, or read-only attributes preventing file visibility.
However, if the file system itself (such as FAT32 or NTFS) is corrupted due to issues like damaged directory tables, corrupted file allocation tables, or lost file indexes, then files may become inaccessible or "lost." In these cases, you usually need to run system repair tools like Windows’ "chkdsk" tool to attempt to fix file system structures and recover files, or use professional data recovery software to restore missing data.
Apart from using Command Prompt to show and recover hidden files from USB drive, here are some extra methods you can try:
When you suspect that files on your USB drive have been set to hidden, or when the system does not display certain hidden or protected files by default, you can try adjusting the settings in File Explorer, whichallows you to directly control the visibility of hidden files and folders.
Step 1. Open "File Explorer". Click on the "View"tab.
Step 2.Click "Options"->"Change folder and search options".
Step 3. In the "Folder Options"window, switch to the "View"tab. Under "Advanced settings", select "Show hidden files, folders, and drives".
Step 4. Uncheck "Hide protected operating system files (Recommended)", and you’ll get a warning, just click "Yes"to confirm.
Then click on "OK".
Hidden files might be due to malware that sets files as hidden or system. Run a full antivirus/malware scan to remove threats and restore file visibility.
Step 1. Connect your USB drive to your Windows PC.
Step 2. Open Windows Security by typing "Windows Security" in the Start menu and selecting the app.
Step 3. In Windows Security, click "Virus & threat protection". Under the Current threats section, click "Scan options".
Step 4. Select "Custom scan", then click "Scan now".
Step 5. In the dialog that appears, choose your USB drive (e.g., E:) and click Select Folder.
Step 6. Wait for the scan to complete. If any threats are found, follow the prompts to quarantine or remove them.
After the scan and cleanup, check if the hidden files are now visible.
Sometimes, files on a USB drive may appear hidden or inaccessible because the drive or its partition is corrupted, damaged, or not properly mounted by the operating system. In such cases, checking the drive’s health and partition status using Windows Disk Management can help identify issues like unallocated space, RAW file systems, or missing partitions.
Step 1.Press "Win + X", select "Disk Management".
Step 2.Check if your USB drive shows up with a healthy partition.
If the partition is missing or shown as RAW, files may be inaccessible. In this case, you might need to use recovery software.To ensure a satisfying result, we highly recommend you using MyRecover, a FREE yet powerful data recovery tool for both Windows PC and Server.
Step 1: Download the latest version compatible with your Windows system. Run the installer and follow the on-screen instructions to complete the installation process. Make sure to install it on a different drive than the one you want to recover data from, to avoid overwriting lost files.
Step 2: Launch MyRecover. You’ll seeall connected drives and partitions will be displayed. Carefully select the drive or partition where your files were deleted or lost. Click the “Scan” button to begin.
Step 3: MyRecover will perform a "quick scan" for recently deleted files and a "deep scan" for severe data loss casesautomatically.
Step 4: After the scan completes, MyRecover shows a list of recoverable files organized by file type and path. You can use the filter feature to screen out files like images, documents, or videos quickly.
Step 5: Go through the file list and tick the boxes next to the files or folders you want to restore. You can select multiple files at once. Click the “Recover” button.
Step 6: When prompted, select a destination folder to save the recovered files. Save the recovered files to a different drive or partition than the original one to avoid overwriting lost data.
Step 7: After recovery finishes, navigate to the destination folder you chose and double-check your recovered files to make sure everything is intact.
Losing access to files on your USB drive can be unsettling, but in many cases, those files are simply hidden—not deleted. This article mainly tells how to use Command Prompt to recover hidden files from USB files. In addition, adjusting File Explorer settings, scanning for malware, and checking disk health are also effective methods to show hidden files.
And for more serious cases, professional recovery tools like "MyRecover"offer a reliable way to get your valuable data backfrom USB drive quickly and safely. To unlock more advanced features like previewing files before recovery, creating rescue bootable media and recovering data from unbootable computer, you can consider upgrading to Professional edition.