Jump to content

Command Line Arguments


jbg1978
 Share

Recommended Posts

I have a script that runs perfectly when started from the editor, but when ran as an executable return a subscript out of range error. The only difference I can think of, is that when I run it from the editor, I give the strings explicit values. However, when I run the .exe, I pass the strings in through the command line. I can only assume that there is a maximum amount of subscripts that the $CmdLine[] variable can hold. Can anyone confirm that? I am trying to pass 8 parameters into it. Can I change the maximum?

Thanks,

Jason

Link to comment
Share on other sites

I have a script that runs perfectly when started from the editor, but when ran as an executable return a subscript out of range error. The only difference I can think of, is that when I run it from the editor, I give the strings explicit values. However, when I run the .exe, I pass the strings in through the command line. I can only assume that there is a maximum amount of subscripts that the $CmdLine[] variable can hold. Can anyone confirm that? I am trying to pass 8 parameters into it. Can I change the maximum?

Thanks,

Jason

There is no such limit, however the Windows shell limits a single command line to either 1024 or 4096 characters, depending on version. More likely you are passing long strings as parameters that are getting clipped.

Another possibility is bad pairing of quotation marks on the command line.

Debug by just putting _ArrayDisplay($CmdLine) at the top of the script to see the inputs.

:D

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

There is no such limit, however the Windows shell limits a single command line to either 1024 or 4096 characters, depending on version. More likely you are passing long strings as parameters that are getting clipped.

Another possibility is bad pairing of quotation marks on the command line.

Debug by just putting _ArrayDisplay($CmdLine) at the top of the script to see the inputs.

:D

Agree here.. quotation marks for values which include white spaces.. we don't know your data, but does it have strings with white spaces?.. they all get treated as diff params from command line

Also watch out for special chars / chars reserved by CMD.. like ampersand

Edited by hydroxide
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...