How To Remove Virus Using CMD? Complete Guide

cmd viruses

This article will explain removing viruses using CMD (Command Prompt) in straightforward language. It will include step-by-step instructions on using CMD to remove viruses from your computer and information on locating virus-related files and registry entries and doing a complete system scan.

To Remove the Virus Using CMD

  • In the search bar, type CMD, right-click “Command Prompt,” and choose “Run as an administrator.”
  • Type F: and press “Enter.”
  • Enter attribs -h -r /s /d *.
  • Type dir and press “Enter.”
  • A virus name may contain “autorun” and  “inf” as extensions.

You can learn more about how viruses harm your computer by reading this article from beginning to end. You’ll also learn how to use CMD to remove shortcut viruses and some general advice for maintaining your computer’s security in the future. This article will discuss how to remove viruses using CMD. Recover your Windows password now by tapping the link.

Describe CMD

Let’s first define CMD before learning how to remove viruses using CMD. Windows operating systems make use of the CMD command-line interface.

cmd screenBy inputting instructions, users may communicate with the operating system. CMD can manage files and directories, diagnose problems, and remove viruses, among other things. 

Getting To CMD

The following methods can let you access CMD:

  1. Click the Start button at the lower-left corner of your screen and fill the search bar with “CMD.”search cmd
  2. To run as administrator, right-click the “Command Prompt” option and choose “Run.”run as administratorThe malware removal process may begin after you access CMD on your machine.

CMD Virus Removal Instructions

The steps to remove a virus using CMD are as follows:

To start your computer, choose Safe Mode.

To start your computer, choose Safe Mode. Booting your computer in Safe Mode is crucial before you start the malware cleanup process. Safe Mode is a troubleshooting mode where your computer starts with the essential drivers and software required to execute the operating system. By creating your computer in Safe Mode, you can help stop the virus from running and contaminating other areas of your system.

To start your pc safely, follow these steps: 

  1. Switch off your computer.shut down computer
  2. Press the F8 critical many times while your machine reboot to bring up the Advanced Boot Options menu, then Select “Safe Mode with Networking,” then hit on safe mode with networking

Discover The Virus

You must locate the virus that has infected your computer once it has launched in Safe Mode. You may use Windows Task Manager to accomplish this.

To open the Windows Task Manager, click the Ctrl, Shift, and Esc buttons at the exact time. Select The “Processes” tab in the Task Management window. Each process currently active on your computer will be listed here.

detect the virusSearch for any nefarious activities that connect to the malware. These processes might have odd names, consume many system resources, or be published by an unidentified party. Please write down the name of the virus-related process after you have found it.

Put An End To The Virus-Related Process

You must stop the virus-related process from operating now that you have found it. A task Manager may be used to do this.

Use Task Management to terminate a process by following these steps:

  1. Choose the virus-related process in the Task Management window.task management window
  2. Choose “End Task” from the on end task Doing this can prevent your computer from launching the virus-related process.

See Also: Can I Upgrade My Motherboard And CPU Without Reinstalling Windows 10

Remove The Files Associated To Viruses.

After stopping the virus-related operation, you must remove the virus-related files from your computer. You may utilize CMD to carry do this.

Use CMD to remove files by doing the following steps:

  1. Launch CMD in administrator as administrator
  2. Enter “cd /d” and the location of the directory containing the virus-related files. For instance, enter “cd /d C: Program Files” if the files are in the “C: Program Files” directory. Type “dir” to get a list of each file in the directory.type dir at the end
  3. Once you’ve determined which files connect to the infection, type “del” and the file’s name. For instance, type “del virus.exe” if the virus-related file’s name is “virus.exe.delete files with .exeThis will remove from your computer the files linked to the malware.

See Also: Remove Fuq.Com Virus From Windows, Mac & Safari | [Easy Guide]

Release Virus Entries From The Windows Registry

The Windows Registry database keeps track of crucial computer settings and data. Viruses frequently alter the Windows Registry to continue operating even after you delete their files. You may use CMD as a potent weapon in your toolbox for removing viruses using CMD to eliminate viral entries from the Windows Registry.

Use CMD to delete a registry entry by doing the following steps:

  1. Launch CMD in administrator as administrator
  2. To launch the Windows Registry Editor, type “regedit.”type regedit
  3. Go to the key that reads: HKEY LOCAL MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ Runhklm local machine
  4. Once you’ve located the items linked to viruses, right-click them and choose “Delete.”select deleteThe Windows Registry entries for the cmd virus will be deleted.

Complete A System Scan

After eradicating the infection with CMD, it’s crucial to do a complete system scan with your antivirus program. This will help ensure that there are no remaining traces of the virus on your laptop and you have successfully learned how to delete a virus from a laptop using CMD.

Use your antivirus program’s complete system scan function by performing the following actions:

  1. Launch your antivirus program and choose “Full System Scan or smart scan” from the menu, then wait for it to on smart scan If your antivirus program finds any lingering indicators of the infection, use the steps advised to eliminate them. In case you lost your password for Windows, here are some Windows password recovery tools.


Is using CMD to remove a virus secure?

If you carefully follow the instructions and delete any files or registry entries connected to the infection, removing a virus using CMD is safe. However, it's crucial to remember that CMD shouldn't be used as your primary antivirus solution, just as a last option.

Would eradicate a virus using CMD ensure that my machine is completely secure?

Using CMD to remove a virus is just one step in keeping your computer virus-free. To reduce the danger of new infections, it's critical to keep your antivirus software up to date, refrain from clicking on dubious links or downloading files from untrusted sources, and use safe surfing practices.

How to remove pendrive virus using cmd?

To remove the pendrive virus using cmd, insert the infected pendrive and open shortcut virus remover using the command line.

What should I do if using CMD to remove a virus makes me uncomfortable?

Consider obtaining expert assistance from a computer technician or an antivirus software support team if you're uneasy about utilizing CMD to eradicate a virus. They'll be able to walk you through everything and make sure the virus is taken off of your computer safely.

Can malware permanently harm my computer?

If viruses are not eradicated immediately, they might permanently harm your computer. This may result in data loss, unstable systems, or even hardware breakdown in difficult situations.


In conclusion, knowing how to remove viruses using CMD may shield your computer from harm that viruses may do. The measures indicate this tutorial should only be taken as a last option; remembering this is crucial. Remember that prevention is preferable to treatment, so keep your antivirus program current and refrain from clicking on shady links or downloading files from untrusted sources.

If you discover that your computer has been infected with a virus, carefully follow the instructions in this tutorial and, if required, consider getting expert assistance.