Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Command Line Overflow

Posted on 1998-04-24
3
Medium Priority
?
187 Views
Last Modified: 2013-11-19
All,

The project I'm working on (Win NT 4.0 SP3, VC++ 5.0) has for various reasons, a need to spawn a separate program from within our own.
When we spawn the program we get a command line overflow at about the 150th character. 150 characters sounds like a lot until you start referring to multiple files with their full path.

Unfortunately, we can't just wrap the spawned program's inputs into a file, because it's 3rd party.
We thought about kludging a hack were we put everything in the same directory temporarily, but aren't really satisfied with that.

So,
a) Can we increase the command line length? (and How?)
b) Can we avoid the command line length issue altogether (without using argument files)?
c) What is the actual command line length (154 seems like a very strange number for it to be...)?

Thanks in advance for any help you can give...

meehanj
0
Comment
Question by:meehanj
3 Comments
 
LVL 6

Expert Comment

by:jpk041897
ID: 1302109
Actualy the max command line length for DOS IS 154 characters and it affect Win95 and NT also.

You cannot easily increase the 154 character limit, I.e: without overriding command.com entierly. There are a few shareware programs like 4DOS (which you can download at http://www.shareware,com) that increase this size to 255 characters.

But even with this increase, if at all possible, your best workarrounds are usualy to dinamically change directoris to the intended PATH and then open the file.

0
 

Author Comment

by:meehanj
ID: 1302110
Continuing :
Would ShellExecute() instead of spawn*() gain us anything?
0
 

Accepted Solution

by:
footloose earned 140 total points
ID: 1302111
Do you need to give absolute paths in the commandline ? If the third party application searches the current directory first (by default), then you should try putting all (or atleast some of) the necessary files in one directory, switch to that directory and then spawn the application.

Another kludge is to reduce the length of the directory names in the paths. See if you can specify file paths relative to a single parent directory, and not necessarily from the drive letter.
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

916 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