How to Remove Virus from Pendrive: Using CMD (Without Losing Data)

As we all know that pen drives are really convenient if you look towards them through the point of portability.

There are only 2 major types of issues that cause the virus in a pen drive.

The first one is known as a shortcut virus and the second one is called an autorun virus. Pen drives one of the most venerable devices when we talk about viruses.

Here in this article, we are about to tell you that how you can remove any type of virus from your pen drive with the use of anti-malware software with the help of some commands which are will have to enter manually.

Also here you are going to learn how windows take some measures when it comes to protecting your PC from the virus we know as autorun.

Part 1: Shortcut virus removal

What is the shortcut virus?

This virus has 2 forms overall. What the first one does is, it tries to replace the file icons and folder of desktop with its own shortcut icon.

This is the most common type of virus that you are going to see in your pen drive.

To identify if you have to look at the lower part of the icon and you are going to see an arrow on it.

If we talk about the other virus, this is a type of virus that is going to put the files that you are looking for in a folder that is hidden and it will from a file called shortcut.exe.

When you will try to open that file that this present in your pen drive, you are making the virus to get activated and it is will further spread inside of your computer.

Using antivirus to remove shortcut virus:

If you want to remove the virus you will have to look for the malicious bug and remove it with the help of antivirus.

To achieve and know how to remove a shortcut from Pendrive you will have to:

  • Go for the Start tab and select My computer.
  • Then you will have to right-click on the options present over their names removable drive.
  • Then you have to choose Scan for the virus.

If you are in a condition that the computer that you own does not have any kind of antivirus installed in it then you can also use the windows defender option that is present on your computer.

You can activate the windows defender by going into the control panel and selecting the option of windows defender and then switching it on. But generally, when there is no antivirus running in your computer, windows defender activates automatically.

  • After the scan is completed the antivirus will tell you if your pen drives have the virus in it.
  • The antivirus will automatically remove the virus from your pen drive and if it does not then it is going to ask for your permission first.

Read Also:

6 Ways to Fix Your Windows License Will Expire Soon Error

9 Effective Methods to Fix Windows 10 Update Error Code 0x8024a105

9 Ways to Fix No Audio Output Device is Installed

Part 2: Autorun virus removal

What is the autorun virus?

Whenever you try to insert the pen drive on your computer, you are going to notice that the pen drive opens automatically.

If the pen drive that you own gets the virus then with the opening of the pen drive the autorun virus will also be activated.

The good part is nowadays in the new windows that are present the pen drive does not open automatically.

This means that the autorun virus will also not get activated until you open the pen drive yourself.

How To Remove the Autorun Virus Using CMD:

If you want to remove the autorun virus that is present in your pen drive then first you need to, first of all, remove the virus, and then you will have to restart your PC.

You need to follow these steps –

  • Click on the start tab and then search Run.
  • Then you will have to type “CMD” and then press enter.
  • Then there is going to appear a window on your screen called and Command Prompt. Here you will have to type the letters that are associated with the Pendrive that you own and you will have to press enter.
  • Then you will have to write “attrib -r -h -s autorun.inf” After this press on the enter tab.
  • Then you will have to write “del autorun.inf” After that press on the enter tab.
  • After you are done with this procedure you will have to restart your computer and you are all done.
  • When your computer restarts you will see that the virus is removed.


So these were the methods on how to remove shortcut virus from Pendrive and how to remove autorun virus from the pen drive. If you have any other method then you can mention it in the comments down below.

I hope this article was helpful to you and if you have any suggestion then you can mention it in comments down below.

Leave a Comment