Sign in to follow this  
Followers 0
Ontosy

maximum length parameter

8 posts in this topic

What is the maximum length of a parameter in autoit command line?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

What is the maximum length of a parameter in autoit command line?

Help file:

Note : only 63 parameters can be return by $CmdLine[...], but $CmdLineRaw will always returns the entire command line.

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

@Ontosy...If you are looking to pass more parameters...I would just use one parameter with one string that you can delimit with some character.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

What is the maximum length of a parameter in autoit command line?

The whole script line is limited to 4095 characters (not bytes, because 16bit unicode is supported). There is no limit I am aware of for individual parameters, provided the whole script line is not pushed over 4095.

:)

Edit: Doh! muttley Command line, not script line. Just ignore me...

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

Share this post


Link to post
Share on other sites

ty

Share this post


Link to post
Share on other sites

I seem to have run into some limit with $CmdLineRaw. It appears that if I exceed 2041 characters, I get a Windows error that it can't find the specified drive or file [all selected files are in same directory, so that error is confusing].

I use DOpus as my file manager because you can create your own commands to execute. I created a command in DOpus that executes my compiled script.

My script reads the selected files using $CmdLineRaw. It works fine as long as the line length is less than 2041 characters. I tried finding the upper limit by selecting different files that had different length filenames, so only got as high as 2041 characters. But more than that produces the Windows error, so I can't even test for the limit to prevent the error.

The Help file says there is no limit to the parameters when using $CmdLineRaw. I tried $CmdLine[x] too, but still get the same error with the same set of files selected.

Any ideas on what my problem is?

The whole script line is limited to 4095 characters (not bytes, because 16bit unicode is supported). There is no limit I am aware of for individual parameters, provided the whole script line is not pushed over 4095.

Share this post


Link to post
Share on other sites

You are probably running into limits imposed by windows.

On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters.

This limitation applies to the command line, individual environment variables (such as the PATH variable) that are inherited by other processes, and all environment variable expansions. If you use Command Prompt to run batch files, this limitation also applies to batch file processing.

MS Knowledgebase artical


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

I am using WinXP, so the 8191 limit should apply, but it looks like my limit is 2047. Strange.

So this means that I need to find out how many characters I have selected "before" I run the script. I have no idea how to do that. The CmdLineRaw command reads the parameters (filenames) that are passed from DOpus.

So Windows must have a way to know that I exceeded the limit before it runs the script. Any idea how it does that? If I know how it does that, maybe I can come up with a way to detect it before it produces the error and do something about it. Any ideas?

You are probably running into limits imposed by windows.

On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters.

This limitation applies to the command line, individual environment variables (such as the PATH variable) that are inherited by other processes, and all environment variable expansions. If you use Command Prompt to run batch files, this limitation also applies to batch file processing.

MS Knowledgebase artical

Share this post


Link to post
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
Sign in to follow this  
Followers 0