How To Remove Viruses From Pen drive Using Windows 10 Command Prompt

How To Remove Viruses From Pen drive Using Windows 10 Command Prompt
Pen drive is a handy gadget for transferring between computers. As a result, it gets attached to many computers which increase the chances of computer virus infection as computer viruses can replicate and spread by itself.
Now somehow your Pen drive gets infected by computer viruses, it will change the attribute of all existing files or folders. Therefore, you will be in real trouble in such a situation as you won’t be able to access your important files or folders.
You can use any Antivirus application for Windows 10 like Avast, Norton, etc. to remove those viruses from your Pendrive. However, you can also remove those viruses manually(Without using Antivirus application).In this article, I will show you how to remove viruses from Pendrive manually or you can say that how to remove viruses from Pendrive using Command Prompt on Windows 10.

How To Remove Computer Viruses From Pen drive Using Widows 10 Command Prompt:

Before further proceeding let me tell you one thing i.e. using Antivirus is highly recommended method for removing viruses from Pen drive. This tutorial is only for knowledge purpose. So let’s start.

To remove viruses from Pen drive using Windows 10 command prompt, we have to perform two tasks:

  • Virus detection using Command Prompt
  • Remove Virus using Command Prompt

Detect Viruses Using Command Prompt:

In most of the times viruses present in Pen drive in the form of an executable file format like Ravmon.exeNew Folder.exesvchost.exeAutorun.inf, Heap41a, etc. These viruses are in either invisible or visible but always remain undeletable. This is because of its hidden and read-only attributes. Therefore, we have to change the attribute in order to detect and remove them. For this.
  • Connect the Pen drive with PC.
  • Run Command Prompt as an administrator
  • Type Pen drive location for selecting the particular drive. In my case, the location of the Pendrive is ‘F’ so I am going to select ‘F’ drive by typing F: and then press Enter.

How To Remove Viruses From Pen drive Using Windows 10 Command Prompt - Detect virus

Remove Viruses Using Command Prompt:

Now you have the list of viruses present in Pen drive. However, you cant able to find or delete those viruses due to their Hidden and Read-only attributes. Therefore, you need to remove these attributes first to delete them. For this type, the command given below.

attrib -h -r -s -a *.* and press Enter.


  • h represents the hidden attribute
  • r represents the read-only attribute
  • s represents system file attribute
  • a represents archive attribute
  • *.* represent all the files with all different types of file extensions.
  • ‘-‘ represent removing an attribute

Now, you will be able to find and delete those viruses by opening the Pen drive. You can delete these viruses either by pressing “Delete” key or by using commands. To delete those viruses using command prompt, type del [file location filename] on the command prompt and press enter. For example, del C:svchost.exe and press Enter.

That’s it.

You May Like

Leave a Reply

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