Solved

Command Line Overflow

Posted on 1998-04-24
3
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate into files by filename 12 92
iSeries DB2 Query 2 101
Hibernate methods 2 88
Fibonacci challenge 11 141
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 …
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.

759 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