See Also: Refer to programs on the same drive as portable Opus
See Also: Same drive letter for USB devices each time
Directory Opus 10 and above:
Similar/better functionality is now built into Opus, so you probably won't need the script below.
From Opus 10.0.5.1 onwards, the folder alias system now supports accessing drives by their volume label, using /$<label>
(e.g. /$Backup/
would refer to a drive labeled Backup).
Launch Via Label
LaunchViaLabel.vbs is a script you can use to run a command on a particular drive, looking up the drive via its label. It can be useful when you want to launch something from a USB drive which doesn't always have the same label.
You should run the script with at least two arguments. The first argument is the label of the drive you want to look up. The rest of the arguments are the command you want to run.
Any occurrences of DRIVE in the arguments will be replaced with the drive letter (e.g. "X:").
-
Example 1)
If "My USB Stick" is mounted as U: then this:
LaunchViaLabel.vbs "My USB Stick" __DRIVE__\HelloWorld.exe
Will run this:
U:\HelloWorld.exe
-
Example 2)
If "LEOCAMERA" is mounted as M: then this:
LaunchViaLabel.vbs "LEOCAMERA" Explorer.exe __DRIVE__
Will run this:
Explorer.exe M:
That will launch Explorer showing the M: drive.
(If you want to respect the default file manager instead of launching Explorer explicitly, you'd just launch the drive letter by itself and let Windows decide what to run. In that case you should set WaitForCommand=False at the top of the script. Otherwise you'll get an error message because the script can only wait for commands to complete if they run an executable directly.)
Get the script from my webpage, or a local copy here (may not always be up to date):
LaunchViaLabel100.zip (1.4 KB)