Archive: Troubleshoot createShortCut error


Troubleshoot createShortCut error
I have a few start menu short cuts that need to be created. They are all coded like the following:

createShortCut "$SMPROGRAMS\${prodname}\$Project_name\Shortcut.lnk" "$INSTDIR\Program.vbs" "" "$INSTDIR\My-Icon.ico"

I have also tried:

createShortCut "$SMPROGRAMS\${prodname}\$Project_name\Shortcut.lnk" "$INSTDIR\Program.vbs" "$INSTDIR\My-Icon.ico"

The .nsi compiles fine either way, but after the installation is complete the details show that not a single short cut was able to be created (everything else goes fine). It generates the following error with either example from above:

"Error creating shortcut: C:\Documents and Settings\80880\Start Menu\Programs\RM Dashboard\Project\Shortcut.lnk"

Being new to NSIS, I am not sure how to debug this! Help?


You need to create the folders ${prodname} and $Project_name before you create the shortcut.

Also, just linking to a .vbs is not smart, you should link to wscript.exe and pass the .vbs as a parameter


Thanks for the help!

For others' reference, I needed to create the start menu folders before creating my shortcuts in them:

CreateDirectory "$SMPROGRAMS\${prodname}"
CreateDirectory "$SMPROGRAMS\${prodname}\$Project_name"

createShortCut "$SMPROGRAMS\${prodname}\$Project_name\Shortcut.lnk" "$INSTDIR\Program.vbs" "" "$INSTDIR\My-Icon.ico"

And I will work on executing wscript.exe instead of the vbs.