Solved

Command Line Overflow

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

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

863 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