Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!oxtrap!mudos!mju From: mju@mudos.ann-arbor.mi.us (Marc Unangst) Newsgroups: comp.sys.ibm.pc Subject: Re: Searching failure of COMMAND.COM Message-ID: <663.252C039D@mudos.ann-arbor.mi.us> Date: Thu, 05 Oct 89 21:35:11 EDT Organization: FidoNet node 1:120/129 - Starship Enterprise, Ann Arbor MI In article <2882NU013809@NDSUVM1>, NU013809@NDSUVM1.BITNET (Greg Wettstein) writes: > argv[0] = "c::command.com" <---- The name of the program to execute. > > argv[1] = "-c" <---- The execute and return switch. > > argv[2] = "dir" <---- Command to execute. > > argv[3] = "" <---- Null to terminate arguement list. > > >When command.com was spawned with this arguement list an error was issued >repeatedly which said that an invalid search path was found. Control then >returned to the daughter copy of command.com. Typing an exit command would >return control back to MAKE. Checking the environment revealed that the only >environment strings present were: PATH= and COMSPEC=:command.com. Well, I can see several problems... 1. COMSPEC should be a fully-qualified pathname. ":command.com" isn't even a legal one, so I'm very surprised that your machine hasn't crashed with a "Can't load COMMAND.COM/System Halted." message yet. You must be lucky. The correct COMSPEC would be "c:\command.com". 2. COMMAND.COM wants to have "/" in some versions of DOS; in others, it likes the current switch character. Use getswitchar() (if you use Turbo C; if you're using MSC, you'll have to muck about with inline assembly) to grab the current switch character, and use that. UNDER NO CONDITIONS should you hardcode "-c" in. (Note: It might just be easier to have a runtime environment variable or config-file option that specifies how to execute a command.) 3. You should not hardcode in COMMAND.COM. I'm sure there are a lot of MKS people out there who swear up a storm every time a program that has COMMAND.COM locked in comes down the pipe. Please use COMSPEC or a user-defined variable. > setting. I have heard conflicting reports on whether or not > command.com checks the current switch character setting before > parsing command lines passed to it. That's because different versions of DOS work differently. There are some versions that have "/" coded in, others use switchar, and others are just plain weird. -- Marc Unangst Internet: mju@mudos.ann-arbor.mi.us UUCP : ...!uunet!sharkey!mudos!mju Fidonet : Marc Unangst of 1:120/129.0 BBS : The Starship Enterprise, 1200/2400 bps, +1 313-665-2832 ÿ