How To Auto-Launch Apps With A USB Stick [Windows]

Ryan Dube 22-09-2011

auto launch usb appImagine having a USB stick with all of your favorite apps on it. Maybe a collection of PC troubleshooting utilities if you’re an IT tech, or maybe an assortment of spreadsheet and word processing tools if you’re an executive road warrior. Wouldn’t it be pretty sweet if you could just walk up to any computer, put your USB memory card into the USB port, and have your favorite portable apps automatically launch without any effort on your part?


Over the years, system administrators have come up with various tricks to accomplish this task. Tim wrote about a few useful ways that people use Windows Task Scheduler Run Programs Automatically Using Windows Task Scheduler Read More to launch various jobs, and Varun covered a series of useful USB apps 3 Awesome Tools to Add More Functionality to Your USB Drives [Windows] Read More that can come in handy. In this article, I’m going to cover a few USB auto-launch techniques that administrators have used. You might have been told that it’s impossible to auto-launch applications on your USB card on your Windows 7 computer. I’m here to show you that it is not true.

How You Used to Auto-Launch USB Apps

For years, at least since Windows 2000, but probably even earlier, system administrators have used the autorun.inf technique to autostart applications on a USB memory stick just like the autorun feature worked on computer CDs.

The autorun.inf file could be as complicated or as simple as you liked. The simplest form was as follows:

action=Click “OK” to start your apps!

All you would need is the icon image and the batch job available, and the moment you inserted your USB stick into a computer running an OS like Windows XP, you would see the following options automatically pop up.

auto launch usb app


Just click OK and you’re good to go. You can launch a batch job that starts all of the apps that you want, and you essentially have a customized way to open up all of your apps in an automated way that saves a lot of time.

This was somewhat limiting, because you had that pop-up prompt. I’ve heard that there were ways to get around the pop-up that involved a little bit of tweaking/hacking, but in doing so you introduce the ability to hack any computer with some virus simply by inserting a USB stick. Microsoft caught on to this in Windows 7 and completely disabled the USB functionality of autorun.inf in that operating system. Future updates of Windows XP also disabled that feature. So what’s a system admin to do?

Launching Apps Automatically From Your USB Stick

Well, where there’s a will there’s a way. And yes, there is a way to launch a program just by inserting your USB stick into a Windows 7 PC.

The first thing you’re going to want to do is install AutoIT How to Automate Mundane Tasks with AutoIt Read More , which Guy covered a while back. AutoIT is a very cool scripting language that lets you compile those scripts into exec programs that you can distribute to any PC. The download includes an editor as well as the converter software.


The great thing about AutoIT scripts is that there are lots of brilliant people out there creating scripts for a long list of tasks. The following script is what you use to detect whether a USB stick has been inserted into a port.

$DBT_DEVICEARRIVAL = "0x00008000"
 GUIRegisterMsg($WM_DEVICECHANGE , "MyFunc")
 Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam)
MsgBox(4096, "Info", "My Drive has been Inserted, Backup My Files!")
 While 1
 $GuiMsg = GUIGetMsg()

That script will recognize a “device change”, and for a USB stick it will launch a message box, as shown here.

auto launch usb

Now, think about that. If this script will recognize a USB stick in order to launch a message, then it can be slightly modified to launch a program instead. So, in order to do this, I took the script above and replaced the MsgBox command with the following line:

Run ("F:\System\Apps\ZimWiki\Zim Desktop Wiki\start-zim.cmd")

What this does is senses when I’ve plugged in my USB stick, and then automatically launches the Zim Wiki app I have on my USB stick that I use to organize and monitor my writing work.

auto launch usb

Now we have a way to auto-launch a program just by inserting the USB stick. However, let’s take it a step further and launch a whole collection of apps by launching a batch job on your USB card called startapps.bat that launches all the programs you want for that particular stick.

START - F:\System\Apps\ZimWiki\Zim_Desktop_Wiki\start-zim.cmd

What’s the point of this? The point is that now you can have a unique “startapps.bat” script for various USB sticks. One might be for your school work, in which case you’d open your class webpage, a word processor and maybe a spreadsheet for the class. Another might be for your work as a help desk tech, where it would auto-launch PC support utilities and your favorite tech website (MUO of course).


