Args() - Returns command line parameters as array

Post your working scripts, libraries and tools for AHK v1.1 and older
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

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

17 Mar 2015, 11:37

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%
Guest

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

17 Mar 2015, 21:05

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.
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

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

21 Mar 2015, 17:36

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.)
Guest

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

06 Mar 2018, 20:20

Many thanks for posting this excellent script/function! :D
-JT
gregster
Posts: 9034
Joined: 30 Sep 2013, 06:48

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

06 Mar 2018, 22:28

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

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: fiendhunter and 233 guests