How to Recover Hidden Files in USB using CMD [Full Guide]

How to recover hidden files in USB using CMD? Here is a stepwise guide. Also, we will show you alternative ways to unhide files hidden by viruses and find lost USB data.


By Kelsey / Updated on April 2, 2024

Share this: instagram reddit

How do I recover hidden files on my USB?


I stored quite a lot of experimental data and files on my USB. Today, I plugged this USB into a computer in the university computer lab, but all the files were gone. I think I had a virus that was making all my files inaccessible. My colleagues say files can be unhidden through Command Prompt. How can I recover hidden files in USB using CMD? Please help!

USB, one of the most commonly used portable storage devices, is a plug-and-play interface between the PC and the peripherals. But viruses are pervasive, and USB is vulnerable to virus attacks when plugged into a computer. How to make a USB show hidden files and find lost files on USB is what we will explore on this page.

Usb Drive

Why do files get hidden in USB?

Before learning how to unhide files using CMD, let’s have a look at causes that would result in USB data hidden.

▪ Files are hidden by system. For the files that come with the USB file system, the system will hide these files to protect the files from being damaged or deleted by the user.

▪ Files are hidden due to virus attacks. It is possible that some or all of the file attributes have been modified to be hidden due to a virus or other malicious program when the USB is plugged into the computer.

▪ Human error. You may accidentally hide your USB files or the USB data is deleted or formatted due to an operation error.

▪ USB hardware failure. The USB port is damaged, or the USB drive memory chip is damaged, etc. causing the files not to be recognized.

Part 1. Use attrib command to recover hidden files in USB using CMD

As we all know, common attributes of files are read-only, archive, hidden, and system. The attrib command can be used to display and modify the attributes of files and directories. For example, when a file stored in a USB disappears due to a virus infection, you can use this command to change its attributes to show the hidden directory. The attrib command is available in the Command Prompt of all Windows operating systems.

The common syntax and parameters of the attrib command: attrib -h -r -s /s /d diver-letter: \*.*.

Attrib command parameter meanings:

  • -h Clears the Hidden file attribute.
  • -r Clears the Read-only file attribute.
  • -s Clears the System file attribute.
  • /s Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories.
  • /d Applies attrib and any command-line options to directories.

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

Step 1. connect your USB to a Windows computer, and make it recognized by the PC. If it cannot be recognized by the computer, you check and recover data from USB flash drive not recognized on the related page.

Step 2. Bring up the Power User Menu by pressing the WIN key and the X key together. Then, click on Windows Powershell (Admin) and click Yes on the pop-up User Account Control screen.

Windows Powershell Admin

Step 3. Input the attrib command. You can replace the “drive letter” with your USB drive letter, such as attrib -h -r -s /s /d G:\*.*. Then, press Enter.

Attrib Cmd

Step 4. After the command is finished, you can open the USB to see if all hidden files are visible now.

Part 2. Additional ways to show hidden files in USB

Since showing hidden files in USB using CMD with no clickable icon, you may find that little errors can cause unhiding files to fail. In fact, apart from using the Command Prompt, there are easier solutions that can help you display hidden files on USB.

Way 1. From File Explorer

You can directly unhide folders hidden by viruses from Windows File Explorer.

Step 1. Plug in your USB to computer and open the This PC or My Computer app on Windows.

Step 2. Click View on the top and check the Hidden items option to view hidden files.

Hidden Items

Way 2. Through Control Panel

Another method to recover hidden files in USB is via Control Panel. Here is a complete guide:

Step 1. Right-click the Start button, then select Control Panel.

Step 2. Head to Appearance and Personalization and choose File Explorer Options.

Step 3. Tap View, tick the checkbox next to Show hidden files, folders, and drives. Optionally, you can uncheck the Hide protected operating system files option as well.

Show Hidden Files

We have shown you how to retrieve hidden files in USB using CMD and other possible methods. If all of them fail to help recover USB hidden data, your USB files may have been maliciously deleted by a virus. In this case, you can either recover USB lost data from a backup or use data recovery software for USB file recovery.

Part 3. Easiest way to recover lost files from USB

MyRecover is a professional data recovery tool with powerful data recovery features. It allows you to easily and completely recover lost files from USB due to virus attacks, accidental deletion, or formatting.

In addition to USB data recovery, this tool can recover documents, photos, videos, emails, and other kinds of files from internal and external hard drives, HDD, and SSD. It is a piece of cake to perform SD card data recovery with this software as well. Besides, it can assist you in partition loss data recovery and system crash data recovery. 

Specific USB data recovery steps are as follows:

Step 1. Connect the USB drive you need to recover data to your computer, then download and run MyRecover software.

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

Step 2. Hover the mouse over the drive saved deleted files before, and click Scan to scan.

Select Partition To Scan

Step 3. This wizard will start a deep and quick scan of the USB drive. And it will list the found data in time.

Scan Lost Data

Step 4. View and select required files. And then, click Recover x files.

Recover Lost Data


The above are complete guides to recovering hidden files in USB using CMD, File Explorer, and Control Panel. I hope they can help you retrieve the lost files in time.

Finally, I remind you that although USB data recovery is very easy, you can not ignore the importance of data backup. To make USB backup simpler, it is recommended to use an easy-to-use and free backup tool like AOMEI Backupper to create copies of your important data with ease.

Kelsey · Editor
Kelsey is an English editor of AOMEI Technology. She is passionate about helping people find effective ways to deal with all problems in computer. She has great insights into data backup and recovery, disk partition and clone, and other data protection measures. She likes learn computer skills to improve herself and enjoy quality time with family and friends.