How to Remove the Virus Using CMD Without Worrying Data Loss?


Summary: This article will take you through a couple of simple steps to remove the virus using cmd in Windows 10, 8, 7, and recover all your missing or hidden files due to virus attack using Bitwar Data Recovery Software.

The virus is a well-known term in the computer world, which can cause significant harm to your computer system by not letting it work as it is meant to be. A virus attack can jam all your essential work while infecting the data or files stored on your computer so that you can not access these files. Indeed, such attacks do not only frustrate the user but also risk the data thus, it becomes imperative to overcome this issue so that your device is safe and secure.

How to Remove the Virus Using CMD

What Is a Virus?

The virus is a malicious code that multiplies itself by copying to another program on your device while changing the way how your computer device works. A virus attack happens when someone intentionally or unintentionally spread the infection without letting the user or administrator know about it.

There are many ways in which a virus can spread in your computer such as by clicking on some link, file, browsing through a virus prone website and accessing an email, etc. it can also spread via removable storage devices such as pen drives, USB flash drives, and SD memory cards, etc.

Don’t Miss it Out: Look! The Best Ways to Recover Deleted Files by Antivirus

How Can a Virus Cause Damage to Your Computer?

Viruses can be of the varied range that behaves differently from others. A virus deviates your device to function normally to take down or remove important files, give access to hackers about your data and track someone’s habits, etc. causing an immense nuisance.

Ways to Prevent a Virus Attack

Below are some of the ways which can save you from a virus attack:

  1. Running an anti-virus scan regularly.
  2. Keep your anti-virus software updated.
  3. Disable the Auto-run option to avoid viruses from spreading to any media attached to your computer device.
  4. Always patch the operating system and applications installed in your system.
  5. Be very careful while clicking on any link sent via email.
  6. Install firewall.
  7. The careful download of files via the internet or email.

How to Know That A Virus attacks your System?

The following are the indications that would let you know about any virus attack.

  1. The computer system undergoes frequent errors, shut down and crashes.
  2. Erratic functioning of computers like not responding to clicks.
  3. Corrupted email.
  4. The storage memory of the device is reduced.
  5. Files/data missing from the computer.
  6. Constant noise and spinning of a computer’s hard drive.

The above stated are some essential points to be kept in mind and prevent your system from a virus attack. And those who may ever come across this concern can consider below steps to remove the virus using a Command Prompt.

Before heading on to the steps to remove a virus, Trojan,  let us get familiar with some commands required to be executed in cmd or Command Prompt.

“attrib” command abbreviations

R: denotes the “Read Only” attribute, which means a file cannot be modified or written.

H: denotes a Hidden attribute.

A: File Archiving.

S: denotes a System attribute that changes the user files to system files.

I: represents that the content of a file is not indexed.

“attrib” Syntax

ATTRIB [+ attribute | – attribute] [pathname] [/S [/D]]

‘+ / –’: To cancel the specified attribute.

‘/S’: Searching the entire path including and subfolders.

‘/D’: Inclusion of any process folder.

‘pathname’: Location of target file/folder’s path.

Proper syntax order for ‘attrib’ command

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I] [drive:][path][filename] [/S [/D] [/L]].

Step by Step to Remove a Virus Using CMD

Step 1: Launch Command Prompt by going to the search box and run as an administrator.

Step 2: Once cmd opens, type D: and hit enter. (Replace D to the wanted drive letter)

Step 3: Now, type the command attrib and hit enter to execute. You will be able to see the autorun.inf virus files in the listing.

Step 4: Input the command attrib -r -a -s -h *.* and hit Enter to execute. This command will delete the read-only, system, archive, and hidden file attributes from all the files. (*- is for the files with different extensions).

Step 5: After this, type del autorun.inf command and press enter to remove the files. In case you are infected by any other virus, then replace autorun.inf with the extension of the virus your system is infected with such as .exe or .ink.

remove virus using CMD

Executing these commands will help you remove viruses from your device, but there are high chances that you may end up losing your vital data due to these steps. Thus, to get your data back, go on with Bitwar Data Recovery Software, and recover all your precious data. The following are the steps to restore your lost data using Bitwar Data Recovery.

How to Recover Data After Removing the Virus Using CMD

Step 1: Open Bitwar Data Recovery software’s official website “” and click on the download button and then install the software in your system.

Download for PC Download for Mac

Step 2: Launch the recovery tool and select the Standard Mode.

Standard Mode 6.49

Step 3: If the Virus has hidden your partition, you can click on Lost Partition Recovery, and followed by clicking on Next.

Lost Partition Recovery

Step 4: After this, select the partition you want to scan and then click on Next.

Step 5: Select the file types you wish to recover and press Next.

Select All Types

Step 6: Preview the selected data and click on Recover to start the recovery process.

Preview 6.49

Note: If the virus attack or Trojan infection causes the vital data to be deleted or hidden, you can turn to Wizard mode, and select the partition/drive to be continued.

Wrap It Up!

A virus attack can surely create a huge hassle by spoiling the functioning of your computer device. You might even hear or face such CryptoLocker Ransomware, which encrypts all of the documents and threat you to send Bitcoin to him/her to unlock, otherwise, the CryptoLocker will delete all of your documents in a specific time.

There are many ways in which you can check the normal working of your computer and prevent it from a virus attack or Ransomeware infection. There are scores of procedures in place to remove a virus from your computer however, applying those procedures may result in data loss. Therefore, we suggest using Bitwar Data Recovery software to cater for all your data recovery needs.

Read More

  1. 5 Ways to Fix “Error Copying File or Folder Unspecified Error”
  2. 4 Ways to Fix “The disk structure is corrupted and unreadable”
  3. [FIXED] The Volume Does Not Contain a Recognized File System
  4. 9 Solutions to Fix Folder Disappeared Windows 10 Problem
  5. 4 Proven Solutions to Force Delete a File/Folder

Happy with this post?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 249

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Previous article[Solved] The Operation Could Not be Completed Because the Volume is Dirty
Next article4 Methods to Fix The “Unable to Execute File in the Temporary Directory”


  1. Thanks, feel like my anti virus is not actually doing any job lately! Didn't know there was other methods to deal with a virus, also Bitwar works really great, incredible easy to u se, check your files and pick the ones you want back! Great deal.

  2. Hello, in order to follow this tutorial, do I need to know which files is the one who has the virus? When recovering the data with Bitwar is it an entire backup of the computer or just the affected file? Thanks!

    • Hello, Marissa, Bitwar scans all of the files that can be accessed from your computer, and lists all of them in the program, you have to select the files on your own to recover them if needed. Thank you.

Comments are closed.