How to Remove Virus from Pen Drives

Pen drives have emerged as a great companion of computers in past few years. Also known as flash drives, these are one of the best methods of data storage and their compactness enhances mobility.

Windows computers are comparatively more at risk of getting viruses and malware.

The most common and easy to spread threat is ‘shortcut virus’.  When a pen drive gets infected with ‘shortcut virus’, all the files and folders convert into ‘shortcut’ files. These viruses spread from one machine to another through pen drives, memory cards or through internet/Bluetooth connections and get viral. Here we’ve listed three different steps to remove virus from pen drives:

1. Through command prompt (CMD):

If you aren’t inclined to download any software to remove viruses, then you can simply remove them from your machine by employing command prompt (CMD). Just follow these steps, they are so handy that it won’t matter if you’re a non-tech-savvy person:

  • Press the Windows Key + the letter ‘R’.
  • Type ‘cmd’.
  • Type the targeted drive name followed by a colon from where you want to remove the virus (e.g. g:) and hit ‘Enter’. cmd-to-remove-virus-from-pen-drive
  • Type: attrib g:*.* /d /s -h -r -s
  • Hit Enter.

2. Though shortcut virus removing software:

If you’re not into commanding and want to do it without any hassle, you always have an option to do it with a virus removing software. Shortcut virus removing software will automatically detect and remove the threat and would recover the original files. Such software is tested and verified, which make them more reliable. You can follow the below steps to remove shortcut viruses from your pen drive:


  • Download the shortcut virus removal software of your choice.
  • Generally, these tools are click-to-run and don’t require any installation.
  • Once downloaded, open the application and select the target drive to eliminate the viruses.
  • It will automatically detect and remove the shortcut viruses from your flash drive.

3. Through BAT file:

Let’s become techy and do it as a pro. If you’ve not heard about batch files (BAT) then don’t panic. You can eliminate viruses by creating a batch file and executing it. You don’t need any extra and specific tools to create a batch file but a notepad and PC. If you don’t want to face the black screen (CMD) and don’t want to download any software, then this method is a boon for you. You just need to follow these steps to conquer your drive again:

Image Source:

  • Open ‘Notepad’ on your computer.
  • Copy and paste the below code as it appear in the notepad

@echo off

attrib -h -s -r -a /s /d Drive:*.*

attrib -h -s -r -a /s /d Drive:*.*

attrib -h -s -r -a /s /d Drive:*.*

@echo complete

  • Replace ‘Drive’ with your targeted drive name. e.g. G:
  • Click on Save As under the File tab in Notepad and change the save as type to “All files(*.*)” from the drop down list and rename it to removeshortcutvirus.bat and save it on your desktop.
  • Close the Notepad and open the BAT file by double clicking on it.
  • The shortcut viruses would have been removed and the original files would be restored.
  • The viruses will have been removed completely in seconds. If you want, you can do a quick format.

You can always refrain yourself from being in a situation like this by following some precautions. You should never plug your device into any infected machine. Always keep your system geared up with latest anti-virus and apply complete system check at least once in a week. You may certainly remove viruses by following any of these steps but a minor attention may help you avoid this situation.

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe Now & Never Miss The Latest Tech Updates!

Enter your e-mail address and click the Subscribe button to receive great content and coupon codes for amazing discounts.

Don't Miss Out. Complete the subscription Now.