Archive: CommandLine param with CreateShortCut


CommandLine param with CreateShortCut
Hey here is the problem i am having. I am trying to create a shortcut that contains a command line parameter for the exe it points to. When i run this ....

CreateShortCut "$DESKTOP\Whatever.lnk" '"C:\Test.ext" /c "MyString"'

it creates the shortcut just fine except it switches the "/c" to "\c" and so link does not work correctly. Does anyone know why its switching the slashes on me and how i can fix this problem? I've also tried

CreateShortCut "$DESKTOP\Whatever.lnk" '"C:\Test.ext" '/c' "MyString"'

and that didnt work either. Any help you can offer would be appreciated.

Thnx,
Mark


I guess MyString is also a parameter. Then you should put both parameters into 1 string, like this:
CreateShortCut "$DESKTOP\Whatever.lnk" "C:\Test.ext" "/c MyString"

-Hendri.


'"C:\Test.exe" /c "MyString"' (which is what ive been using) is actually one string that is contained inside single quotes. i did it that way because in the target path of the link file there are parts of the string that need to be in double quotes. If you were to right click and look at the properties of the icon, this is what should be in the target path...
"C:\Test.exe" /c "MyString"


The problem is that the parameters should come in a seprate string.

CreateShortCut link.lnk target.file [parameters] [icon.file] [icon_index_number] [start_options] [keyboard_shortcut]
This is because the Windows function that creates shortcuts also uses two strings. One for the program and the other for the parameters.

Thanks!
Hey thanks a lot man! Spliting up the string solved my problem. Guess i just wasnt comprehending the documentation.


Thx KiCHiK for explaining again. My solution was correct but apparently not clear to everyone. I'll be more clear next time.

-Hendri.