Re: How to create a relative shortcut ?

Schugo <[email protected]> Wed, 3 Sep 2025 21:54:47 +0200
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 02.09.2025 11:36, R.Wieser wrote:
> ...
> I did find this : 
> https://devblogs.microsoft.com/oldnewthing/20171019-00/?p=97247 , but I'm 
> not even sure if that is what I'm after ... :-|

however, there he claims the relative path is already in any .lnk,
but not used, because LINKINFO and LINKTRACK is used first.

"Normal shortcuts already remember the target’s location relative to the
shortcut itself. However, the relative path is not used until other avenues
have been exhausted. To give the relative path more prominence, let’s disable
the other avenues."

so you have to add these 2 flags

SLDF_FORCE_NO_LINKINFO
SLDF_FORCE_NO_LINKTRACK

with

IShellLinkDataList::SetFlags
https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishelllinkdatalist-setflags

ciao...