Link to home
Start Free TrialLog in
Avatar of TSFLLC
TSFLLC

asked on

Autorun on a USB drive

I've created a VB.NET executable to run on a USB stick.  Below is my autorun.inf.

[autorun]
open=BiltUSB.exe
action=Run Peterbilt USB Application
icon=BiltUSB.exe

I delivered the end product to the customer, expecting to be finished with this only to have a variety of issues.
I got him to reset to default each of the entries under the USB's properties....which apparently means 'Prompt me each time to choose an action'.
With his computer, the default form that displays refers to it wanting to open Pictures (I do have pdf files in a subfolder).  And my 'action' entry above does not display in his action list.  He goes to another computer it displays properly.  He goes to another computer and it does the same thing it did on the first computer.

If you have an autorun.inf at the ROOT of the drive, why would it not AUTOMATICALLY run the autorun.inf????  Provided the settings were to prompt each time.  Just another ideosynch from Microsoft??  Or am I missing something??

Sincerely,
Phil Tate
Avatar of CombatGold1
CombatGold1

Whether or not removable media can make use of the AutoRun feature depends on what settings are defined on your computer. It is not uncommon for AutoRun to be disallowed especially on computers in corporate networks, as it is really a gigantic security risk.

Windows 7 has completely removed the ability to specify an OPEN option in the autorun.inf file for USB media, which is likely to be the cause of your problem. CD's and DVD's can still open a program with AutoRun though.

Further information:
http://blogs.technet.com/b/srd/archive/2009/04/28/autorun-changes-in-windows-7.aspx
http://www.samlogic.net/articles/autorun-usb-flash-drive.htm
Avatar of TSFLLC

ASKER

I've already reviewed the samlogic.net article.  I'm aware of the situation with Windows 7...these are not Windows 7 machines.

Regardless of that, if someone clicks on 'AutoPlay' when right-clicking on a USB drive, wouldn't you think it would run the autorun properly?

This set of steps was the tell-all that says it is not working properly at all.  My customer and I have resigned ourselves to the idea that their clients might need to right-click and click AutoPlay to run the app, but where's Microsoft's logic (or some internal settings other than 'Prompt me each time') that would cause my autorun.inf not to display the dialog properly???
Avatar of Dave Baldwin
A recent security update on XP said it was to disable Autorun on everything but CDs and DVDs.
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
> A recent security update on XP said it was to
disable Autorun on everything but CDs and DVDs.

For what it's worth, it wasn't just XP...
see http://support.microsoft.com/KB/971029

KB971029 can be uninstalled from add/remove programs, and the 'don't show me this update again' box checked in windows update, but windows update will then nag you every time telling you there's been a critical update ignored.
Just for your info, AotoPLAY is not the same as AutoRUN:

http://windows.microsoft.com/en-US/windows-vista/Whats-the-difference-between-AutoPlay-and-autorun

http://www.dslreports.com/forum/r21106365-Autorun-vs-Autoplay

http://www.google.com/search?hl=en&source=hp&q=difference+between+autoplay+and+autorun

On computers where various AutoPlay Handlers are set to run on detection of different content types on, AND where AutoRun is still enabled for, removeable drives, the AutoPlay Handler AND the program or file referenced by the "open" command in the autorun.inf will usually launch.

Where AutoRUN has been disabled by a Hotfix, Group Policy, by a tweaking utility, or manually in the registry, the only way you will be able to get your Flash Drive to AutoRun is by messing in the user's registry, or asking them to do so before inserting the Flash Drive.  That is not an acceptable request as far as I am concerned.

To have content on your Flash Drive launched by the AutoPLAY feature of Windows, you would first have to install and register a custom application on their computer as an autoplay handler, or use an existing one that opened (for example) a file with a link to run your program from the Flash Drive:

http://windowsxp.mvps.org/autoplayhandlers.htm

http://msdn.microsoft.com/en-us/library/bb776827(v=vs.85).aspx

In my opinion, the restrictions in place are valid and have been imposed for a very good reason.  Countless thousands of viruses are spread using the AutoRun and AutoPlay features of Windows.
> Just for your info, [...]

Just for "whose" info?   :-)
Yeah, sorry. It was primarily for TSFLLC (Phil Tate) to address the description in his question and follow-on comment which clearly mentions the AutoPlay Handlers dialog as though directly related to the autorun.inf file.
Avatar of TSFLLC

ASKER

Thanks to all who have posted after moderator intervention.

My customer wants this function to work....period.  And having expended major resources on this application and now additional time with this Autorun issue....I'm on board.

That being said....

In reviewing these posts & links, I want to be able to modify the registry entry to enable Autorun.  The post by billprew refers to a Microsoft Fix where Autorun can be disabled/enabled.  I would like to programmatically perform this in a batch file.  The Registry DWORD is 'NoDriveTypeAutoRun'.  However, based on the information in the MS Support article http://support.microsoft.com/kb/967715/ the DWORD value is not the same for ALL operating systems.  GO FIGURE!!  Therefore I would need to identify the operating system and edit the entry accordingly.

I created a file onto my USB stick called freg.bat with the following entry:

regedit.exe /s FReg.reg

I also created the FReg.reg file shown above with the following entries:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoDriveTypeAutoRun"=dword:00000091

When I double-click on the file freg.bat located on the stick I assumed it would run with no problem.  It didn't.  I attempted it from the Command Prompt after changing to the appropriate drive letter and the image included contains the error I received.  I created a screen image because of the character in front of the 'r'.

When I type:  regedit.exe /s FReg.reg
It works fine.  Apparently there is issue with batch file/regedit inclusion I don't know about.
prompt.jpg
Why don't you put it on a CD?  I would take offense that you are trying to get around the security setup on my computer.  If I knew about it.
Avatar of TSFLLC

ASKER

Content can/will regularly be changed on each USB stick.  It is the responsibility of the user to keep their stick.  CDs are not an option.
Avatar of TSFLLC

ASKER

Given the simplicity of using a CD, I would have already gone that direction....
Then put the install on a CD and use the USB just to transfer data... ??
Avatar of TSFLLC

ASKER

Dave,

The user is a customer of a customer.  Most barely know how to turn on a computer.  That being the case, it has to be automated with the least amount of effort on their part.  Since my customer lowballed me on this job (and I needed the job severely last month), and the application is completed and flawless, I really don't want to put any more effort into it.

This one has left a bad taste in my mount.  However, if this option doesn't work, I'll look at that.  It would definitely resolve the removable drive autorun issue altogether.

Thanks.
Avatar of TSFLLC

ASKER

Sorry, guys.  Ignore my issue with not being able to run the registry change batch file I posted.  I resolved the problem.  Think I had a misspelling associated with the reg file.  Because I was using the /S it didn't inform me there was a problem with the file name.

I will give new files to my customer for their testing with different PCs.
Did you redirect an echo to create the files on the USB stick, use edlin, or what?

Building the files manually (in notepad, copy/pasted from your message above) works fine running from a USB stick on an XP machine, here.

Autorun-FReg-batch.png
Guess I should have hit refresh before posting.
Avatar of TSFLLC

ASKER

Thanks Darr247...
Avatar of TSFLLC

ASKER

A subsequent posting in the link provided by billprew was good information for problem resolution.

http://support.microsoft.com/kb/967715/