≡ Menu

Disable USB Autorun to Save PC from USB Viruses

I know how hard it is to keep a PC safe from viruses and trojans as nearly every USB stick carries some undetectable and auto-multiplying virus. Especially in university, where I have to constantly exchange USB sticks, it becomes hard to keep my USB stick safe and clean.

Mostly the viruses that multiply through USB sticks use the autorun function of USB as it does not require any user confirmation and runs secretly in the background, unlike a CD or DVD.

The best way to keep USB viruses from injecting themselves to your PC or laptop is to Disable the USB Autorun feature and I will teach you how to do it.

  1. Click the Start button, then Run and enter “gpedit.msc” without the quotes
  2. Go to Computer Configuration -> Administrative Templates -> System
  3. Scroll down to “Turn off Autoplay” and double click on it
  4. Click on the “Enabled” radio button, then for “Turn off Autoplay on” select “All drives”


This will now prevent any virus from auto executing itself through a USB drive. Additionaly, it is recommeneded to keep a good free anti virus solution too for additional security e.g. http://www.free-av.com



{ 55 comments… add one }
  • Cold Fire March 18, 2008, 3:23 am

    Nice permanent way!

    or just keep holding Shift when u insert a USB disk? it cancels the autorun 😀

  • Nicholas Francis March 18, 2008, 10:08 am

    I found this post to be useful, so I linked it in my blog


  • Jignesh March 18, 2008, 11:46 am

    Hey Good found thankx 😉

  • MBC March 18, 2008, 8:24 pm

    Thank you very much. I alwasy fear to put my USB stick on university computers but now I can do it safely without fear.

  • Madhur Kapoor March 19, 2008, 3:00 am

    In hostels, it is very important the disable Autorun as the main culprit of virus infection is the autorun.inf file.

  • Ashfame March 21, 2008, 11:24 pm

    Hey DJ
    gpedit.msc is not available in WinXP home edition. So I wrote about how to disable it from registry.
    Pingback should appear on this page automatically.

  • Dj Flush March 21, 2008, 11:59 pm

    Thanks for that AshFame. Probably someone on WinXP Home Edition can make use of it.

  • Syahid A. March 24, 2008, 3:05 pm

    Just what many of us needs to do. Cool tip indeed.

  • John April 4, 2008, 9:58 am

    How do I do it if step no.1 does not work, I click the start button, clicked on run and typed gpedit.msc and the computer said that there was no file, is there an alternate way to turn it off?

  • Dj Flush April 6, 2008, 12:25 pm


    I assume you are Windows XP Home. Please use this guide to get the hack working.


  • Sumit April 22, 2008, 1:00 am

    Thanx yaar. I really needed it as I use it in university pcs and in cafes too.

  • Zeeshan Shakeel June 10, 2008, 1:48 pm

    it really is worth disabling USB autorun, thanks a lot

  • nononono July 11, 2008, 5:27 am

    no, it’s not working!
    this method only prevents launching the virus when the usb storage is inserted. thats it.

    but when you double-click on drive letter of usb flash, autorun.inf then runs, and the virus is launched.

    • yammy February 26, 2010, 5:25 am

      don't double click the USB icon, right click and select EXPLORE
      remove the autorun.inf file from the USB drive:
      run COMMAND
      use DOS command to navigate to the usb drive,
      type attrib -R -H -S *.*
      delete autorun.inf file and any suspiscous exe file(s) and scr file(s)

  • Anoony July 26, 2008, 9:00 pm

    A friend suggested me to remove the autorun.inf completely, will it help?

  • REnthals August 21, 2008, 3:45 pm

    heya thank u very very mch coz i have new USB and it is with too much male wares wich are continuosly auto multiplying them self hope ke this trick will work…!thanks again..!

  • Ron Flowerday December 2, 2008, 3:05 am

    Provide solution to disable autorun for windows XP (PRO) with SP3

    XP SP2 fix refers to
    “Under Computer Configuration, expand Administrative Templates, and then click System”

    System does not exist in SP3

  • Faisal December 14, 2008, 12:02 pm


    thats what i was looking for

  • Michael January 23, 2009, 11:17 am

    thanx a lot… it so helpful

  • Uncle Mart January 28, 2009, 3:27 am

    There is a difference between Autorun and Autoplay. This will explain how to turn off Autorun http://www.raymond.cc/blog/archives/2008/04/22/stop-windows-from-executing-instructions-found-in-autoruninf/

  • zplits February 4, 2009, 9:55 am

    Hey, thanks for this great info. Lots of people will benefit from this, most especially now a days, when malwares are surprisingly so easy to propagate.

  • aryo February 4, 2009, 11:30 pm

    thank you for your sharing…
    it works… 🙂

  • Scud March 27, 2009, 5:29 am

    If System template is missing, right click on “Administrative templates”, select “Add/Remove templates…”, then click on Add, choose System.adm, click on Open, then close. Now you’ll see System under Administrative templates.

  • feline July 6, 2009, 10:14 am

    create autorun.inf folder on your usb drive, so the virus wont be able to replace it with a autorun.inf file

  • Dihan August 1, 2009, 6:58 am

    Thank you. Anyone can tell me how to open a USB device without running autorun.inf?

  • enolaicepz August 7, 2009, 1:30 am

    i can't open gpedit.msc in our computer it say's
    “You do not have permission to perform this operation”
    “Access is denied”

  • enolaicepz August 7, 2009, 6:30 am

    i can't open gpedit.msc in our computer it say's
    “You do not have permission to perform this operation”
    “Access is denied”

  • Beijing Hotels December 3, 2009, 5:14 am

    Interesting post. I have made a twitter post about this. Others no doubt will like it like I did.

  • raheel khan December 23, 2009, 5:00 am

    this is a good article

  • bz February 1, 2010, 3:27 pm

    thanks dude! very helpful.. ^__^V

  • bz February 1, 2010, 8:27 pm

    thanks dude! very helpful.. ^__^V

  • cam777 March 2, 2010, 2:37 pm

    Why microsoft created Autorun?
    Is it useful?

  • abdulhameeddaudpota March 8, 2010, 10:41 am

    Thanks for share this important point.

  • ijstyles March 11, 2010, 7:10 am

    Hi, thanks so much for this quick guide. Really useful.

  • ijstyles March 11, 2010, 12:10 pm

    Hi, thanks so much for this quick guide. Really useful.

  • panlesio April 26, 2010, 7:52 am

    gpedit.msc can not be find in my PC, why?
    is there any other way to Computer Configuration -> Administrative Templates -> System

  • Fred Holmes May 30, 2010, 12:47 am

    I don't find the tree specified above in Win XP. Nor do I find the particular setting by just hunting around for it in the gpedit.msc (Group Policy) dialog.

    Fred Holmes

  • Fowra June 1, 2010, 10:24 pm

    very good.

  • Remove Spyware June 18, 2010, 12:12 pm

    Great sharing! I'm always annoyed with USB autorun virus!!!

    • coaching and mentoring August 4, 2010, 8:25 pm

      Browsing on Google for something else closely connected, regardless before i ramble on too much i would just like to state how much I cherished your post, I've added your web blog and also obtained your Feed, Again thank you very much for the article carry on the good work.

  • Nospam October 4, 2010, 8:52 am

    You should state which operating system this applies to. I have XP-Pro and there is no section called Turn Off Autoplay under Computer Configuration -> Administrative Templates -> System

  • Sumith Harshan March 8, 2011, 6:44 am

    good & crear tip.thanks

  • Kristof_kristof May 6, 2011, 8:35 pm

    thanks for the hint


  • Anonymous May 31, 2011, 4:35 pm

    Computer viruses can spread from USB Drive.

  • Anonymous June 3, 2011, 2:54 pm

    Thanks for your article! It’s very helpful for me!

  • Mohanad Alzare July 22, 2011, 3:10 pm

    nice , but there is another way using registry and more secure

  • Anonymous August 12, 2011, 8:00 am

    This is a good method!

  • Anonymous August 13, 2011, 3:43 am

    Oh !   thank you for telling me this information!

  • Максим Баранник December 5, 2011, 11:36 pm

    To stop USB virus- 1 unmount HDD, 2 turn on view of hidden files, 3 mount usb drive and check it. How to do it? Top secret! http://safe-comp.net/

  • engagement rings April 10, 2012, 1:18 pm

     I alwasy fear to put my USB stick on university computers thank you for your information,

Leave a Comment