Archive: Creating shortcuts to directories.


Creating shortcuts to directories.
I want to create a shortcut to a folder.

If I specify a folder as the target for CreateShortcut, e.g.:

CreateShortcut "Shortcut.lnk" "$INSTDIR\somewhere"

It creates a shortcut but double clicking it asks me what program I want to open "somewhere" with.

If I edit the shortcut it creates and append a "\" to the directory name, it works, however, if I try to do that with CreateShortcut, e.g.:

CreateShortcut "Shortcut.lnk" "$INSTDIR\somewhere\"

NSIS removes the trailing "\" and it still has the same problem.

How do I create a shortcut to a folder?

Thanks.

Edit: NSIS 2.42 on Windows XP SP3.


Hello OneMoreUserName

I have tested the CreateShortCut function on my computer and it works well. My PC has the same configuration as mentioned by you (XP SP3 and NSIS V.2.42).

During my tests I have recognized your problem one time. This occurs, if you forgot the suffix .lnk after the name of the shortcut. Let me give you an example:

Works:
CreateShortCut $DESKTOP\MyFolderTest.lnk "D:\temp"

Do not work (your problem I think)
CreateShortCut $DESKTOP\MyFolderTest "d:\temp"

Check it out.

Regards
Candu