zaro

How to scan a PC using cmd?

Published in PC Diagnostics 3 mins read

To scan your PC for system file integrity using the Command Prompt, type SFC /scannow and press Enter. This utility checks and repairs corrupted Windows system files.

Scanning a PC using the Command Prompt (CMD) primarily involves checking for system file corruption or hard drive errors. CMD itself is not an antivirus tool for detecting malware, though it can be used to launch security applications.

Scanning for System File Integrity with SFC

The System File Checker (SFC) is a built-in Windows utility that scans for and restores corrupted Windows system files. It's a crucial first step when troubleshooting system instability or errors.

Steps to Run an SFC Scan

Follow these steps to utilize the SFC utility:

  1. Open Command Prompt as Administrator:
    • Type cmd in the Windows search bar.
    • Right-click on "Command Prompt" and select "Run as administrator".
    • Click "Yes" if prompted by User Account Control (UAC).
  2. Execute the SFC Command:
    • In the Command Prompt window, type SFC /scannow
    • Press Enter.
  3. Wait for Completion:
    • The scan will begin and can take some time. Do not close the window until the verification process is 100% complete.
    • Upon completion, you will receive one of the following messages:
      • "Windows Resource Protection did not find any integrity violations." (No issues found)
      • "Windows Resource Protection found corrupt files and successfully repaired them." (Issues found and fixed)
      • "Windows Resource Protection found corrupt files but was unable to fix some of them." (Issues found, but some couldn't be fixed, requiring further troubleshooting)

Scanning for Disk Errors with Chkdsk

The Check Disk utility (chkdsk) scans your hard drive for logical and physical errors. It can fix file system errors and identify bad sectors.

Steps to Run Chkdsk

To scan your hard drive for errors:

  1. Open Command Prompt as Administrator: (Same as SFC steps above)
  2. Execute the Chkdsk Command:
    • Type chkdsk C: /f /r /x (replace C: with the drive letter you want to scan if it's not your primary drive).
      • C:: Specifies the drive to be checked.
      • /f: Tells Chkdsk to fix any errors it finds.
      • /r: Locates bad sectors and recovers readable information.
      • /x: Forces the volume to dismount first if necessary.
    • Press Enter.
  3. Handle Drive in Use:
    • If the drive (e.g., C: drive) is currently in use, you'll be prompted to schedule the scan for the next system restart. Type Y and press Enter to confirm, then restart your PC.
    • The scan will run before Windows loads, which might take a significant amount of time depending on your disk size and speed.

Indirectly Scanning for Malware via CMD

The Command Prompt itself does not have built-in commands to perform a direct, comprehensive malware scan like antivirus software. However, you can use CMD to launch Windows Security (formerly Windows Defender) which does perform these scans.

Launching Windows Security for Malware Scan

  1. Open Command Prompt: (Administrator privileges are not strictly necessary just to launch the app).
  2. Execute the Launch Command:
    • Type start ms-settings:windowsdefender
    • Press Enter.
  3. Initiate Scan in Windows Security:
    • This command will open the Windows Security application. From there, navigate to "Virus & threat protection" and initiate a quick, full, or custom scan using the graphical interface.

Summary of PC Scanning Commands

Scan Type Command Purpose When to Use
System File Integrity SFC /scannow Checks and repairs corrupted Windows system files System crashes, errors, slow performance
Disk Errors chkdsk C: /f /r /x Fixes file system errors, recovers bad sectors Disk read errors, slow file access, system hangs
Malware (Indirect via App) start ms-settings:windowsdefender Launches Windows Security for full antivirus scan Suspected virus/malware infection