Re: How to create a relative shortcut ?
"R.Wieser" <[email protected]> Fri, 5 Sep 2025 21:05:40 +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]> |
"R.Wieser" wrote : > Hello all, > > I'm trying to create relative shortcuts* (for use on a removable USB > harddisk) and can't seem to find out how it works. It looks like I ran head-first into some "over-engenering". :-( As I could not find any way to create a relative shortcut using the IShellLink object, I took a better look at the Shortcut file itself. And going on a hunch, I was able to solve the problem in the most basic way ever : by manually creating a shortcut file. It turns out that writing the header with only the "HasRelativePath" flag set and than the desired (counted-length) relative path followed by four bytes all Zero (as the end of extras list of blocks) does the trick. Adding other strings (arguments, working directory, description) the same way also works. One downside though : when going into the properties and changing the target causes the shortcut to revert to its normal, absolute paths format. ... At least, here on my XPsp3 machine. Regards, Rudy Wieser