Run application when USB connected to PC

hi, is there possible to run application when USB connected to PC?
I used spark dongle usb, when I plug the usb into PC then my application run.
There any code for activate this case?


Ahhh, that’s something I’ve been always wanting to do. But unfortunately, for security reasons in Windows7 you’re not allowed to do that. Previously, in XP this thing was hackers/virus coders best toy - Autorun.inf was the kid in the block - it’s a file that you could create, in a usb stick (or cd/dvd) in it, you write what you want to execute (exe) upon the insertion of the usb stick/cd/dvd

Don’t get confused with the “autoplay” feature - that’s different, you don’t want that.

However ‘theoretically’, autorun.inf files in CDs/DVDs are allowed to run stuff, even in Windows7 - So, if you could trick the operating system to think that your usb stick is a cd/dvd, you’re all set! See my question here.

There is a special type of usb sticks, if I’m not mistaken, it’s the U3, the OS treats it as a cd/dvd! See.

I don’t know if Microsoft added more security, so that even cds/dvds are not allowed to execute exe files, but last time I checked this should be possible.

Btw I’m talking Windows7 cause that’s all I use Windows-wise, I bet it’s the same thing on Vista and Windows8.

You could do the opposite if you want (I did that) - i.e. sniffing data/files from a usb, upon its insertion.

EDIT: It seems that you can’t do it, even with a U3! A lot of hacks have been patched, like. So maybe you can’t do anything anymore, if MS keeps patching.

EDIT: I was talking all the time assuming you wanna do this without a Windows confirmation (autorun).
If you’re OK with a confirmation prompt (autoplay), you could use DefaultProgramEditor to add custom autoplay options - But make sure you first enable autoplay in your system by going: Start | Run | gpedit.msc

And just follow along as in the picture below, make sure that TurnOffAutoplay is disabled.

Then as I told you, use DefaultProgramEditor to add some options to the menu:


EDIT: if you’re wondering how I changed my usb icon and the label “Vexe”, you could do it via an autorun.inf file, in fact, changing the label and the icon are probably the only things that you could do with an autorun file.

Create one, “autorun.inf” and write:


The icon could be any file, not restricted to being a jpg.