How To Remove virus from usb
How To Remove virus from usb

Today we are going to share how to remove Virus using cmd on windows 10  there are many types of virus found now  a days they can slow your PC and your work too , you can also see  windows 10 Tricks .

Read also : Top 10 Torrent Websites Of 2016

How is a virus different from any other file on Windows? A virus may be present in your PC as a file format which has the following properties:

  • A virus can be a file hidden from a user
  • A virus can be present in the form of an ‘autorun’ or ‘Autoexec’ file
  • A virus can be an exec file
  • A virus can be a file with different attribute permissions

Some of the well-known examples of the above kinds of the viruses are:

  • Autorun.inf
  • Ravmon.exe
  • New Folder.exe
  • svchost.exe
  • Heap41a

Remove Virus Using CMD from USB

 To remove a virus using cmd  from windows 10, we will use a great famous cmd command called ‘attrib‘ command.

It can be easily guessed from its name that the ‘attrib’ command represents different attributes of a file, folder or a directory. This command is mainly responsible for displaying, setting and removing the different attributes like read-only, archive, system, and hidden attributes of a file or folder.

See also50 Amazing PC Hacks Which You Don’t Know

Using that command, we will try to change the attributes assigned to a file and then recover our file.

the basic attributes of the ‘attrib’ command which we will use later:

  • R – R represents the “Read-only” attribute of a file or folder. Read-only means the file cannot be written or executed.
  • H – H stands for the “Hidden” attribute.
  • A – Similarily,  A stands for “Archiving” which prepares a file for archiving and,
  • S – S attribute changes the selected files or folders into a system file from a user file by assigning the “System” attribute to that particular file.

“attrib” Syntax:

ATTRIB [+ attribute | – attribute] [pathname] [/S [/D]]

In the above command, let’s see what the different parameters and switches are:

‘+ / –’ : To enact or to cancel the specified attribute.
‘attribute’ : As explained above
/S‘ : Searching throughout the entire path including subfolders
‘/D’ :  Include any process folder
‘pathname’ : Path where the target file or folder is located.

Read also : How To Repair Corrupted Pen Drive or SD Card [ 4 methods Explained]

Here is the proper syntax for attrib command:

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I] [drive:][path][filename] [/S [/D] [/L]]

Let’s get start the process :

we are going to transfer an ‘autorun.inf‘ virus from my USB drive to my D: drive and delete this virus from my D: drive.

  • Run command prompt as an administrator

now we will change that drive to D


Read also : How To Download YouTube Videos Without Using Any Software

Now , type attrib and press enter.  as you can clearly see the virus listed below ,

To remove Virus using CMD, type into your cmd attrib -r -a -s -h *.* and press Enter. It will remove the Read Only, Archive, System and hidden file attribute from all the files.

  • -r is for removing the read-only files
  • -a is for removing the archive file
  • -s is for removing the system file
  • -h is for removing the hidden file
  • *.* for all the files with all different types of file extensions


this command will only remove the different attributes from different files.

so to remove virus type:  del autorun.inf and enter


Now if you want to delete that file from a USB Drive, then you can change your current drive to USB drive current drive in another  step  and follow the commands.

  • You can again type ‘attrib’ command to see if the deleted file exists or not. As seen above, it does not exist anymore in the D drive.
  • To remove other viruses with extensions such as ‘.ink’, ‘.exe’, just type Del *.ink or Del *.exe respectively to delete those suspicious files.

Read also :

50 Amazing PC Hacks Which You Don’t Know

I Hope now you would be able to Remove Virus From USB using CMD On your Windows 10

By Dhruval Patel

Blogger | Entrepreneur | Social Media Strategist | | Travel Freak