Jump to content

maximum length parameter


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 6 months later...

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.

Link to comment
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

Link to comment
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

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