How to Remove a Virus from Your Computer without Using an Antivirus

Pexels Pixabay 60504 1

Sometimes viruses can slip through your defense systems and compromise your operating system. If you’re in a pinch, you can attempt to remove common computer viruses without antivirus software with the help of command prompt.

Also read: What is Antimalware Service Executable? Why is CPU and Memory Usage High?

Things to Consider Before Using Command Prompt to Remove Viruses and Malware from Your PC

Only use the command prompt to remove viruses if you have some technical understanding of how computers work. Running specific commands with administrator privileges may be risky, and you can lose your data or system files if you misuse them.

Sarbasri Bhaumik Kibtvu56u0w Unsplash

Apart from that, there’s a limit to what the command prompt can do to remove malware. You can use it to delete some common viruses, but you can’t do it with others. For instance, you can’t remove ransomware with the command prompt. For that, you’ll need software that can decrypt your files.

Ensure you have administrator access to your PC, as without it, some viruses won’t be removed successfully.

Also read: Useful Run Commands Every Windows User Should Know

How Do Computers Get Infected with Viruses?

One way to reduce the risk of a malware infection is to learn how computers catch viruses and avoid that. Your computer can catch a virus in several ways:

  • Downloading data from unsafe sites can infect your computer with malware. Most websites that support movie, audio, game, and software piracy are rife with viruses.
  • Spam emails also carry malware, and opening any attachments from them may infect your computer.
  • Ads and pop-up notifications can also download malware into your computer when you click on them.
  • Attaching an infected peripheral device (like USB drives or external hard drives) can also infect your system with viruses.
  • Connecting to unsafe networks can expose your computer to viruses already present within the network.

Also read: Find and Open Files Using Command Prompt in Windows

How to Tell If Your Computer Is Infected with Viruses

If you fall sick, you’ll experience symptoms that help doctors determine your illness. Computers are similar to us in that aspect. Once infected, your computer will behave in an unusual way to alert you of a possible compromise in its operating system.

Michael Geiger Jjpqavjby K Unsplash

Here are some examples:

  • Computer performance slows down, and your device takes too long to start up and run programs.
  • Some malware will cause your PC to overheat or your fans to run with a jet-like noise.
  • You may lose access to some or all of your files, or the malware may delete them altogether.
  • Although you didn’t download them, unusual applications may appear on your Desktop and Start menu.
  • Your browser may slow down.
  • You’ll begin to receive repeated warning notifications from your antivirus software
  • Unexpected system shutdowns and restarts.
  • Overworked CPU, RAM, and hard drive.
  • Some malware may hijack administrator privileges and deny you access to some or all your PC functionality.

Also read: How to Enable Ransomware Protection in Windows

How to Scan Your PC for Malware Using Command Prompt

Before removing any virus from your computer using the command prompt, first, scan your system. Most viruses will hide within your system files or drives, mostly changing their properties to stay invisible or undetected.

To scan for malware using command prompt:

  1. Open the command prompt with administrator rights. You can do so using your search bar or the Run function.
M9W JY7clEZZyYxdc55NMLjXWE9JXqtGCjwZgOWwDn2wsa 1Y8WRte3Y647sN AnEXsg9swL9lmwD3QWkH8MfP8nlG1wCMwMgc YZ5QsZ8K4tcn4VgJ DFiwwnVMYKMY CRiCcwB
  1. Once done, you’ll receive a prompt to confirm you want to use administrator rights on your PC. Click “Yes” to continue.
FD92offWDR6jQjXt2UMwHLns CB8MYUMPA12X6QNz4qdejEWiDyXPsK  iXbHbXDisycg D3mJ9dS3HUswrq4CP8fPvtSs9FuzGo6oksLn 7Iqkj6BPQvGxWyQV F2F3xjicsVGd
  1. Once done, a CMD window opens.
UvT3kENsoR GPPM7uW0P K0Nsz789t2JyMCrcRJQtzWJPiuKmrp3YnYAxw2OZwtxhAzkxOkTPcM pE4vO9muqLhZ57EGMCQWX75ZZ0yR41PBnYMek4AGFInZFbamQZQU cmh g42
  1. To begin your scan, type sfc /scannow and press Enter.
XcXOVioyfCqRtW7kQopW4CKoFCwRZRX2GhdKHEzgAiLlBaXYOaxRmV8ETULLhewc3q1jdraAQ0ROOyuWwn63LyLdxDG Zl1tKq2latmwatseAr1UC5KrvGHGrNuoHG3uzO5zweKq
  1. Depending on your PC specifications, this process may take some time. Wait until the scan is complete.
 oVPx0JS hcrcqkXoCJaee8d43rYzpU44WQ507VEGAjHBivg9R3A72NQ1GcMjj8y71QZMSHHKu97PgyYyPMLF2SKMc8POEpD XS9mgdE0eNPx05LvrBG17xcjfRCSt2sda7XBru

