Virus, one of the most dangerous term in computer world. Viruses can be described with various names like Trojan, Malware and many more. However, you must have to be aware about these stubborn viruses and the suitable processes to remove them off your system. You must be wondering how these viruses spread? The answer is simple, USB Flash Drives. Yes, Pendrive and other USB drives spread such viruses from one system to the another and this is the reason why you need to remove these viruses from your USB Flash Drive so that it can not be spread to other PCs. Get to know how you can remove Virus from USB Drive using Command Prompt on your PC. Following tutorial will help you out.

Remove USB Drive Virus


To remove virus from USB Drive using Command prompt, you have to follow three simple processes. If you found something unnecessary on your system, which means your USB Drive is affected and you have to clean it off.

Step 1 :

Connect your USB Flash Drive to your PC by inserting it into the USB Port.

Step 2 :

Now, open command prompt by visiting Start> Cmd

Step 3 :


Type the following command to your Command Prompt by using your PC’s Keyboard and then hit the Enter button.

drive leter :

Step 4 :

Type dir and hit the Enter button, you would get the list of all files of your USB Flash Drive.

Step 5 :

Keep it like this and open a new Command Prompt by doing the same process.

Step 6 :

Type dir /w /a  and press Enter button.

Step 7 :

You would see all the files of your USB Drive here including the hidden files. Now, compare both the files with proper virus names like autorun.exe and same like this which are not there in your USB Drive. Normally, Viruses can not be shown, they are always hidden.

Step 8 :

Now, to remove the unwanted Virus files from your USB Flash Drive, you have to type the USB Drive with [ex f:] and hit the Enter button after that.

Step 9 :

Type attrib -r -a -s -h *.* and hit the Enter button.

Step 10 :

This Command will remove all the unwanted attributes from your USB Drive such as system files, hidden files, read only, archive and the other ones.

Step 11 :

Now, to delete the file you have to type in the following command to your Command Prompt.

del filename 

Step 12 :

One by one, you can remove all the unwanted and suspicious files from the device by following the same process mentioned above.

That’s how you can remove virus from USB Drive using Command Prompt. If you have any queries or questions regarding this process, you can drop us them into the below given comment section below the post. Stay tuned for more useful updates in the coming time.

Remove Virus from USB Drive using Command Prompt (CMD Attrib)
Rate this post

Be Sociable, Share!