How to Remove a Virus Using Command Prompt (CMD) and Notepad

How to Remove a Virus Using Command Prompt

 Virus is a computer program that can copy itself and infect your computer. These viruses can spread via USB/flash drive or from one computer to other computer by few written codes. There are many antivirus software available to remove viruses from computer. But there are some viruses or suspicious files which can’t be removed by any antivirus software. Some suspicious files such as autorun.inf initiate all the viruses in pc. These files must be removed for safe operation of your pc, because they may lead to data loss, software damages etc. Such viruses and files can be removed by using cmd. In this article we will discuss how to remove a virus using command prompt. Following steps can be used to remove a virus using command prompt from your computer.


Must read : How To Delete Undeletable Virus File without Software


  •    Go to start menu and type “cmd” in the search box or Start>all programs>accessories>command prompt.

  • Open the infected drive such as write , g: to go to G drive.
  • Now type dir/w/a . It will show all the files of the drive including hidden files.
  • Locate AUTORUN.INF or any Virus and other suspicious files in the directory.
there was no virus in my drive so only autorun.inf is been highlighted.
  • Type command attrib  -r –a –s –h to remove attributes of corresponding file.
Type del autorun.inf to delete autorun.inf file.

  • Now type del virus name.exe t delete it, eg : del newfolder.exe .


(You can also delete viruses by using following steps:
  • When you find an Autorun.inf file or any other unusual .exe file just rename it.



Syntax for rename is (rename filename.extension new name ,  for example: (rename autorun.inf virus) to rename autorun.inf file. Here I have renamed it by “virus”.
  • Now you can access the defected drive without affecting the virus.
  • To delete the renamed file go to the defected drive and select the file you renamed.




Now delete the harmful renamed files.)
You have deleted that virus successfully but sometimes virus resides in the Recycler folder.To locate this folder:
  • Type cd recycler command.
  • Again type dir/w/a  to locate all file of the folder.
  • Identify malicious files and delete them using above commands.
Follow the above steps carefully and i think this information is enough to remove a virus using command prompt easily.
Important: Make sure that no other processes being running while performing these actions. Best of luck.


Share and Enjoy :)

10 comments

What if it spread from a computer, and not a hard drive?

Reply

Viruses does spread from computer to computer. Clear all you concepts from my previous posts.
http://ujjwalsinhaiitd.blogspot.in/2014/04/how-do-we-detect-and-remove-trojan.html

http://ujjwalsinhaiitd.blogspot.in/2014/04/why-do-anti-viruses-fail-in-detecting.html

Reply

Windows Hacking ! Isn't it interesting?
Simply exploit the vulnerabilities of Windows and it gets Hacked. So, If you would like to know the existing vulnerabilities and secure your privacy, do read this interesting post and stay tuned.


http://ujjwalsinhaiitd.blogspot.in/2014/05/how-to-hack-windows-part-1.html

Reply

for all files, folders, and sub folders: (h:\ is the drive letter )
attrib -h -r -s /s /d h:\*.*

or + instead of - if you want.

Reply

Hi
do you know about how to find virus in ps
means if any virus is in my system so how can I find there is being in my system
the virus that no anti virus can find it
I run anti virus but can't find it , but now how can I find out where is the place of it in my hard drive and what is the name of it ?
please help me if you know any way to find any virus with command prompt ?
thanks
Regards :
Raha

Reply

please tutor complete !!!

Reply

tnx for the tutorial

Reply
Anonymous mod

-h-r-s what these means .. What it identifies in cmd

Reply
This comment has been removed by the author.

autorun.inf is not the virus, its just the file that run the virus, in cmd type notepad autorun.inf and you will find the path to the virus in it.
otherwise the virus will simply recreate autorun.inf.

Reply

Post a Comment