The only catch is this – the EXE file you create with the AutoIT script has to be running on every PC that you want the auto-launch to occur on. This satisfies the Windows 7 security demands. Just open the AutoIT script above, and compile and build the script to create your EXE file. Put that EXE in the Startup folder of the computers you use most often.

If the script is running, you’ll see the following Icon in the task bar.

auto launch usb app

This setup is great because there’s no prompt at all – just insert your USB stick and all of your required apps will just launch automatically.

Give the script a try and see if you can get this setup working with your own USB stick. Do you like this approach? Any tips for how to improve it? Share your insight in the comments section below.

ramasamy chidambaram

Related topics: Portable App, Programming, USB.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

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

  1. Noel
    December 31, 2018 at 9:15 am

    Hi this is Noel not sure you got my message.
    I need to know if the feature above will work on windows 10.

  2. Leonard
    September 15, 2017 at 6:17 pm

    Nothing is working, stupid.
    Gave up all my hope, again

  3. jee dee beee
    May 10, 2017 at 5:41 pm

    How do i rollback this script after executed?

  4. jdb
    May 10, 2017 at 5:40 pm

    So, when u have installed this script, how exactly do i roll this back?

  5. Christian
    January 9, 2017 at 10:56 am

    do i install the AutoIt on usb or on my computer?

  6. Muzammil Shaikh
    December 30, 2016 at 4:36 pm

    Any help appreciated

  7. Muzammil Shaikh
    December 30, 2016 at 4:33 pm

    Sir I want exactly reverse of this
    I want to run a script from USB when USB is plugged in which will run program which is available on PC
    Plz help me!!!

  8. John Salchichon
    October 16, 2016 at 6:07 am

    I got a USB credit card style from ACP and when you insert it, No pop up window, just it automatically open the "run" window (Win+R), type an URL address and take you to their website. It's really cool.

    So I try this and it work for a while, not perfect but after some try windows asked what I want to do with Media when first insert, I click open files and after that it stop working. I reverse everything and keep trying but no luck. I'm using win10. :)

  9. Dank DDoS
    June 2, 2016 at 12:28 am

    Gr8 m8 i r8 8/8

  10. Anonymous
    January 20, 2016 at 10:05 pm

    It seems to be great method, but the question here, is the software visible or invisible in the USB?

  11. Anonymous
    April 29, 2015 at 1:55 pm

    I copied the exact script, replaced the line with my own, and I still get the popup window.

  12. Mike
    December 12, 2014 at 4:18 pm

    Even though i did this, THe option that comes up is "Play using windows media player"

  13. Kurt A Kruger
    December 4, 2011 at 11:45 pm

    Your auto-start for USB sticks doesn't work. When I plug it in to my computer at home it has a different device letter than at work or at my friends house.

    • Ryan Dube
      December 5, 2011 at 8:01 pm

      Hi Kurt - yes, that is right. You have to be sure to assign the USB with the drive letter you used when you set this up, otherwise you can't use it on different computers. Each new computer you use it on needs to have the USB stick mapped with the same letter. It's one limitation of this technique, but for the sort of use described here (I set it up the same on every PC at home) it works well.

  14. stuart
    September 22, 2011 at 8:03 pm

    Hmm, nice idea. My Father-in-Law wants to make a USB key capable of launching a speech program (as he's blind) on any computer that the key is plugged in to. That way, he can navigate and fix it, using a familiar voice rather than trying blindly to find the built-in Microsoft one. I had thought about UnetBootIn, but scripting may also be an idea. He was a dab hand at Visual Basic believe it or not!

    • Ryan Dube
      September 23, 2011 at 1:56 am

      Visual basic will do it (I love VB). It may be possible to get such a concept working, but it would take more time and effort than I have available...the best I could manage is having a "watchdog" script running that watches for the insertion of a USB script. I'm not sure a USB-only solution is available anymore with the Windows security environment the way it is now.

  15. TC4Drifter
    September 22, 2011 at 6:42 pm

    What if autorun is disabled?

    • DanieL
      September 22, 2011 at 7:12 pm

      This doesn't have to do anything with autorun, this is a program that detects when you plug your usb drive and launches a batch file that opens your applications.

      • Ryan Dube
        September 23, 2011 at 1:53 am

        Daniel's right - it's an alternative method to using autorun, since autorun doesn't work for USB on Windows 7.

        • younes
          June 2, 2016 at 11:19 am

          can you give me the methode with vb or c# please ?