in reply to USB Drive Letter Assignment in Win32

Errr, this is a stab in the dark, but I'd be curious to know the answer to this anyway if anyone knows.

Does the autorun "feature" only work on CDs? If not, why not use autorun to start whatever you're trying to do rather than have a service listening?

That way you wouldn't need the service in the first place. Or would you? Not being a Windows dev person I have absolutely no idea, but I can immediately think of a couple of practical applications for this if it's possible.

cLive ;-)

  • Comment on Re: USB Drive Letter Assignment in Win32

Replies are listed 'Best First'.
Re: USB Drive Letter Assignment in Win32
by Abigail-II (Bishop) on Jun 07, 2004 at 09:48 UTC
    Oh, yes, there's autorun for USB devices. You may want to disable that feature.

    Abigail

Re^2: USB Drive Letter Assignment in Win32
by robot_tourist (Hermit) on Jun 07, 2004 at 08:40 UTC

    Slightly off-topic, unless the script will be used in the wild.

    Autorun with USB media sounds excellently geeky, like arstechnica.com's recent USB drive comparison where they made a RAID 0 drive with two different USB drives on OSX :) However, I like many people, have turned off autorun, and I can't even remember how to turn it back on! This stops weird things happening when you insert music CDs which also have videos and you don't have to wait for some install interface to appear when you only want to find one particular file on a software CD.

    How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.

    Robot Tourist, by Ten Benson

Re^2: USB Drive Letter Assignment in Win32
by inman (Curate) on Jun 07, 2004 at 10:25 UTC
    Yes it does! Add a file called autorun.inf to the root of the USB drive and reference an executable that you want to run. Autorun however only happens when the USB drive is inserted and the machine is logged on. The autorun feature can also be switched off by the user. These restrictions may limit the use of this feature to answer your problem.

    autorun.inf

    [autorun] open=perl.exe auotorun.pl

    Out of interest, you could actually copy a Perl installation onto the USB drive and use that to run the script. This would be particularly useful for doing machine audits. You just turn up, insert the USB drive. The autorun feature starts the Perl script which collects the audit information. The only thing that I haven't figured out is how to programatically unmount the USB drive once you are done.