Re: How to create a relative shortcut ?

Paul <[email protected]> Wed, 3 Sep 2025 09:17:47 -0400
Newsgroups comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general
Organization A noiseless patient Spider
Message-ID <[email protected]>
On Wed, 9/3/2025 3:47 AM, R.Wieser wrote:
> Paul,
> 
>> A shortcut is designed to be copied or moved anywhere.
> 
> And, as it looks now, their *only* goal.    I can imagine using a full path
> as the default, but ignoring relative paths is just a "it works for us"
> short-sighteness.
> 
> ... unless you have a good reason why relative paths would not be possible ?
> 
>> If the Original file is moved (somewhere), you are required to create
>> a new Shortcut (new absolute path).
> 
> Nope.  It will try to find the target itself, but gives you the option to
> browse for it.
> 
> I could easily do without that behaviour (its search method is opaque) and
> just get an "target has gone" error.  Have not seen any configuration for
> that though.
> 
>> If you want a file to appear in two places (on the same partition),
>> then mklink or junction.exe might work.
> 
> Hard links do not work on FAT32 (thumb)drives.   And neither program exists
> on my OS (XPsp3).
> 
>> but when the program "works out where it is", as some programs
>> do, it is going to find that it is not located in the portable
>> folder where all the DLLs are located.
> 
> :-) Pros and cons.  They have to be weighted.
> 
>> Right now, the betting money is on a shortcut with an absolute
>> path inside it.
> 
> Not usable on a removable (thumb)drive I'm afraid.
> 
> ... hence my (subject-line) question.
> 
> Regards,
> Rudy Wieser

There is a feature called "AppPath" or so, where executables not
in the regular path environment variable, are stored in the Registry.

   https://learn.microsoft.com/en-us/windows/win32/shell/app-registration

I somehow doubt a USB key would be allowed a reference in there.
Only partition letters "in good standing" like C: should be
stored there. Any partition which is volatile would be a poor
candidate for inclusion, since the drive letter could be reused
any time.

But that's just a demo that at some point, they decided to augment
%path% type environment variables, with a few more pointers.

Just leave your EXE and DLL in the bin\ subdirectory you created
and people will find it :-) Or, consult the people who make portable
applications, and maybe they have a treatise on the subject.

   Paul