Page 2 of 2

Re: Args() - Returns command line parameters as array

Posted: 17 Mar 2015, 11:37
by geek
What's so wrong with this that you're driven to using DLL calls??

Code: Select all

Args := []
loop, %0%
    Args[A_Index] := %A_Index%

Re: Args() - Returns command line parameters as array

Posted: 17 Mar 2015, 21:05
by Guest
Nah, I'm not the one passing command-lines to my script, it's other applications, so I have no control over that.
I just need to pass them along to another applications.

Re: Args() - Returns command line parameters as array

Posted: 17 Mar 2015, 21:29
by Chef

Re: Args() - Returns command line parameters as array

Posted: 21 Mar 2015, 17:36
by lexikos
You don't need COM/WMI. Just use DllCall( "GetCommandLine", "Str" ) as mentioned in the first post in this thread, but then don't call Args(). (You do still need to remove the executable name, though.)

Re: Args() - Returns command line parameters as array

Posted: 06 Mar 2018, 20:20
by Guest
Many thanks for posting this excellent script/function! :D
-JT

Re: Args() - Returns command line parameters as array

Posted: 06 Mar 2018, 22:28
by gregster
Guest wrote:Many thanks for posting this excellent script/function! :D
-JT
There is now the A_Args variable built-in into AHK: https://autohotkey.com/docs/Variables.htm#Args