Remove Shortcut Virus from USB Flash Drive/Pen Drive/Hard Drive/SD Card Using CMD

Abby Haines updated on Nov 21, 2018 to File Recovery | How-to Articles


When the shortcut virus infects a device, all the files therein become inaccessible. To access your files, you can remove the shortcut virus from your USB drive, pen drive, or SD card using cmd. This method is preferred over formatting the device and losing all files. If the virus or removal process resulted in some data loss, you can get your files back with data recovery software.

The Shortcut Virus

The shortcut virus is a frustrating piece of malware that replaces all files in a storage device with shortcuts. These shortcuts have the same names as the files, but the files are inaccessible. In fact, when you click the shortcuts, the virus only embeds itself deeper into the storage device. Your USB hard drive, SD card, hard drive, or other devices become infected with the shortcut virus when they are connected to another device that already has the virus. Additionally, in the case of a computer's hard drive, it can become infected by running a .exe file that contains the virus.

Shortcut Virus Removal with Command Prompt

In order to access your files on an infected device, you should first remove the shortcut virus from the USB drive, SD card, or hard drive. Formatting is a simple method to clean out the shortcut virus, but you will lose all of the data on your device. Fortunately, there is another relatively simple method that will allow you to remove the shortcut virus completely for free—using the Windows built-in Command Prompt (cmd).  

By using cmd, you can completely remove the shortcut virus from a USB flash drive, SD card, or other removable storage devices. If your computer’s hard drive is also infected with the shortcut virus, you can use this method to get rid of the virus files, but must additionally remove shortcut virus processes from the registry to prevent the virus from reappearing. Permanently removing the shortcut virus from a computer hard drive is covered in an associated article. 

Remove Shortcut Virus from Removable Storage Devices with cmd

Be careful when using cmd. If you are not sure how to operate the command line, only enter commands from trusted sources. Improper use of cmd can result in serious damage to your system.
  • Step 1: Right-click on "Start" and select "Command Prompt (Admin)".
  • Step 2: Sign in with your administrator account and password if the system asks.
  • Step 3: Type: attrib -h - r -s  /s /d D:\*.* and hit Enter. (Replace D: with the drive letter of your infected device).
  • Step 4: Type: del autorun.inf and hit Enter.

If this didn’t work, you are likely infected by another virus. Replace autorun.inf with another virus extension such as *.ink or *.exe to delete these suspicious files. 

By now, you should have successfully removed the shortcut virus from your USB flash drive, pen drive, or SD card using cmd. This method is preferred over formatting your device because it can get rid of the virus without wiping all of your files. But using cmd in this manner can sometimes result in minor data loss, so it is recommended to check your device for any missing files. This process is made easy by using automated data recovery software to scan your device and locate deleted files. 

Supplemental: recover data after removing shortcut virus

EaseUS file recovery software scans deep into the data blocks of your storage device and locates any recoverable files that were lost due to deletion, formatting, or other errors. The scan is completely free, so you have nothing to lose by checking your drive for missing files. You’ll be able to view all recoverable files and preview the quality of the data before recovering. In fact, if you only have a small number of lost files, you can recover them for free with EaseUS Data Recovery Wizard Free.


Step 1: Launch EaseUS Data Recovery Wizard.

Select the disk partition or storage location where you lost files and click "Scan".

Run file recovery software.

Step 2: EaseUS Data Recovery Wizard will start a scanning process to find lost files.

The scanning process will automatically start to find all of the files.

Scan and find lost files.

Step 3: Preview and restore lost files.

You can filter scan results by file type, select found files and click "Recover" to get them back. You should save the files to another safe spot in your PC/storage device, not where they were lost from.

Restore virus deleted files.

100% of people found this article helful.


Frequently Asked Qusetions

1. Why cannot I recover 2GB data for free?

It is recommended to check the version installed is Free or Trial because they are different versions.

Trial has data preview function but cannot save any files, while the Free version enables to recover 2 GB files. The default free space is 500 MB and you may share the product on social media to get another 1.5 GB.

2. Why cannot the recovered files be opened?

A file is saved as 2 parts on the storage device: directory info (which is comprised by file name, time stamp and size info, etc.) and data content.

If the files with original file names and folder structures cannot be opened, one possible reason is the corrupted directory info. There is still a chance to recover the data content with the RAW Recovery method in our software.

3. Why isn't it suggested to recover the files back to the original drive?

The storage structure of the lost files would be altered or damaged by any changes on the drive. If you save the recovered files back to the same drive, the original data structures and data content would be corrupted or overwritten, which causes permanent data loss. So you should prepare another disk to save the files.

4. How can I check whether my data is recoverable or not before purchase?

The Free version helps you save 2GB files to better verify the recovery quality of our product before purchase.

5. How long does it take to scan the drive?

It strongly depends on the capacity of your hard drive and the performance of your computer. As reference,most drive recoveries can be completed in around 10 to 12 hours for a 1-TB healthy hard drive in general conditions.

About Data Recovery Wizard

It's super easy to recover 250+ types of files after deletion, disk formatting and virus infection. Click the links and compare the difference of each version.