How To Remove Virus From Any Drive Using Command Prompt (CMD) In Windows 10

How To Remove Virus From Any Drive Using Command Prompt

How To Remove Virus From Any Drive Using Command Prompt

For starters a virus is a self- replicating computer program that infects your computer. These viruses are a menace and can spread across multiple computers via USB/flash drives, external media and other means. As we all know, there is a multitude of anti-virus software. To our dismay, not all of them can do the trick. Sometimes, even your antivirus can fail to detect some sort of viruses. Well, in such case, CMD prompt may be the solution to help you solve the virus issues. Most of us grapple with viruses like Autorun.inf, newfolder.exe, ravmon.exe, svchost.exe etc. They usually present themselves as files and sometimes they can even be files hidden from you.

To remove a virus using CMD, we shall use a CMD known as “attrib” command. Therefore first we have an obligation to know a few basics of the attrib command.

– represents the read only attribute of a file or folder. Read only means the file can’t be written or executed.

H – H stands for the hidden attribute.

A – Similarly A stands for Archiving and this prepares a file for archiving.

S – This attribute changes the selected files or folders in a system file from a user file by assigning the “system” attribute of that particular file.

Here we have the “attrib” syntax à ATTRIB{+attribute/-attribute}{pathname}[/S[/D]}

And with the above command there are different parameters and switches so lets see what they are.

+/- à to enact or to cancel the specified attribute.

à include any process folder.

à   searching through the entire path. Sub-folders inclusive.

Attribute à ( already explained above)

Pathnameà path where target folder is located.

This here is the proper syntax for the attribute command:

After knowing all of the basics, now let’s give it a shot and try to see how we can remove a virus from  USB, SD card etc.  using CMD prompt.

For example, let’s transfer an autorun.inf virus from my USB to my D drive and delete the virus from the D drive.

Step 1. Open command prompt from search and run as administrator.


Step 2. Type D and hit enter


Step 3. Type “attrib” and press enter. This command lists out all files inside the current drive and you will clearly see autorun.inf virus listed.


Step 4. At this stage to remove the virus using CMD, type into command prompt “attrib –r –a –s –h . “ And press enter. This in turn will remove the read only, archive, system and hidden file attribute from all the files.

-r is for removing read only files

-a is for removing the archive file

-s is for removing system file

-h is for removing hidden file

. is for files with all different types of file extensions.


Keep in mind that this command only removes the different attributes from different files. However, the files will still exist. And therefore we must delete the virus permanently. To delete the virus, type “delete autorun.inf” and press enter. The file will get deleted from the current drive immediately.

Delete virus using CMD

Access your windows apps and data remotely on any device(PC/Mac/android/iOS) in a safe & secured environment by loading them Cloud Citrix VDI available at an affordable citrix xendesktop cost with add-ons such as Cloud QuickBooks Hosting and SharePoint Hosting from Apps4Rent.

I hope this guide was informative to you. Your feedback is gladly appreciated. Please leave us a comment in the comments section if you have any other tips and tricks you want to share with us.


Leave a Reply
  1. I love your blog.. very nice colors & theme. Did you design this
    website yourself or did you hire someone to do it for you?
    Plz respond as I’m looking to construct my own blog and would like to find out where u got this from.


  2. An interesting discussion is definitely worth comment. There’s no
    doubt that that you should publish more on this issue, it might not be a taboo matter but generally people do not talk about these issues.
    To the next! Best wishes!!

  3. Excellent pieces. Keep posting such kind of info on your blog.
    Im really impressed by it.
    Hello there, You’ve performed a great job.
    I will certainly digg it and in my view recommend to my friends.
    I am sure they’ll be benefited from this web site.

  4. I drop a leave a response each time I appreciate a post on a site or if
    I have something to add to the discussion. Usually it’s a result
    of the fire communicated in the article I read.
    And on this article How To Remove Virus From Any Drive Using Command Prompt (CMD) In Windows 10.
    I was actually excited enough to drop a comment 🙂 I actually do have 2 questions for you
    if you do not mind. Is it just me or does it look
    like like a few of the comments come across like they are
    written by brain dead visitors? 😛 And, if you are writing at additional
    online sites, I’d like to keep up with you. Could you list every one of your communal pages like your
    Facebook page, twitter feed, or linkedin profile?

    Here is my blog

  5. After looking at a handful of the articles on your
    blog, I honestly like your way of blogging. I added it to my bookmark site list and will be checking back soon. Take a look at
    my web site too and let me know your opinion.

  6. Right here is the right web site for anybody who really wants to find out about this topic.
    You realize so much its almost tough to argue with you
    (not that I personally would want to?HaHa). You definitely put
    a brand new spin on a topic which has been discussed for decades.
    Excellent stuff, just excellent!

    My web-site KetoBHB Plus

  7. Ι simply coulԀ not go away your websitе ƅefore suggesting that I eⲭtremely enjoүed tthe standard informаtion a person provide to your
    gսests? Is gonna bе again steadily to inspedt new

  8. I’d like to thank you for the efforts you’ve put in penning this blog.

    I’m hoping to view the same high-grade blog posts from you in the future
    as well. In fact, your creative writing abilities has motivated me to get
    my own, personal blog now 😉

  9. I’ve been absent for a while, but now I remember why I used to
    love this site. Thank you, I will try and check back more frequently.

    How frequently you update your website?

    Also visit my site :: Ann

  10. Good ? I should certainly pronounce, impressed with your
    web site. I had no trouble navigating through all tabs as well as related information ended up being
    truly easy to do to access. I recently found what I hoped for before you know it in the
    least. Quite unusual. Is likely to appreciate it for those who add forums or something, website theme .
    a tones way for your customer to communicate. Nice task.

    Here is my web blog :: Keto Fat Burner

  11. My brother suggested I would possibly like this website.
    He used to be totally right. This post actually made my day.
    You can not consider simply how a lot time I had spent for this info!
    Thank you!

    Here is my web blog; Anastasia

  12. Great ? I should definitely pronounce, impressed with your web site.
    I had no trouble navigating through all the tabs and related info ended up being truly simple to do to access.
    I recently found what I hoped for before you know it at all.
    Reasonably unusual. Is likely to appreciate it for those
    who add forums or anything, web site theme .
    a tones way for your client to communicate. Excellent task.

    Look into my page Keto Fat Burn Pills

  13. I’ve been exploring for a little bit for any high quality articles
    or blog posts on this kind of house . Exploring in Yahoo I finally stumbled upon this web
    site. Reading this info So i am happy to convey that
    I’ve an incredibly just right uncanny feeling I discovered exactly what I needed.
    I so much surely will make sure to don’t fail to remember this web site
    and give it a look regularly.

    Here is my site Live Well CBD Reviews

Leave a Reply

Your email address will not be published.

UMi Diamond 4G

UMi Diamond 4G Specification And Price – Is It A Budget Smartphone?


12 Amazing Google Assistant Tips And Tricks You Should Try