How to Remove Shortcut Virus from Pen Drive & Recover Hidden Files (Windows 10/11)

How to Remove Shortcut Virus from Pen Drive & Recover Hidden Files (Windows 10/11)

You plug in your pen drive and every folder has turned into a shortcut, or the drive looks empty even though the space is still used. That’s the classic shortcut virus (also called the recycler virus). Good news: in most cases your files are not deleted, just hidden. Here’s how to bring them back and clean the drive on Windows 10 and 11.

Quick fix: Open Command Prompt, type attrib -h -r -s /s /d E:\*.* (replace E with your pen drive letter) and press Enter. Your hidden files reappear. Then delete the .lnk shortcuts and any unknown .exe / .vbs files, and scan with Windows Security.

What is the shortcut virus?

It’s a family of worms that hides your real files (sets them to hidden + system), creates shortcuts with the same names and copies itself to every drive you connect. Clicking a shortcut runs the virus and opens the folder, so you may not notice at first. It spreads mostly through shared pen drives at print shops, colleges and offices.

USB pen drive infected with shortcut virus
Shortcut viruses spread through shared pen drives and SD cards · Photo: Unsplash

Step 1: Unhide your files with CMD (attrib)

  1. Plug in the pen drive and note its drive letter in File Explorer (e.g. E:).
  2. Press Win + R, type cmd, and press Enter.
  3. Type attrib -h -r -s /s /d E:\*.* and press Enter. Replace E with your letter.
  4. Wait until the cursor returns (big drives take a minute). Open the drive; your real folders are back.
Part of the commandMeaning
-hRemoves the Hidden attribute
-rRemoves Read-only
-sRemoves the System attribute
/s /dApplies to all files and folders inside
Running the attrib command in Windows Command Prompt
One attrib command brings hidden files back · Photo: Unsplash

Step 2: Delete the virus files

  • Delete every .lnk shortcut file on the pen drive.
  • Delete unknown files like autorun.inf, random-named .exe, .vbs or .js files, and an unexpected RECYCLER folder.
  • Tip: in File Explorer → View → Show → turn on File name extensions and Hidden items to see them.

Step 3: Scan the pen drive and your PC

  1. Right-click the drive → Scan with Microsoft Defender (Windows 11: Show more options).
  2. Run a Full scan in Windows Security → Virus & threat protection → Scan options.
  3. If the virus keeps returning, it’s running on the PC itself: check Task Manager → Startup apps and remove unknown entries, then run the Microsoft Safety Scanner (free).
Scanning a USB drive for malware
Always scan the drive and your PC after cleaning · Photo: Unsplash

Step 4: Recover files that were really deleted

If attrib didn’t bring everything back, some files may have been deleted. Stop copying anything to the drive, then try:

  • Windows File Recovery (free from Microsoft Store): e.g. winfr E: C:\Recovered /regular.
  • Recuva (free): choose the pen drive, run a deep scan, and restore to a different drive.
  • PhotoRec (free, open source): for photos and documents on badly damaged cards.
Recovering deleted files from a storage drive
Recovery tools can restore files that were actually deleted · Photo: Unsplash

How to stop the shortcut virus coming back

  • Keep Windows Security / Defender on and updated.
  • Don’t open shortcuts on pen drives from other computers; open the drive from File Explorer instead.
  • Scan every shared pen drive before opening files.
  • Back up important files to the cloud (see Google Drive tips).
  • Format the drive (FAT32/exFAT) after copying your files out, for a completely clean start.

Related guides

Frequently asked questions

How do I remove the shortcut virus from my pen drive without losing data?

Run attrib -h -r -s /s /d X:\*.* in Command Prompt (X = drive letter) to unhide files, then delete the shortcuts and unknown .exe/.vbs files and scan the drive.

Why did my pen drive files turn into shortcuts?

A shortcut virus hid your real files and created shortcuts in their place. The files are usually still there.

Does formatting remove the shortcut virus?

Yes, formatting cleans the drive, but copy your files out first using the attrib method.

The virus comes back every time. Why?

Your PC is infected. Run a full Defender scan, remove unknown startup apps and use the Microsoft Safety Scanner.

Can I recover deleted files from a pen drive?

Often yes, with Windows File Recovery, Recuva or PhotoRec, if you stop writing new data to the drive.