Board index » Visual Studio » CreateProcess command line length

CreateProcess command line length

Visual Studio102
C:\WINNT\system32\cmd.exe /C

\\Msnlfp01\public\PlaceA\PlaceB\PlaceC\PlaceD\MyBatch Nov-22-2005 123456

\\Msnlfp01\public\PlaceE\PlaceF\PlaceG\ThisFile.xxx



Hi guys. I am trying to execute a DOS command like above from my

application(vc6.0, mfc, non-unicode, win2k) by using CreateProcess(). Win2K

works fine but I found that CreateProcess fails sometimes and command line

length matters(In Win98, command processor would be c:\windows\command.com).



CreateProcess(NULL,cmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);



I tried to separate command processor string(C:\WINNT\system32\cmd.exe /c)

and following command line into lpApplicationName and lpCommandLine but

win98 seems that it doesn't like a option '/C'.



What would be the max allowable length of cmd on win98 machine?

Anybody had this problem?



Thanks

Bob


-
 

Re:CreateProcess command line length

the '/c' is part of lpCommandLine, not lpApplicationName



Bob Lee wrote:

Quote
C:\WINNT\system32\cmd.exe /C

\\Msnlfp01\public\PlaceA\PlaceB\PlaceC\PlaceD\MyBatch Nov-22-2005 123456

\\Msnlfp01\public\PlaceE\PlaceF\PlaceG\ThisFile.xxx



Hi guys. I am trying to execute a DOS command like above from my

application(vc6.0, mfc, non-unicode, win2k) by using CreateProcess(). Win2K

works fine but I found that CreateProcess fails sometimes and command line

length matters(In Win98, command processor would be c:\windows\command.com).



CreateProcess(NULL,cmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);



I tried to separate command processor string(C:\WINNT\system32\cmd.exe /c)

and following command line into lpApplicationName and lpCommandLine but

win98 seems that it doesn't like a option '/C'.



What would be the max allowable length of cmd on win98 machine?

Anybody had this problem?



Thanks

Bob



-

Re:CreateProcess command line length

MS-DOS has all sorts of bizarre limitations, and that's all Win98 is, just a sort-of-GUI

on top of a version of MS-DOS, full of old MS-DOS and Win16 limitations. I gave up years

ago trying to deal with the bizarre and useless piece of obsolete technology that was

Win9x, because I kept having problems like this.



Try the command line



/c "echo 012345678901234567890123456789..."

and do this in a loop adding more and more characters to the string until the string you

get back via stdout is shorter than the string you sent. Then you'll know. I don't have

any idea otherwise how to find it out.

joe



On Tue, 22 Nov 2005 08:24:57 +1300, "Bob Lee" <bob.lee@vmsl.co.nz>wrote:



Quote
C:\WINNT\system32\cmd.exe /C

\\Msnlfp01\public\PlaceA\PlaceB\PlaceC\PlaceD\MyBatch Nov-22-2005 123456

\\Msnlfp01\public\PlaceE\PlaceF\PlaceG\ThisFile.xxx



Hi guys. I am trying to execute a DOS command like above from my

application(vc6.0, mfc, non-unicode, win2k) by using CreateProcess(). Win2K

works fine but I found that CreateProcess fails sometimes and command line

length matters(In Win98, command processor would be c:\windows\command.com).



CreateProcess(NULL,cmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);



I tried to separate command processor string(C:\WINNT\system32\cmd.exe /c)

and following command line into lpApplicationName and lpCommandLine but

win98 seems that it doesn't like a option '/C'.



What would be the max allowable length of cmd on win98 machine?

Anybody had this problem?



Thanks

Bob



Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm

-