How to Delete Viruses Using the Command Prompt

Computer viruses can spread from computer to computer through the Internet, USB drives or other removable disk drives. Although viruses can be removed through the Windows Task Manager, oftentimes the virus programmer will encode the virus to create an error pop-up message when the user attempts to open Task Manager. In cases such as this, it is advantageous to use the computer’s Command Prompt.

...
Viruses can spread easily among computers.

Step

Go to the “Start” button and select “Run.” Enter “cmd” and hit “OK” to open the Command Prompt.

Step

Enter the drive that needs to be checked. For example, if the virus is in the C drive, enter “C:” into the Command Prompt.

Step

Type “attrib” into the Command Prompt and hit “Enter.” This opens the drive’s directory and shows all of the files within the drive. This can also be accessed by entering “dir/w/o/a/p.”

Step

Look for a file labeled “autorun.inf” or an .exe file that does not exist in the drive when it is opened in Windows. If the drive entered does not contain a file like this, the virus is not affecting the drive. Repeat Steps 2 and 3 until the foreign file is located, then proceed to Step 5.

Step

Enter “attrib -r -s -a .” in the Command Prompt and hit the “Enter” key. This command opens hidden, read-only and system files.

Step

Delete the file by typing in “del” followed by the name of the foreign file. For example, enter “del autorun.inf.”