From: "Andrew Stadt" To: , "Mingw users list" , "DJGPP List" Subject: RE: [Mingw-users] command.com vs. cmd.exe Date: Mon, 23 Sep 2002 10:53:48 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-reply-to: <3D8EB923.1565.3A553D8@localhost> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk >-----Original Message----- >From: mingw-users-admin AT lists DOT sourceforge DOT net >[mailto:mingw-users-admin AT lists DOT sourceforge DOT net]On Behalf Of Paul G. >Sent: September 23, 2002 09:48 >To: Mingw users list; DJGPP List >Subject: Re: [Mingw-users] command.com vs. cmd.exe > > > > >On 23 Sep 2002 at 9:12, Daniel Taupin wrote: > >> In order to make a portable documentation (possibly associated with a >> portable set of utilities) I want to know: >> >> Is there in WinNT4, Win2000 and/or WinXP a line command controller >> (i.e. MSDOS emulation windows controller) named COMMAND.COM, in addition >> to the NT usual CMD.EXE ? > > Depends on OS. > > for NT4, yes. Both exist. > > To determine which one to use, $ComSpec (environment) >variable will give you the >default, NT4 command line processor (cmd.exe). If you run a >MS-DOS app, (16bit, such as >a WFW3.11 app or a MS-DOS 6.x based app), "command.com" is invoked >because for >those systems, ComSpec changes. (MS-DOS looks in MSDOS system >directory or >c:\msdos, WFW3.11 looks in WFW(3.x) system directory (c:\Windows?)). > > Both ComSpecs (MSDOS/WFW3.x) expect "command.com" to be there. > > As to W2k, there is only one command line processor (not >sure of name, but think it >is command.exe). XP also has a single command line processor >(again, not sure of its >name, but think it is command.exe as well). > > In the case of NT4, command.com and cmd.exe are both located in >%sysdrive%\%windir%\system32. > > For W2k and XP, I think there is only >%sysdrive%\%windir%\system (same as >Win9x/Me). > > All have ComSpec defined. ComSpec says exactly _where_ the >"default" command >line processor is located. > > For my NT4: ComSpec=C:\Winnt\system32\cmd.exe > > To manually find out where a particular command processor >is, open a command >prompt (console) and type "set". It will list the ComSpec >specific to the OS you are using as >well as all the other environment variables that are currently set >for whichever Windows OS >you are using. > >> >> In that case, where is it typically stored (\WINDOWS or \WINNT) or its >> subdir SYSTEM32? > > Again, depends on which OS you are using. ComSpec is your friend. > >> >> Second point: somebody (usually competent) told me that (on Win2000 >> and/or WinXP) cmd.exe called a command.com when it has to handle a *.bat >> file. Is that true, and under which conditions? > > Umm...as others have noted, I do not believe there is such >a thing as >"command.com" under Win2k or XP. On two of my machines with W2k on them, there is a command.com. While I haven't been able to figure out the exact trigger for it to load/unload, I did notice the following: 1. %comspec% is set to cmd.exe, and cmd.exe is loaded whenever you open a command prompt, or call 'system(...)' from within an application. 2. .cmd & .bat files both seem to processes by cmd.exe (e.g. they will work with out command.com being present) - provided that they do not attempt to call a dos based application. 3. command.com seems to be loaded whenever you attempt to run a 16 bit dos application, it will attempt to reload itself (if necessary) after the program exits, only to then exit back to cmd.exe According to some text in the config.nt file: When you return to the command prompt from a TSR or while running an MS-DOS-based application, Windows runs command.com. This allows the TSR to remain active. To run cmd.exe, the Windows command prompt, rather than command.com, abd the ntcmdprompt to config.nt or other startup file. I can't speak for XP. Andrew.