Archive: CreateShortCut adds drive letter ???


CreateShortCut adds drive letter ???
Hi,

Someone asks me in a french nsis forum about a problem with the CreateShortCut function ! I asked him to llokup in the doc but i found his problem quite stange !
He wanted to use parameters in the shortcup, and use the direct method :
CreateShortCut "$INSTDIR\Play HLP.lnk" "'$INSTDIR\halflife.exe' -console -dev -game Hl-Parpaing"

:D

I know that this is not the wrong way to use that function, but if this is executed by NSIS, the shortcut links to : "C:\'E:\HalfLife\halflife.exe' -console -dev -game Hl-Parpaing"

C:/ was added at the begining ? Does anyone knows why ?


I know that this is not the wrong way to use that function, but if this is executed by NSIS, the shortcut links to : "C:\'E:\HalfLife\halflife.exe' -console -dev -game Hl-Parpaing"
As a matter of fact, it IS the wrong way of using this function. The parameters should come in a seperate string. And it does show in the docs:

CreateShortCut link.lnk target.file [parameters] [icon.file] [icon_index_number] [start_options] [keyboard_shortcut]

Sur, this is in the doc ... the fact is : is there a logical reason that NSIS links to "C:\'E:\HalfLife\halflife.exe' -console -dev -game Hl-Parpaing" instead of "'E:\HalfLife\halflife.exe' -console -dev -game Hl-Parpaing" ?


The reason there are two strings is that this is the way Windows does it. The Windows function that creates the shortcut gets two parameters, one for the path and one for the shortcut parameters.


but why, when using one parameter (intead of the two required), is there a c:\ that appears ?


Because it does not know a drive marked with a ", so it adds the default drive letter. This is what Windows does, NSIS has nothing to do with it.


aarg, so simple ! Thanks a lot kichik : you were very patient ;) (:igor: <- me :D) !