Page 1 of 1

How to reference a path in which the drive letter can change?

Posted: 08 Feb 2017 21:00
by cadu
Hi,

I'd appreciate help. I use XYplorer and many other programs in portable mode, stored in an external drive.
Also, some programs have settings that point to other programs (ex. plugins, backup paths, Listary pointing to XYplorer as main file manager, etc).
When there is drive letter change problems just pop-up!
I'm wondering how to reference a path in which the drive letter can change, in order I don't need to specify the exact drive letter in the path.
So, instead of using "G:\Portable\XYplorer.exe", is it possible to use some expression handled by Windows (not only XYPlorer) that would work as "%anydrive%:\Portable\XYplorer.exe"?
The program path itself "\Portable\XYplorer.exe" is always the same. What would change is just the drive letter, from "G:\Portable\XYplorer.exe" to "%anydrive%:\Portable\XYplorer.exe".

I have two situations:
a) All programs are in same external drive. So, same drive letter change is common to all.
b) Programs installed in C: that points to the external drive that may change letter. Considering there are two different drives, I'm not sure if the same workaround for (a) would work here.

Sorry if my explanation is confused, but what I'm looking for is a kind of expression that will give flexibility, similarly I can achieve by using %username% (C:\Users\%username%\AppData) instead of the actual user name (C:\Users\i_am_the_user\AppData).

Many thanks for help!
Cadu

Re: How to reference a path in which the drive letter can change?

Posted: 08 Feb 2017 21:09
by highend
There is no 100% reliable way for this.

Best way to do it: http://www.uwe-sieber.de/usbdlm.html
which can assign always the same drive letter