How to Remove Virus Using CMD or any Manual Methods?

How to Remove Virus Using CMD or any Manual Methods?

Viruses are prone to attack your files, folders, and operating system. Other than the antiviruses and firewall programs, you can also detect (and then remove) viruses from your Windows 10 PC using the CMD commend. This post will explain the CMD process in detail and also take you through other manual steps to remove a virus. If you happen to lose your valuable data due to a virus attack, use data recovery software immediately to recover your lost data.  

 Impact of a virus on your computer

 A virus is a nuisance that damages your computer and slows down its performance. It can corrupt your files, cause system crashes, track your online activities, and even make hackers access your sensitive information. 

Protect your computer from viruses by building a defense around your network, or you can use programs to remove a virus that has infiltrated your computer, or you can do both. Whatever be the scenario, it’s for the best that the virus stays out of your computer. 

 Antiviruses have been a popular application for most of us when it comes to removing viruses from our computer. However, most users are not aware that viruses can be detected and removed by the CMD program of Windows as well. 

 Let’s see how to do it and also explore other manual methods to remove the virus.

How to remove viruses using the CMD program

 Viruses tend to hide, and the CMD programs expose these hidden viruses in your computer. Post detection, you can proceed to delete these files. The step-by-step process is detailed below:

Step 1. Enter cmd in the search bar, and in the Command Prompt, select “Run as an administrator” 

Step 2. Type D: and press Enter. Here, F:is the drive letter of the virus-infected partition or external device; replace D accordingly.

 Step 3. Type attrib -s -h -r /s /d *.* and press Enter.

 Step 4. Type dir and press Enter. You’ll be able to see all the files under the assigned drive. 

 Step 5. Please note that a virus name may contain words like “auto run” and with “.in f” as the extension. If you see such suspicious files, then type del autorun.inf to remove the virus. 

Image 1: The CMD command screen where you can enter the attributes to remove viruses

If you get the message ‘Access Denied’, then consider doing the following:

1) Run Command Prompt as an administrator.

2) Ensure that the file/folder is not in use.

3) Run CHKDSK command to check for file system errors (run Command prompt and type chkdsk /f [drive letter]:)

 Other manual methods to remove a virus

1. Run Windows Defender

Windows Defender is a built-in protection program for Windows 10 devices. It protects you from viruses, malware, spyware, and other types of malicious programs. You can run the program by following the below steps:

  1. Go to Settings > Update & Security > Windows Security
  2. Select Virus &Threat protection
  3. Under the Threat History section, click Scan Now

2. Run an external Antivirus program

You can run an external antivirus application installed (E.g., Norton, McAfee, etc.) on your computer. If it is not installed on your system, download it from their respective websites. 

Here is a PC Mag link that lists down the best Windows Antiviruses for 2020. 

3.Erase the infected device

If the above two methods fail to remove the virus, then we recommend to permanently erase all the contents from your computer with a Best File Eraser program. You might argue that formatting does the same job, but formatting doesn’t erase the data permanently from your system. So a virus can remain in your device, even after formatting. 

Erasing, on the other hand, securely and permanently removes the contents from your computer by overwriting once or multiple times. This renders the data irrecoverable and neutralizes the virus permanently. 

A recommended software is BitRaser File Eraser that can comprehensively wipe the contents (including malicious viruses) from your PC. 

 Read this KB on how to use BitRaser File Eraser to wipe data on your computer

Data Recovery: Recover all your valuable data from a virus-infected PC

Before deciding to erase the infected device, you must recover all your valuable data. This way, you would not lose your personal and sensitive information. Plus, once the device has been wiped clean, you can restore your data into your PC.

Data recovery also comes into the picture if you happen to lose your data as a result of a virus attack. Data recovery software is a specialized class of software that can trace and restore data lost due to any scenario. A recommended product is Stellar Windows Data Recovery that uses advanced recovery techniques to restore even the most virus corrupted files. 

Read the link here to know the step-by-step procedure on how to perform file recovery from a virus-infected drive.


The CMD program can help in detecting the virus, which you can remove afterward. If the method fails, then you can try other manual techniques illustrated in the post above. Virus attacks often lead to loss of data. In such cases, a data recovery software like Stellar Windows Data recovery can be a useful ally. It can trace and then restore all your valuable data and save you from the consequences of permanent data loss.