1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

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

Discussion in 'Software Development' started by mangatrekkie, Jul 14, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. mangatrekkie

    mangatrekkie Thread Starter

    Joined:
    Feb 21, 2012
    Messages:
    186
    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.
     
  2. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    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)
     
  3. mangatrekkie

    mangatrekkie Thread Starter

    Joined:
    Feb 21, 2012
    Messages:
    186
    I have tried the autorun.inf thing, but always on Windows 7. Is that the problem?
     
  4. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    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.
     
  5. mangatrekkie

    mangatrekkie Thread Starter

    Joined:
    Feb 21, 2012
    Messages:
    186
    OK sounds good. Thanks!
     
  6. loserOlimbs

    loserOlimbs

    Joined:
    Jun 19, 2004
    Messages:
    7,800
    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.
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1061036