Solved

Enabling Autorun on USB flash Drive

Posted on 2004-04-14
23
105,290 Views
Last Modified: 2012-06-21
    How do I automatically execute a program when a usb pen drive is  plugged into the PC.  I cannot install any software on the machine before plugging in the usb drive.  
0
Comment
Question by:d_hari
23 Comments
 
LVL 69

Accepted Solution

by:
Callandor earned 300 total points
ID: 10825838
Are you asking if you can automatically run a program when you insert a USB pen drive, like when you insert a cd?  I don't think pen drives are set up to behave like regular bootable devices, and I have never seen or read about anyone being able to accomplish this.  You can boot from a USB external drive, but not a pen drive.

05/02/2006 update: this is possible and articles have been posted describing how to do it.  See http:#16592995
0
 
LVL 4

Expert Comment

by:freshair
ID: 10827806
put a file "autorun.inf" in your pen drive and type in the file path of the executable you want. I haven't tested it that works or not, but it won't hurt to give it a shot.

gl!
0
 
LVL 3

Expert Comment

by:Timotheus1
ID: 10828176
your best bet is to copy the autorun.inf file from a CD-Rom and put it in the root folder on the pen drive. you will need to modify the INI file to point to the program on the pen drive. I have used this method to assign custom icons to a specific hard drive partition.

Most Windows 2000/XP computers should be able to access the pen drive as soon as it is plugged in, no drivers will be required
0
 
LVL 2

Assisted Solution

by:ElForesto
ElForesto earned 200 total points
ID: 10828667
In order for autorun.inf to work, the drive in question must support auto-insert notification. In other words, it needs to tell Windows explicitly "I have newly inserted media". To the best of my knowledge, flash-memory drives such as that USB thumbdrive do not support such a thing.
0
 

Expert Comment

by:tfloto
ID: 11033592
I tried the Auto run with a SansDisk Minicruzer and it did not work. So I wasn't able to get "plug and run" functionality. I wrote a little routine in VC++ that detects when you plug a USB flash in, then finds, parses and executes the autorun.inf file. but this means you need such a program already installed on your PC.
0
 

Expert Comment

by:snowyow1
ID: 11067886
And may we have a look at this code sample?
0
 

Expert Comment

by:codecraig
ID: 11655767
yes, I would be interested in see this code, can you post it, or email it to <Removed by Community Support>

Thanks.
0
 
LVL 1

Expert Comment

by:digloo
ID: 11658475
Some study of the info at MS' site indicates that there's are a couple of flags buried deep inside of the OS that need to be changed so that when the driver loads up, it says it's a certain kind of device.  The USB drivers are normal HDD drivers, and normal HDDs aren't like this.

I'd like to know what some thumb drive vendors have done with their device IDs to fool the OS into thinking they're like that.  They probably say they're rewritable CDs or something like that, rather than HDDs.

Anyway, I'd like to get a copy of this code and the exe also.  (digloo at yahoo dot com)

Thanks
-David
0
 

Expert Comment

by:codecraig
ID: 11662210
i found a company who makes USB drives, and has a small utilitiy to make the USB drive run with autorun:

http://www.universalsmartdrive.net/standard/downloads.htm

wish i could see the code, or i wonder if the program works with any other usb drive...

0
 

Expert Comment

by:gmcfry
ID: 11704769
The responses from Callandor and ElForesto are not accepted answers.  I do no know who accepted them, not me.  The accepted answer to this question is CODECRAIG.

Comment from codecraig
Date: 07/28/2004 06:46PM EDT
 Comment  


i found a company who makes USB drives, and has a small utilitiy to make the USB drive run with autorun:

http://www.universalsmartdrive.net/standard/downloads.htm

wish i could see the code, or i wonder if the program works with any other usb drive...
0
 
LVL 69

Expert Comment

by:Callandor
ID: 11711860
gmcfry,

Since you didn't ask this question, it's not surprising that you didn't accept the answers.  Why do you think you can accept an answer for someone else?  Isn't it up to them?  Something may have worked for you, but that doesn't mean it's a solution for everyone.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:codecraig
ID: 11711935
..has anyone found a solution for this??  anyone have any "autorun" code or anything??

thanks.
craig
0
 
LVL 1

Expert Comment

by:digloo
ID: 11712581
Callendor said: "Since you didn't ask this question, it's not surprising that you didn't accept the answers.  Why do you think you can accept an answer for someone else?  Isn't it up to them?  Something may have worked for you, but that doesn't mean it's a solution for everyone."  I think you missed the point.

While I'm not totally familiar with the way this forum works or who gets to denote comments as "Accepted" or whatever, I would guess that a message that says it is the "Accepted Answer" is intended to convey some kind of authority, as if it's a "correct" answer.  In this case, the (previous) "Accepted Answer" was absolutely NOT correct.  It seems to have changed to one that is a bit closer to the truth, but it's still not correct.  If you want the "truth", head on over to the Microsoft Knowledge Base and find out what it has to say.

In a nutshell, USB devices are plug-n-play devices, which means that they announce to the OS what sort of device they are when they're plugged in and what features they support.  USB Storage devices tend to announce that they're ESDI drives.  I don't know why this is, but they could just as easily say they're Zip drives, CDs, or some other kind of REAL removeable storage.  The OS has a palette of settings that it loads up based on the settings for the various devices, and ESDI devices are basically NOT considered "removeable" by the OS.  (They ARE "bootable", however, which is a totally un-related subject.)  

