Open folder in same window from autorun file

I'm wondering how I can open a folder from an autorun file from a flash drive. I have it working right now, however when you double click the icon, it opens the folder in a new window. I would like it to do something similar to the: right click > open command.

Attached is my current autorun.inf
[autorun]
icon=.\VolumeIcon.icns

shellexecute="Programs\Shortcuts\"
action=View Programs

shell\verb=View Flash Drive
shell\verb\command="explorer.exe \"

[content]
MusicFiles=false
PictureFiles=false
VideoFiles=false

Open in new window

LVL 5
bswinnertonAsked:
Who is Participating?
 
jostranderConnect With a Mentor Commented:
This took some trickery, but I got it working for me.

Notes:
1) If you've already mounted the drive once, Windows may cache your existing autorun info.  So any changes may not even take effect.  To remove the cached entry, go to:
HKEY_CURRENT_USER\Softwre\Microsoft\Windows\CurrentVersion\Explorer\MountPoints
Find the entry for your mount (be it flash/cd/network/etc) and delete it.

2) To enable it to work regardless of your current folder view (open or explore), a ddeexec value has to be added.  See the code below for more info.
[autorun]
icon=.\VolumeIcon.icns

shell=Default

shell\Default=View Programs
shell\Default\command="Explorer"
shell\Default\ddeexec="[ViewFolder("%lPrograms\Shortcuts",null,null)]"

shell\BrowseThis=View Flash Drive
shell\BrowseThis\command="Explorer"
shell\BrowseThis\ddeexec="[ViewFolder("%l", %I, %S)]"

[content]
MusicFiles=false
PictureFiles=false
VideoFiles=false

Open in new window

0
 
Steve KnightIT ConsultancyCommented:
try changing it instead to "explorer ."  

That works for me anyway.

Steve

START "" .
0
 
Steve KnightIT ConsultancyCommented:
Actually scrub that, sure it worked the first time but then it didn't!!
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
bswinnertonAuthor Commented:
Anybody have any ideas?
0
 
BillDLCommented:
Try these:

explorer.exe .\
explorer.exe .\Programs\Shortcuts\

or

explorer.exe /e,.\
explorer.exe /e,.\Programs\Shortcuts\
0
 
bswinnertonAuthor Commented:
Doesn't quite work in Vista, but that's an entirely different hurdle. Thanks for the help!
0
 
jostranderCommented:
Yeah, security in win7/vista is a bit tight for non-optical + autoplay.  I used to use shelexec.exe with my autorun.inf files to do stuff like this... now that I finally figured out how...it's going obsolete :)

Fun project though... thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.