How to find and remove computer virus using command prompt

How to find and remove any computer virus in Windows using CMD Command

Viruses, malware, trojans, worms! These evil things can penetrate your computer through numerous ways like internet browsing, from USB devices, phishing link in your email and also by installing infected software.

Most of these viruses make your computer slow and eat up valuable memory as well as storage space. Some more powerful viruses are meant to contaminate our operating system too and steal personal information and banking data.

The conventional method to identify and remove such unwanted program from your computer is to install an anti-virus software and scan your computer for any viruses/trojans/worms that exist and quarantine them.

However, there are some computer users out there who use unconventional methods to find such virus. Today we are discussing such an unconventional method by using Command Prompt or DOS Prompts to identify and remove such virus. 

Also Read- A-Z Windows CMD Commands List

The method is simple and straight which even a layman computer user can proceed with, just follow the steps given below :

How To Remove Computer Viruses Using CMD

The Command Prompt or CMD/DIS Prompt is a command line utility program on Windows 10. Though the command prompt is rarely used by layman PC/laptop users, it is a powerful utility in the hands of pro hackers.

CMD has access to reconstruct all Windows system files by using various attributes like removing the hidden attributes which a virus normally uses.

One of the leading causes of virus infections in computers and the CMD method work on USB to remove its viruses and secure your computer.

Steps To Remove Computer Viruses Using Command Prompt:

Step 1. Click on Start and type cmd. Now right click on the cmd icon and select run as administrator. Running the command as administrator is important as you need to access the system files which are not usually visible in guest accounts. Now command prompt window will open, now select your drive from which you want to remove a virus.

How to find and remove computer virus using command prompt

Step 2. Let us suppose your USB has a virus and your USB drive is F. Type “F:” without quotation on Command line.

How to find and remove computer virus using command prompt

Step 3. Now the C: will change to F: Now you need to type “dir F:” in CMD and hit enter. It will show you the directory of F drive.

How to find and remove computer virus using command prompt

Step 4.  So now type the following command to show all the hidden and system files on your USB drive. Type “dir F: attrib -s -h /s /d *.*”  without quotations and press enter. Typing this command will explore your selected drive and will load all the files including hidden and system files on your drive.

How to find and remove computer virus using command prompt

Step 5. In this window, you will notice unusual file.exe  and extension if your computer has been infected with a virus like the dreaded autorun.inf virus. Rename it using this command line rename filename.extension new filename. Usage > C://rename autorun.inf (new filename)

How to find and remove computer virus using command prompt

That’s it!  Now you can identify all the viruses in your PC and USB and delete them without any help of anti-virus software. You can delete the autorun.inf by typing in the command “del autorun.inf” or del :”yourfilename”

20 COMMENTS

  1. my Windows xp computer screen doesn’t show anything and i have even tried to change the screen but it even doesn’t work could the problem be the operating system or what please help me am very worried

  2. As I am seeing that you are posting lot of hacking stuff on this site so can you please help me out. I jus want to know how to port forward on mobile tethering as I need for this to some metasploit over WAN in kali Linux

  3. on the fifth step i am being confused. i had typed rename autorun.inf(file name)
    cmd shows “the system cannot find the file specified”.
    what should i do now?

  4. The above won’t work – you first need to check your tasks/processes to verify the virus/malware is not running, and kill the running EXE prior to deleting it, otherwise it will simply re-infect the device again a second or so later, and all the work you’ve just done was for nothing…

    Easiest would be to follow the above steps, but before you delete anything, hit [Ctrl] + [Shift] + [Esc] to open “Task Manager”, sort it alphabetically, locate and kill the desired EXE.
    Wait about 10sec to see if it starts up again – if this is the case, just use a free online virus scanner (or downloadable demo/trial solution) from a reputable provider to clean your entire system…that’s the easiest 🙂

    Anyway, after killing the EXE, and it didn’t start up by itself again, you can safely delete the virus/malware application files. But, having done all of this – you still need to scan your machine with a proper cleaner to remove the ones you cannot locate via CMD Prompt.

LEAVE A REPLY

Please enter your comment!
Please enter your name here