|
|
#1 |
|
Junior Member
Join Date: Sep 2003
Location: Roswell, GA
Posts: 44
|
CreateShortcut broken? (Relative path to .LNK)
I've noticed that my installers no longer appear to be creating shortcuts - this is on Windows 10, 64-bit. Here's the log entry:
Output folder: C:\Users\xxx\Documents\Foo Output folder: C:\Users\xxxx\AppData\Local\Bar\Foo\Cache Output folder: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Bar C:\Program Files\foo\bar\myApp.EXE File Exists Error creating shortcut: foo.lnk Output folder: C:\Users\xxx\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch Error creating shortcut: foo.lnk Output folder: C:\Users\xxx\Desktop Error creating shortcut: foo.lnk Output folder: C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\bar Error creating shortcut: foo2.lnk Output folder: C:\Users\xxx\Desktop Error creating shortcut: foo2.lnk That "File Exists" message validates that the executable I'm trying to create a shortcut to exists, yet I get a cryptic error. Running as Admin (although that shouldn't make a difference when I'm trying to write to my own desktop). How can i determine what error is being triggered? Last edited by Anders; 16th January 2019 at 02:02. Reason: Title |
|
|
|
|
|
#2 |
|
Junior Member
Join Date: Sep 2003
Location: Roswell, GA
Posts: 44
|
Here's a sample NSI:
code: All shortcuts fail on Windows 10! |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
Your calls to CreateShortcut do not specify a full path!
Also, with "RequestExecutionLevel Admin" you really should use "SetShellVarContext All" to avoid writing to the wrong Start Menu folder. The CreateShortcut code has not changed in a while. IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Sep 2003
Location: Roswell, GA
Posts: 44
|
That worked, but why should they specify a full path? Do they not assume $OUTDIR if one is not provided? My reading of the Documentation "$OUTDIR is used as the working directory" implies that, but I may have misunderstood.
Out of curiosity, is this Windows-specific? While you say the code hasn't change in a while, this is code of mine that hasn't changed in around a decade and worked on Windows 7. |
|
|
|
|
|
#5 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
$OUTDIR is the working directory of the thing invoked by the shortcut, it is a property inside the .LNK shortcut file. I will update the documentation to clarify this.
NSIS just uses the IShellLink interface in Windows to create shortcuts. I believe the implementation in Windows 8+ is stricter when it comes to the path of the .LNK (iPersistFile::Save https://msdn.microsoft.com/en-us/win...able-manifest#) if the application declares support for Windows 8 in its manifest. One more thing I noticed, why are you using "ManifestSupportedOS Win10"? You should leave that property alone unless you understand what it does and actually want compatibility stuff applied on Windows 7, 8 and 8.1. IntOp $PostCount $PostCount + 1 |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|