According to the MSKB, you can run a program that flips some bits in the device driver telling the OS that the device IS removeable, and that it should enable auto-seeking for an autorun.* file upon insertion of a new media.  Short of that, the only other way that seems you can get an autorun.* file to execute when you insert a USB storage device is if that storage device tells the OS that it's something other than an ESDI drive.  That's something that is in exclusive control of the manufacturer of the device; it's not a user-settable option.

That said, I visited the site referred above (universalsmartdrive.com) and downloaded the x-autorun.exe file.  When I tried to install it, I got an error saying it's not a valid executable -- it's apparently corrupted.  Does anybody have a copy that works?

-David
0
 
LVL 69

Expert Comment

by:Callandor
ID: 11714701
If anyone disagrees with the accepted solution (which the asker determines), they can post in Community Support and protest.  The requirement is that they have to show that they had the correct solution.  As far as I can see, no one got this to work, but I'm not against someone finding a solution that does work.  Everyone benefits if that happens, and our knowledge base is increased.
0
 

Expert Comment

by:iatricjb
ID: 11790153
Here's a whole other approach that some vendor claims works:  http://www.hsc-us.com/consumer/usb_flashdrive/UDRW.html
0
 

Expert Comment

by:GB05
ID: 13029036
I'd like to get a copy of this code and the exe also...


<Email address removed by Community Support>
0
 

Expert Comment

by:Welltech-IT
ID: 13734112
The company that makes the drive indicated by iatricjb has the autorun feature available for download here - http://www.udrw.com/download/udrun.EXE
When you run the program it creates a folder in the same directory it was run from, the readme file has installation instructions but the program will only install under Win98 & ME.

Has anyone else found an answer to this yet? I would prefer not to have to find a specific drive to accomplish this task.
0
 
LVL 1

Expert Comment

by:daverb70
ID: 14025895
Sorry to resurrect an oldish thread, but, er, me too!!  Has anyone got a solution or is it just not the way these things are meant to work?  I could see there being security implications that later MS OS's may not like.

Dave
0
 
LVL 1

Expert Comment

by:digloo
ID: 14028582
The question is, do you want to have to install a driver first in order to enable auto-run?  Lexar makes a USB drive called "The Traveller" or something like that that comes with software that lets you enable auto-run (they call it "auto-pop" for some goofy reason), but ... you have to install it on the machine FIRST.  The UDRW drive is designed to "announce" itself as TWO separate and distinct devices: one is a regular USB drive, which in fact is defined as a common ESDI removeable device that all USB drives use; the other is a CD-RW drive.  It's the second one that enables auto-run WITHOUThaving to pre-install anything on a machine.  Microsoft might some day add auto-run to ESDI device insertions as a feature to Longhorn or a later OS, but it's a long way off and not something that's likely to get a lot of attention in the press.
0
 
LVL 1

Expert Comment

by:daverb70
ID: 14035855
The answer to your question is No, the idea is to send out a promotional movie on a USB thumbdrive.  When recipient inserts USB drive, movie auto plays.

I don't think it can be done, but we have found a company who claim they can do it. We have to order a load of drives though, and they will preinstall for us.

I tried the MS application and it created autorun.inf and said it had copied other files onto the device.  I noted an exe and it was ref'd in the autorun.inf so I copied my own exe onto it and edited autorun.inf.  Now, on XP I am prompted to browse the files or run the application -- selecting the latter runs my EXE.  So its not really autorun -- user is asked what they want to do.  I could not get it to do anything on win 2000 - keeps telling me the disk is not formatted would i like to format it?  I tried formatting, but that failed also.  It is formatted fine on the XP box.  God knows what would happen if you stuck it in a Mac.
0
 

Expert Comment

by:vinsont
ID: 14407149
I don't have and answer but I do have some very interesting information. I created a autorun.inf to backup file on the c: drive to the thumb drive. I made to copies on on a Lexar 512 Jump Drive and one on a Apacer 64 Flash dirve. The Lexar drive works great. You plug it in the autorun kicks off and the files are backed up. However the 64 Flash Apacer doesn't work.

The only thing I see different is the Lexar doesn't show up as removable. They are both formated FAT32 and both partians are marked active.

Maybe this will let people know that autorun can be kicked off from a thumb drive, I just don't know how I did it.

Tommy
0
 

Expert Comment

by:cozofdeath
ID: 14893445
You can do it with a simple autorun file. Open notepad copy the below statement, save the file in your root USB directory with the filename "autorun.inf" and make sure you change the setup.exe to your program path and name that you want to run.

[Autorun]
open=setup.exe

or

[autorun]
shellexecute=setup.exe

Visit this address for all the autorun commands, its fairly simple and there is much more you can do.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/autorun/autoplay_cmds.asp

Or
http://www.phdcc.com/shellrun/autorun.htm
for many many more options

As for booting, this should help someone out
http://www.microsoft.com/whdc/device/storage/usb-boot.mspx
About half-way down the page is the real information
0
 
LVL 69

Expert Comment

by:Callandor
ID: 16592995
Some newer information has been published that describes how to make a bootable USB key: http://www.tomshardware.com/2005/09/09/windows_in_your_pocket/index.html
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Sometimes the best way to deal with an infected computer is to boot from external media and run your tools from there.  The reason you may wish to do this really depends on the infection.  Some malware is so recalcitrant that no matter what you do i…
This article is an update and follow-up of my previous article:   Storage 101: common concepts in the IT enterprise storage This time, I expand on more frequently used storage concepts.
This video teaches viewers how to encrypt an external drive that requires a password to read and edit the drive. All tasks are done in Disk Utility. Plug in the external drive you wish to encrypt: Make sure all previous data on the drive has been …
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now