How to Remove Viruses from Your PC Using Command Prompt (A Step-by-Step Guide)

The first step is to access the Command Prompt (also known as CMD) with administrator privileges. Viruses often run as background processes, so let..

If you’re here, it’s probably because your computer is crawling with pesky viruses. What’s worse? 

Those sneaky viruses might have even disabled your antivirus software, leaving you stuck and frustrated. 

Don’t worry; I’ve got your back! In this guide, I’ll show you how to clean your computer using the Command Prompt. It’s simple, effective, and doesn’t require any fancy tools. Let’s dive in!

Step 1: Open the Command Prompt as Administrator

The first step is to access the Command Prompt (also known as CMD) with administrator privileges. Here’s how:

  1. On Windows 10:

    • Right-click the Start Menu or press the Windows + X keys.
    • From the menu, select Command Prompt (Admin).
  2. On Windows 11:

    • You won’t see the “Command Prompt” option directly. Instead, select Terminal (Admin).
    • When the terminal opens, it defaults to PowerShell. Click the small down arrow in the top bar and choose Command Prompt while holding the Ctrl key.
  3. Grant Permissions:

    • A User Account Control (UAC) prompt will appear. Click Yes to allow changes.

And there you go! The Command Prompt is now open as an administrator.

Step 2: Identify Suspicious Processes

Viruses often run as background processes, so let’s track them down. Follow these steps:

  1. In the Command Prompt, type:

    tasklist
    

    Press Enter to display a list of all running processes on your PC.

  2. Carefully examine the list for any suspicious processes. These might have weird names, seem unfamiliar, or stand out in some way.

Pro Tip: If you’re unsure about a process, you can always Google its name to check if it’s legitimate.

Step 3: Stop Virus Processes

Once you’ve identified the suspicious processes, it’s time to stop them. Here’s how:

Stopping a Process by Name

  1. Type the following command:

    taskkill /IM [ProcessName] /F
    

    Replace [ProcessName] with the exact name of the process you want to stop. For example:

    taskkill /IM virus.exe /F
    
  2. Press Enter, and the process will be terminated.

Stopping a Process by Process ID

If the process name is too long or hard to type, use its Process ID (PID) instead:

  1. Note the PID of the suspicious process from the tasklist.

  2. Type:

    taskkill /PID [ProcessID] /F
    

    Replace [ProcessID] with the actual number. For example:

    taskkill /PID 1234 /F
    
  3. Press Enter, and the process will stop.

Step 4: Scan Your PC Using Windows Defender via CMD

Now that the virus processes are terminated, it’s time for a proper scan using Windows Defender. Here’s how to do it:

  1. Navigate to the Defender Directory:
    Copy and paste the following command into the Command Prompt:

    cd C:\ProgramData\Microsoft\Windows Defender\Platform\latest
    

    Press Enter.

  2. Run a Quick or Full Scan:
    Use the following command for a scan:

    MpCmdRun.exe -Scan -ScanType [ScanType]
    

    Replace [ScanType] with one of the following:

    • 1 for a quick scan
    • 2 for a full system scan

    For example, if you want a quick scan, type:

    MpCmdRun.exe -Scan -ScanType 1
    
  3. Scan Specific Files or Folders:
    If you want to scan a particular file or folder, type:

    MpCmdRun.exe -Scan -ScanType 3 -File [FilePath]
    

    Replace [FilePath] with the full path to the file or folder.

  4. Wait for the Scan to Complete:
    The process might take some time, especially for a full scan. Be patient and let it finish.

Step 5: Perform an Offline Scan (Optional but Recommended)

Some stubborn viruses require an offline scan. This method restarts your computer and runs a more thorough scan. Here’s how:

  1. Open PowerShell as an administrator.

    • Search for PowerShell in the Start Menu, right-click, and choose Run as Administrator.
  2. Enter the following command:

    Start-MpWDOScan
    
  3. Press Enter. Your PC will restart, and the offline scan will begin automatically. Let it do its job, and when finished, your PC will boot up again.

Step 6: Disable Suspicious Startup Items

Viruses often configure themselves to start every time your PC boots. Let’s disable them:

  1. Open Task Manager:
    In the Command Prompt, type:

    taskmgr
    

    Press Enter to open the Task Manager.

  2. Navigate to the Startup Tab:
    In Task Manager, go to the Startup tab.

  3. Identify and Disable Suspicious Items:

    • Look for any unusual or unfamiliar programs listed here.
    • Right-click on the suspicious app and select Disable.

By doing this, you ensure that these programs won’t automatically run when your PC starts up.

Step 7: Stay Safe and Secure

Congratulations! You’ve successfully cleaned your PC using the Command Prompt. Here are a few final tips to keep your computer virus-free:

  • Install a Reliable Antivirus: Keep your antivirus program updated and running at all times.
  • Avoid Suspicious Downloads: Be cautious about the files and programs you download, especially from untrusted sources.
  • Keep Your System Updated: Regular Windows updates often include important security patches.

That’s it! If you found this guide helpful, don’t forget to share it with your friends who might need a little tech support. 

Post a Comment