Home » How To » Remove Virus/unwanted file Using Command Prompt

Remove Virus/unwanted file Using Command Prompt

Hi, friend I know that almost everyone who is using computer must be having antivirus installed on their system and some of them may not. But sometime it happens that your antivirus doesn’t detect virus even though you have 100% doubt that your Pendrive must have virus because you brought your Pendrive from somewhere like cyber cafe, PC from where there is no antivirus installed, etc.

Now in this case you must follow the steps given below to check unwanted files and folder in your PenDrive and delete it.

Note that, this trick can also be use to remove unwanted files/folders from your Drive too.

Follow the steps to remove unwanted Files from your Pendrive/ Drive without opening it:

  1. Insert your Virus infect Pendrive and Scan for virus, if detected then well and good otherwise go ahead to remove it from command prompt.

In my case it has detected the virus even though I would like show you, how to remove this virus using command prompt?

Virus-detected-usng-avast-antivirus

  1. As you can see that antivirus installed on my system has detected “autorun.inf” file.

This is the file; if you try to open it then your system may get infected with virus.

  1. So, let us remove it from command prompt.

Open command prompt and go to the virus infected drive by typing “Drive name with colon” (H: ) then enter.

Now type attrib -s -h *.* /s /d and enter. And continue by typing “dir” which will show you all files/folders in that drive, as you can see that autorun.info files is present in this drive.

Autorun-file

  1. Now if you want to delete it then just type “RD autorun.info(i.e. name of file/folder to be deleted)” or rename it to delete it manually.

To rename the file just type in command prompt

REN “Path of files/folder to be deleted” (space) “Name to be given”

Or if you are in that drive using command prompt then type

REN “Name of files to be deleted” (space) “Name to be given”

Rename-Autorun-file

 

Worth Reading : Recover any type of deleted files from Pendrive or Hard Disk.

  1. Now you can check that autorun.info has been rename as useless

File-Renamed-as-Useless

  1. Now if you will scan then your antivirus won’t detected virus in that drive.

No-threat-Detected

  1. Now if you want then you can delete this file after opening the drive.

Delete-useless-file

 

You may not go for such a large procedure to delete any virus affected file if you have daily updated antivirus. But this is quite useful when one of your folder is giving you trouble by hanging your system when you open that folder.

Please let us know through comment box, if you have any other trick to share with our reader.

 

Want to get similar cool tech stuffs in you Inbox? Subscribe to my Feed!

About the author

Shivkumar

I am Shivkumar Lohar from Mumbai.
I believe in learning,practicing and implementing, whatever I learn.
A Music lover and love to explore latest gadgets and softwares.

36 Comments

Click here to post a comment

CommentLuv badge