Commands APPEND/DPATH and FTYPE are also concerned by this; however
we do not implement them in our CMD.EXE yet.
These commands set the ERRORLEVEL differently, whether or not they are
run manually from the command-line/from a .BAT file, or from a .CMD file:
- From command-line/.BAT file, these commands set the ERRORLEVEL only if
an error occurs. So, if two commands are run consecutively and the first
one fails, the ERRORLEVEL will remain set even if the second command
succeeds.
- However, when being run from a .CMD file, these command will always
set the ERRORLEVEL. In the example case described above, the second
command that succeeds will reset the ERRORLEVEL to 0.
This behaviour is determined from the top-level batch/script file being
run. This means that, if a .BAT file is first started, then starts a
.CMD file, the commands will still behave the .BAT way; on the opposite,
if a .CMD file is first started, then starts a .BAT file, these commands
will still behave the .CMD way.
To implement this we introduce one global BATCH_TYPE enum variable that
is initialized to the corresponding batch/script file type when the
top-level script is loaded. It is reset to "none" when that script
terminates.
See https://ss64.com/nt/errorlevel.html for more details,
section "Old style .bat Batch files vs .cmd Batch scripts",
and https://groups.google.com/forum/#!msg/microsoft.public.win2000.cmdprompt.admin/XHeUq8oe2wk/LIEViGNmkK0J
(comment by Mark Zbikowski).
ReactOS command line interpreter CMD
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ReactOS command line interpreter CMD is derived from FreeCOM, the
FreeDOS command line interpreter.
We are shooting mainly to be just like 2000/XP cmd.exe. They are very close and only a small number(none that i can recall off the top of my head, so maybe 0) differences have been found between those two. It has been reported that ROS cmd.exe does not work on nt4 because of a missing api. I'm hoping to fix this at some point.
Compiling
~~~~~~~~~
ROS cmd used to depend on __REACTOS__ to provide two different ways to build cmd. There is still code left in it for this but... The __REACTOS__ = 0 has not been develped, maintained. And therefore it does not even compile anymore. __REACTOS__ = 1 works fine on both windows(nt). and someday i plan to remove all the __REACTOS__ = 0.
Using rbuild you can compile cmd separately by "make cmd_install". Also you can compile cmd using MSVC 6 and soon 7/8 hopefully.
Current Features
~~~~~~~~~~~~~~~~
- environment handling with prompt and path support.
- directory utilities.
- command-line history with doskey-like features.
- batch file processing.
- input/output redirection and piping.
- alias support.
- filename completion (use TAB), both Bash and Windows-CMD style.
Credits
~~~~~~~
FreeDOS developers:
normat@rpi.edu (Tim Norman)
mrains@apanix.apana.org.au (Matt Rains)
ejeffrey@iastate.edu (Evan Jeffrey)
Steffen.Kaiser@Informatik.TU-Chemnitz.DE (Steffen Kaiser)
Svante Frey (sfrey@kuai.se)
Oliver Mueller (ogmueller@t-online.de)
Aaron Kaufman (morgan@remarque.berkeley.edu)
Marc Desrochers (bitzero@hotmail.com)
Rob Lake (rlake@cs.mun.ca)
John P. Price <linux-guru@gcfl.net>
Hans B Pufal <hansp@digiweb.com>
ReactOS developers:
Eric Kohl
Emanuele Aliberti <ea@iol.it>
Paolo Pantaleo <paolopan@freemail.it>
Brandon Turner <turnerb7@msu.edu>
Bugs
~~~~
There are still many bugs ;)
Please report bugs to ReactOS team <ros-dev@reactos.org> or to JIRA at www.reactos.org