Windows will also attempt to repair any corrupt files as this scan happens. In some cases, this may resolve your issues. If not, you may have to search and delete the virus files from your drives.

How to Identify Viruses

Identifying computer viruses isn’t always a straightforward process, but once identified, you’ll know how to remove them. Here are several ways to identify viruses on your PC.

By Scanning

Many antivirus software solutions already have massive databases of different types of malware. Using them to scan files can help you identify a virus by name.

Windows Defender, for example, uses its internal behavioral analysis tools to determine if a file or program is some form of malware. Commercial antiviruses also have this capability.

By Source

How did malware infect your PC? Did you download it from a file attachment in your e-mail? Jot down the details of that email and scan the file for viruses. Was it from a USB drive? Scan all the files inside it for suspicious files. Once you identify the problematic file, you can delete it.

By PC Behavior

Although less clear, you can use the behavior of your computer to determine what malware has infected it.

Ransomware, for example, encrypts your files and denies you access to partitions in your hard drive. Adware causes annoying pop-ups on your browser and computer when surfing the Web.

While ransomware may require decryption software, adware will be easier to deal with.

Search and Remove Viruses Using the Attribute Command

To remove viruses from a specific drive or partition, you can use the attrib command. This command can set, display, and remove several properties from files and folders.

“Attrib” Syntax

Here’s a quick rundown of how to use the attrib command. To run the command, you must call it using attrib:

  • R represents the Read-Only attribute
  • S represents the System attribute
  • A represents the Archive attribute
  • H represents the Hidden attribute
  • + applies the chosen attribute to a file or folder
  • - removes the selected attribute from a file or folder
  • /S searches through the entire document path, including subfolders within folders
  • /D includes any process folder
  • Pathname is the location where the target file or folder is.

This command can get rid of several types of viruses, including “autorun.inf” and the Glupteba trojan.

How to Remove a Virus With The ‘Attrib’ Command

  1. To begin, run the command prompt with administrator privileges
  2. Once the CMD opens, select the infected drive using its letter. (in my case, E:) This keeps all the functions you’ll run within this partition.
Kgj7l884uGeG96o4LvI2hZnWcXG5 nZPm2IyTFIAI I3Otm8GWr2tn2Ezy5q ig ePVK4qNSS9ZXDFiE ZAGNTzrOEemjFzR07HUIgmT OtXvcW7AId hlQ7naP7bTyE6ebhrYc3
  1. Use the command dir [drive-letter]: attrib -s -h /s /d * . * to get into your chosen file/folder.
Cmd Remove Virus 6
  1. Once you’ve identified the unwanted file, you can now delete it with the command: del [virusname]

Doing this deletes the virus permanently from your system

What Viruses Can CMD Remove?

It depends on the virus itself. CMD can delete some viruses but won’t delete others.

You can use cmd to delete common low-level viruses like “autorun.inf”. For more complex viruses, you’ll need dedicated antivirus software to remove them from your system completely.

Viruses have different behaviors, and some replicate themselves into the registry and may alter or delete system files. To delete such a virus would require you to repair the system and recover files as well.

Where possible, use antivirus software to remove complex malware. If your computer system gets a ransomware infection, cmd won’t do much to help you – at least not yet.

Also read: The 8 Best Sandbox Applications for Windows 10 to Keep You Safe

Frequently Asked Questions

1. Can you really remove a virus just by deleting it?

If you follow these instructions carefully, you can remove a virus by deleting it. If you already have antivirus software, it shouldn’t be a problem. Many antivirus programs delete virus files too, and that’s usually permanent.

2. Should I use the command prompt to remove viruses instead of an antivirus software?

You could use the command prompt method to remove viruses if you don’t have antivirus installed, but it will not protect your computer from infection without the advanced features that most good antivirus software provide: e.g. quarantine, scanning, etc. You should not depend on this method to keep your computer safe from infection; rather, use it in a pinch to remove a virus if you have to.

3. Can a virus survive a factory reset?

Mostly, no. Resetting your computer restores it to its condition before you bought it. It’s an effective way to clean your hard drive of viruses and repair damage.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Ian Derrick

Ian is a technology writer with over 11 years of experience with Windows. He also has experience working in Data Analysis, Android, and Computer Hardware. He writes for MakeTechEasier on a wide range of tech topics, including Windows, Android, VPNs, Hardware, and Software tools and Reviews, and How-tos.