Explore the Latest Stupidity :
You are here: Home >> How To >> Remove Virus/unwanted file Using Command Prompt
Remove Virus/unwanted file Using Command Prompt

Remove Virus/unwanted file Using Command Prompt

0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 StumbleUpon 0 LinkedIn 0 0 Flares ×

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?


  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.


  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”



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


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


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



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 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.


  1. nice trick to remove virus from my lapi ‘amazing post like it

  2. Shiv,

    Glad to read the post. I am in love doing things with command prompt. Its so enjoyable doing something on that black screen. Awesome feeling.

    I tried these tweaks which you mentioned when I was studying in BCA.

    Nice to read 🙂
    Atish Ranjan recently posted…How to Make Money Through a Blog?My Profile

  3. I was completely unaware of this. This is really cool. virus can be removed from computer without any external software. Its awesome..

  4. Hi Shivkumar,

    This post is a keeper! Just last week my computer was making a weird sound and when I looked, it was a virus attack. Lucky for me, I just closed everything down immediately. Then I ran a virus scan. All was well. But what have happened if I wasn’t so lucky?

    I would sure need this post!

    Thanks so much, I have bookmarked this just in case I run into trouble again.

    Donna Merrill recently posted…3 Ways To Pump Up Your BlogMy Profile

  5. Hi. I have a problem on my laptop computer. It always gives me this Windows Script Host error message on start-up:[cannot find script file “C\Users\HP User\App Data\Roaming\Adobe\flash player\cache\IDM cache.vbs”]
    This started after I manually deleted a left-over file of Internet Download Manager from my computer (after uninstalling IDM). The remainder files of the “IDM cache.vbs” are no longer in my recycle bin. Please how do I fix this error message? can it be fixed from the command prompt window?

    NB: IDM cache.vbs” error has been a common problem with many computer users (as I’ve discovered on the internet recently).

  6. Hey I can do this method…
    This method is have any side effect on my PC???
    This process is not affect the data stored in PC means format???
    Sorry for my bad English…
    but plz reply me fast I am waiting???

  7. Kats Cleven George

    Guys the method works with any side effect you can go ahead and use it don’t fear

    And how about to close programmers using cmd

  8. Wonderful method man! I never thought that I could remove a virus without installing an antivirus! I guess, it’s time to ditch antiviruses 😉 Moreover, the method being safe astonishes me!
    Saksham Talwar recently posted…10 Reasons to Drop your Online Virus Scanner for an Offline AlternativeMy Profile

  9. Hello sir, my system is getting struck after some time after starting it.
    i found 4 virus in my system and i deleted it using avast. even though it is getting struck.
    is there any other problem that cause my system struck?

    pls reply to sreeramoju.sreekanthbabu@gmail.com

    • Hi Sreekanth,

      Since you are using free antivirus, you may not be able to remove virus completely from your system. I would suggest to get a lincence copy of antivirus if you really care about your data and keep it up to date.

      Tricks like removing virus may help to certain extend but it may not be able to rectify recent virus came in market.

      Thanks for coming by and asking for help.

      Have a great day ahead! 🙂

      >SK Lohar
      Shivkumar recently posted…Simple but useful keyboard shortcuts in window 7 –Part 3My Profile

  10. hi after i renamed and deleted autorun.inf it returns back
    plus there are exe files name documents.exe, movies.exe etc.
    i need help

    ty very much
    brandon recently posted…Disable PC USB port and increase your system security in 2 minutesMy Profile

  11. rushikesh kulkarni

    hi sir
    can this trick affect my pc?
    it loses any data?
    please reply i am waiting

  12. recently a virus attacked me and after every minute command prompt pops up. My browser settings are changed and lots of Japanese softwares just got installed. My antivirus can`t detect it. what should i do?

  13. hi sir
    can this trick affect my pc?
    it loses any data?

Leave a Reply

Your email address will not be published. Required fields are marked *


CommentLuv badge

Scroll To Top
0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 StumbleUpon 0 LinkedIn 0 0 Flares ×