Easy Guide: How to Use Command Prompt to Recover Hidden Files from USB?

If you want to use command prompt to recover hidden files from USB, you can follow our step-by-step guide. This article will also share you a tool if you encounter data loss.

Posted by @Irene December 17, 2024 Updated By @Irene September 2, 2024

When a USB drive or hard drive suddenly appears empty but it isn't, it could be due to files being hidden by a virus or simply because you don't have permission to view all hidden files and folders in Windows. Another possibility is that your files were deleted due to a virus attack or other reasons.

You might wonder, "Can I use command prompt to recover hidden files from USB?" Yes. There is a command that can display hidden files: the Attrib command in the Command Prompt (CMD). If you still can't find the hidden files using this method, this article will also share another method to help you recover lost files.

How to use command prompt to recover hidden files from USB?

If you ever need to access hidden files on a USB in an urgent situation, you may wonder how to make them visible. The ATTRIB command in Windows allows users to change various characteristics or “attributes” of a file or directory. This command is an ideal solution for uncovering hidden files and can also help to recover files from external hard drive. To know  how to retrieve hidden files in USB using CMD, please follow these steps:

Step 1. Connect the USB drive that stores secret files to your computer. Make sure that your computer can detect this USB flash drive.

Step 2. Press the “Windows + X” keys, then select “Windows PowerShell (Admin)”.

Step 3. Enter attrib -h -r -s /s /d G:\*.*” and press “Enter” after the Command Prompt window pops up. You can replace “G” with the drive letter of your USB.

Step 4. This process will finish after the command prompt returns back the original location. Then you can go to the destination place to check these files.

If you encounter disk errors like the USB RAW file system, you can run command "chkdsk" to check a hard drive or other disk drives for errors and repair them if possible.

Step 1. Run Command Prompt as Administrator.

Step 2. Type "chkdsk g: /f /r  /x" and hit Enter.

(Replace "g" with the exact letter of your external hard drive.)

Now check the drive to see if the files you lost have been found. If these ATTRIB command to unhide folder and files don't work, you might want to use a reliable and professional third-party data recovery tool.

How to recover lost files from USB?

A virus attack can not only cause files to be hidden, but it may also lead to data loss. If you still cannot show hidden files with CMD ATTRIB, you may unfortunately be stuck in this situation. At this time, it is a good idea to run a reliable and professional data recovery tool AOMEI FastRecovery. You can see the following advantages of this powerful software.

Free DownloadWindows PCs and Servers
Secure Download

πŸ™†πŸΌ‍♀️ All-encompassing: It facilitates the recovery of data following deletion, system crashes, virus attacks, formatting, and the emptying of the recycle container. ⚑ Convenient: It is user-friendly, enabling all users to operate it without any issues. 🧐 Competent: AOMEI FastRecovery can recover 1000+ file types data, such as photos, videos, and documents, from various storage devices, such as HDDs, SSDs, SD cards, and USB flash drives. πŸ’ͺ🏼 Compatible: It is compatible with NTFS, FAT32, exFAT, ReFS, and Windows Server on Windows 11/10/8/7.

Step 1. Install and launch AOMEI FastRecovery. Choose the target partition or the USB where your data is lost and click Scan.

Step 2. Then, the recovery tool start to scan and search. lt will execute the “Quickly Scan" first to find your deleted data fast, and then execute the “Deep Scan" for searching other lost data.

Step 3. Once the scan is completed, all deleted files, recycle bins and other missing files will be displayed. Please select the file you would like to recover and then click "Recover".

Step 4. Then, select a folder path to save your recovered files.

Step 5. Wait patiently for this process of recovering ends.

Tip: How to show hidden files in USB with other methods

In the above part, we have learned how to show hidden files in USB using CMD and how to recover lost files caused by virus attack. Actually, you can also use File Explorer to unhide folders and files.

Method 1. Show hidden files in Layout and View Options

Step 1. Open File Explorer from the taskbar, and select the “Layout and view options” icon. It’s the second icon from the right in the top menu.

Step 2. Press “Show.” And then choose “Hidden items”.

Then, the hidden files will now become visible in File Explorer.

Method 2. View hidden files via Folder Options

You can also unhide files via Folder settings which is also the way how to hide files in Windows 11

Step 1. Launch File Explorer and press the three dots in the right-up corner, and select “Options”.

Step 2. In the Folder Options window, go to the “View” tab.

Step 3. Under “Advanced settings,” mark the checkbox next to “Show hidden files, folders, and drives.”

Step 4. Choose “Apply” and “OK” to save the change.

The folders and files will appear in File Explorer. If you wish to hide the files, repeat the steps and mark the checkbox next to “Don’t show hidden files, folders, and drives.”

Summary

To use command prompt to recover hidden files from USB, you can follow our guide. If you unfortunately find you suffer data loss, the recommended software AOMEI FastRecovery will help you retrieve files easily and effectively. Lastly, we also introduces 2 methods that help you show hidden files in USB in File Explorer.