DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: .lnk files - arguments not passed to .exe?  (Read 4,044 times)

highend01

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 188
.lnk files - arguments not passed to .exe?
« on: August 23, 2017, 08:32 AM »
Hi,

A very simple .ahk script, that outputs all command line parameters it receives

Code
Loop, %0%  ; For each parameter:
{
    param := %A_Index%  ; Fetch the contents of the variable whose name is contained in A_Index.
    MsgBox, 4,, Parameter number %A_Index% is %param%.  Continue?
    IfMsgBox, No
        break
}

This one will be compiled into "Get command line parameters.exe"

If invoked from a command prompt with:
Code
"R:\Get command line parameters.exe" "arg1" "arg2"
It outputs both arguments correctly

But when I now create a shortcut to the .exe file
Code
"R:\Get command line parameters.exe.lnk"

and put the command line arguments into the target field of this shortcut e.g. with:
Code
"R:\Get command line parameters.exe" "arg1" "arg2"

The called .exe will output: nothing!

Both params aren't passed to the .exe file...

System: Windows Server 2012 R2 U3 x64

Does anyone have an idea on what is causing this behavior?
« Last Edit: August 23, 2017, 08:54 AM by highend01 »

Original address: https://www.donationcoder.com/forum/index.php?topic=44236.0