Solved

What is the max length of a string parameter an exe is able to accept

Posted on 2003-10-27
8
408 Views
Last Modified: 2010-04-05
Hello,
As you can see it, everything is in the title. I just need to know what's the maximum size of the parameter given to an exe for it's execution. Does anyone know?
Thx

lourson
0
Comment
Question by:lourson
  • 3
  • 3
  • 2
8 Comments
 
LVL 8

Expert Comment

by:gmayo
ID: 9629756
A quick google suggests the following: nobody knows. In any case, it functions with null terminated strings and various webpages say anything from 1k to 32kbytes. Only one way to find out - try it!

Geoff M.
0
 
LVL 8

Accepted Solution

by:
gmayo earned 250 total points
ID: 9629801
Quick test program: about 880 characters. Could be limited by Delphi. This is running on XP Home, could be different on different OSs.

Geoff M.
0
 

Author Comment

by:lourson
ID: 9629877
Hi!
Thank you for answering so fast, am very impressed by your interest. I'm agree with you when you say that the best thing to do is tying. I'm under delphi7 on XP OS so i will try and then probably have an answer. But it will only be the XP case. What i'm wondering is : "does this length may vary between all the releases of µSoft from 98 to XP, via Me and 2000?". The app i'm writing will turn under any of those OS. Actually, i don't have the possibility to install all of those system for testing that. What i project to do to avoid avoid bad surprises is to write a temp file containing the wanted parameter and give its path in the command line, so the exe will take in charge the opening of the temp file. But I'd like to avoid this solution. it seems too ugly.
lourson.
0
 

Author Comment

by:lourson
ID: 9629912
Ooops,
while writing a comment, you had already posted another answer (I'm a little bit slow, english is not my language). Our questions are the same. Does the OS or compiler influence this length? Well 880 chars is not enough yet, so i will have to use the parameters file solution.
I think the points are yours because of the big interest you gave me and the 880 chars detail. Congratulations.
 
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 9635026
Oops. Too bad you were a bit impatient... :-(

The length of the commandline is related to the size of the environment block. Old DOS users might still be familiar with the environment. You know, that stuff where you store the Windows 'path' variable and other info. Normally this is about 2048 characters and a normal Windows installation will eat up around 1200 characters. Thus you 'only' have around 800 to 900 characters left...
For more information about the environment, visit http://www.gscit.monash.edu.au/students/helpdesk/howto/msdos_env_space.html

Now, I'm not sure if NT/W2K/XP has the same limitation. But I think the limitation still exists. Basically, if you have to send over that many information to another application then it's better to use a parameter file instead like you yourself suggested.
0
 
LVL 8

Expert Comment

by:gmayo
ID: 9637171
Too impatient? He got an answer of "about 880" and your answer is "around 800 to 900"...... hmmmm!!! Now, as for "not sure if NT/W2K/XP has the same limitation", as already stated, this was on XP Home.

Geoff M.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 9641252
Yeah, but you can enlarge the environment, thus allowing more than 900 characters. It could be possible to have twice or even more the amount of characters. I think the environment can be up to 32 KB in size, thus with one KB in use for settings, you could have a commandline of 31 KB. Theoretically...
0
 

Author Comment

by:lourson
ID: 9653676
Thank you gmayo and Workshop_Alex for your interest. I found very interesting the possibility to enlarge the environment. But unfortunaly 31 kb are still not enough for the use i project to do. In fact, the parameter i need to pass is an unlimited list of files '%' separated. So the parameter size may vary from a few byte to Megas. I'm sure now that I have to give up the parameter idea. I have to turn to the parameter file or table.
Just for information : Under XP Pro and D7, I reached a parameter string of ~2050. Above that, the app fails to launch.

Lourson
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 69
Delphi IDE crash without error message ... 7 76
Find and Replace Stream with 0s 8 56
FMX and jaudiotracker playing memory stream 29 66
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now