Solved

Command Line Overflow

Posted on 1998-04-24
3
174 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 70 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

19 Experts available now in Live!

Get 1:1 Help Now