# Solved: How To Make Flash Drive Start .bat Upon Plugin



## mangatrekkie (Feb 22, 2012)

Does anyone know how to make a flash drive launch a program, in this case a .bat file launch immediately upon being plugged in? If so, can you please put easy copy and paste instructions down. I've looked online but none of these tips have worked so far.


----------



## Ent (Apr 11, 2009)

In principle the way to do that is with an autorun.inf file on the root of the flash drive. 
It's a simple text file that you can create in notepad, and name autorun.inf (not autorun.inf.txt!).
The first line should be 
[Autorun]
Followed by the instructions.

That won't always work however; modern versions of Windows would only include batch file in the menu of possible actions when you plug the device in, and some people even opt to disable the facility completely for greater security. (After all, the same facility is only too easily abused by malware intending to infect the machine)


----------



## mangatrekkie (Feb 22, 2012)

I have tried the autorun.inf thing, but always on Windows 7. Is that the problem?


----------



## Ent (Apr 11, 2009)

Yes. As you can imagine, giving anything the power to execute on its own and without human intervention is an awfully good way to spread malware, so from Vista on they've been tightening up on such things. I have a vague memory that they'll still let CD autorun work (it being seen as harder for malware to infect a CD) but block the same facility on Flash drives.

I don't know of any other techniques for doing what you're after.


----------



## mangatrekkie (Feb 22, 2012)

OK sounds good. Thanks!


----------



## loserOlimbs (Jun 19, 2004)

As Ent said, there are some definite security concerns with autorun. I disable it on all my systems and 7 does by default now too.


----------

