author avatar
    Senior Program Developer
Last update by Olivia Brown at 29 September 2026

Summary
This guide details the precise syntax and execution steps for the attrib command unhide pen drive files, addressing common causes such as shortcut viruses or accidental attribute changes. It also outlines alternative data recovery solutions when file attributes are not the root cause of missing data.



Often, you might plug in a USB pen drive and notice that folders have turned into shortcuts or files seem to have disappeared. In many cases, your data is still there—just hidden by certain file attributes (Hidden, System, or Read-only). The built-in Windows attrib utility can remove those attributes and make your files visible again.

Quick answer: the attrib command to unhide pen drive files

To unhide files on your pen drive, open Command Prompt, verify the correct drive letter for your USB, and enter:

attrib -h -r -s /s /d X:\*.*

Be sure to replace X with the actual drive letter assigned to your pen drive in This PC. Never guess the letter.
Warning: Always double-check the drive letter before pressing Enter. Never run this command on C:.

What the command does:
- -h removes the Hidden attribute
- -r removes the Read-only attribute
- -s removes the System attribute
- /s applies the changes to all files in subfolders
- /d includes folders/directories
- X:\*.* targets all files and folders on the specified drive
After running the command, refresh your USB drive window. If files are still missing, check File Explorer > View > Show > Hidden items. If you still can’t see your files, there’s a chance they’ve been deleted, not just hidden.
file explorer hidden items
Common Causes of Hidden Files:
Cause Description

Shortcut Virus

Malware hides files and replaces them with .lnk shortcuts.

Accidental Hide

Files were manually set to "Hidden" or "System" attributes.

Antivirus Cleanup

Antivirus removed the virus but left the hidden attributes untouched.

When to use Renee Undeleter if attrib does not work

The attrib command only changes file attributes. If your pen drive has been formatted, files have been deleted, or the drive is corrupted, attrib won’t bring your data back. In these cases, Renee Undeleter is your next step.
Renee Undeleter is a professional data recovery tool for Windows PCs, memory card s, and external drives. Its Whole Partition Scan feature is designed to find and list all files on a drive—including those deeply hidden or missed by Windows.

Recover Lost Data from Pen Drives and Other Storage DevicesRenee Undeleter data Recovery software

Easy to use Only simple steps to recover data from storage devices.

Multiple scan modes Fast partition scan, whole partition scan and whole disk scan for different recovery needs.

File types Support to recover pictures, videos, audios, documents, mails, etc.

Supported storage devices Recover data from recycle bin, SD card, external disk, etc.

Supported systems Windows 11,10, 8.1, 8, 7, Vista, XP, 2000 and Mac OS X10.6, 10.7, 10.8+.

Easy to use Only simple steps to recover data from storage devices.

Multiple scan modes - 3 scan modes for different recovery needs.

Supported storage devices Recover data from recycle bin, SD card, external disk, etc.

Free TrialFree TrialFree Trial

3000 users have downloaded Renee Undeleter and found data back!

select whole partition scan in renee undeleter to recover deleted video from sd card
You can alos preview the files before recovering them:
preview before recovery
Advantages:
  • Multiple scan modes for different data loss scenarios
  • Supports over 400 file formats
  • Supports FAT, FAT32, exFAT, NTFS, macOS, and Linux file systems
  • User-friendly interface
  • Image Creation for byte-to-byte backups

Disadvantages:

  • Must be installed on a different drive from the one being recovered
  • Severely overwritten data may not be recoverable

If attrib doesn’t restore your files, download Renee Undeleter and run a scan:

FAQ

Is the attrib command safe to run on a pen drive?

Yes, it’s safe. The command only changes file attributes (Hidden, Read-only, System); it doesn’t affect file contents. The main risk is accidentally using the wrong drive letter, especially C:. Always confirm the pen drive letter before running the command.

What should I do if I get an 'Access denied' error?

Try running Command Prompt as an administrator:
1. Press Windows + S, type cmd.
2. Right-click Command Prompt and select Run as administrator.
3. Enter the attrib command again.
If you still get an error, check if your USB has a physical write-protection switch or try a different USB port.
Renee Undeleter - Powerful Data Recovery SoftwareRenee Undeleter data Recovery software

Easy to use Only simple steps to recover data from storage devices.

Multiple scan modes Fast partition scan, whole partition scan and whole disk scan for different recovery needs.

File types Support to recover pictures, videos, audios, documents, mails, etc.

Supported storage devices Recover data from recycle bin, SD card, external disk, etc.

Supported systems Windows 11,10, 8.1, 8, 7, Vista, XP, 2000 and Mac OS X10.6, 10.7, 10.8+.

Easy to use Only simple steps to recover data from storage devices.

Multiple scan modes - 3 scan modes for different recovery needs.

Supported storage devices Recover data from recycle bin, SD card, external disk, etc.

Free TrialFree TrialFree Trial

3000 users have downloaded Renee Undeleter and found data back!

User Comments

Page 1

Leave a Comment


Your comment has been submitted and is awaiting moderation.