Viruses, malware, trojans, worms! These evil things can penetrate your computer through numerous ways like internet browsing, from USB devices, phishing links in your email and also by installing infected software.
Most of these viruses make your computer slow and eat up valuable memory as well as storage space. Some more powerful viruses are meant to contaminate our operating system too and steal personal information and banking data.
The conventional method to identify and remove such unwanted programs from your computer is to install anti-virus software and scan your computer for any viruses/trojans/worms that exist and quarantine them.
CMD has access to reconstruct all Windows system files by using various attributes like removing the hidden attributes which a virus normally uses.
One of the leading causes of virus infections in computers and the CMD method work on USB to remove its viruses and secure your computer.
Steps To Remove Virus Using Command Prompt
- Type cmd in the search bar, right-click “Command Prompt” and choose “Run as an administrator”.
- Type F: and press “Enter”. (Replace “F” with the drive letter of the infected partition or device.)
- Type attrib -s -h -r /s /d *.* and hit “Enter”.
- Type dir and hit “Enter”. Now you will see all the files under the assigned drive. (The dir command displays a list of a directory’s files and subdirectories.)
- For your information, a virus name may contain words like “autorun” and with “.inf” as the extension. Thus, if you find such suspicious files, type del autorun.inf to remove the virus.
Here are the basic attributes of the ‘attrib’ command:
R – represents the “Read-only” attribute of a file or folder. Read-only means the file cannot be written on or executed.
H – the “Hidden” attribute.
A – stands for “Archiving” which prepares a file for archiving.
S – the “System” attribute changes the selected files or folders from user files into system files.
I – “not content indexed file” attribute.
Removing a virus using CMD is a roundabout solution. Yet it works in some cases. If the attrib command fails, try the three more tips provided to get rid of the malicious file.