Do you know you can use commands to remove virus? This post from MiniTool Partition Wizard shows you how to use CMD to remove virus and tells you the disadvantage of this method.

How to Remove Virus Using CMD

Can you use CMD to remove virus? The answer is YES, but the work is difficult for most people. CMD offers commands to display all types of files, including hidden ones. However, it can’t identify what file is a virus. You need to find the virus file by yourself and then delete it. Here is the guide:

  1. Type “cmd” in the Windows Search bar.
  2. Right-click Command Prompt from the result list and choose Run as administrator.
  3. In the Command Prompt window, type “Drive_Letter:” (f: for example) and press Enter. You will go to the drive where you suspect there is a virus.
  4. Type “attrib -h *.*” and press Enter. This command will delete the hidden attribute of all files under the drive. Hence, all hidden files are shown.
  5. Type “dir” and press Enter. This will display all of the file directories (files and folders) on the drive.
  6. Check whether there is an autorun.inf file or other virus files. If you find it, you can type “del file_name” and press Enter to delete this virus.
Tips:
Autorun.inf allows to automatically run a specified file when double-clicking the disk. Many Trojans or viruses use this mechanism to spread.
delete the hidden attribute
Here’re 2 Ways to Remove Virus from SD Card Without Formatting
Here’re 2 Ways to Remove Virus from SD Card Without Formatting

Can I remove virus from SD card without formatting it? If you are curious about it, read this post to find the answer.

Read More

Further Reading:

You can also show hidden files in File Explorer and then find the virus to delete. Here is the guide:

On Windows 10

  1. Open File Explorer by clicking its icon on the taskbar.
  2. Click File in the left upper corner and choose Change folders and search options. A Folder Options window will pop up.
  3. Skip to the View tab and check Show hidden files, folders, and drives.
  4. Click the Apply and the OK buttons. 

On Windows 11

  1. Open File Explorer.
  2. On the ribbon section, click View > Show > Hidden items.
Also Read:How to Fix Virus Has Changed All File Extensions on Windows PC?

How to Remove Virus Using Antivirus

If you use CMD to remove virus manually, this is very inconvenient. The most commonly used way is to run an antivirus. Windows Defender is the built-in antivirus protection in Windows 10/11. You can run it to delete viruses. Here is the guide:

On Windows 10

  1. Press the Windows key + I to open Settings.
  2. Click Update & Security.
  3. Click Windows Security in the left panel and click the Open Windows Defender Security Center button in the right window.
  4. Go to Virus & threat protection and click Quick Scan.

On Windows 11

  1. Open Settings.
  2. Click Privacy & Security on the left and click Windows Security on the right.
  3. Click Open Windows Security.
  4. Go to Virus & threat protection and click Quick Scan.
Tips:
If your files are deleted by virus, you can try recovering them via MiniTool Partition Wizard or other data recovery software.
Also Read:Fix Virus & Threat Protection Not Working or Missing Win 10/11

Bottom Line

MiniTool Partition Wizard is a functional tool. It can migrate OS, clone disk, recover partitions, recover data from hard drive, etc. If you have this need, download it to have a try.

MiniTool Partition Wizard DemoClick to Download100%Clean & Safe

  • linkedin
  • reddit