Starts a new copy of the Command Interpreter.
Syntax:
COMMAND [path] [device] [/Switches]
path | Directory (and drive) containing command.com. This must be specified unless command.com is in the root directory. |
device | Device to use for command input and output. By default this is the keyboard and monitor. |
/P | Makes the new Command Interpreter permanent. |
/E:x | Sets the initial environment size [bytes]. x should be set between 256 and 32,768 bytes. The default is: 256 bytes. |
/L:y | Internal buffers length [bytes]. y should be set between 128 and 1,024 bytes. The default is: ? This switch is only accepted if the Command Interpreter is permanent - ie. the /P switch must also be set. |
/U:z | Input buffer length [bytes]. z should be set between 128 and 255 bytes. The default is: ? This switch is only accepted if the Command Interpreter is permanent - ie. the /P switch must also be set. |
/MSG | Stores all error messages in memory. This switch is only accepted if the Command Interpreter is permanent - ie. the /P switch must also be set. |
/LOW | Forces COMMAND to keep in low memory |
/Y | Steps through the batch program specified by /C or /K |
/C command | Executes command and exits. This must be the last switch on the command line. |
/K command | Executes command and continues running. This must be the last switch on the command line. |
/F | Forces a "Fail" response to the Command Interpreter's error handling routine query: "Abort, Retry, Fail?". |
/Z | Causes the ERRORLEVEL number returned by external DOS commands to be appended to the command's output. |
/T | ? |
/D |
Undoes the /F switch temporarily. Use in temporary instances of Command interpreter only
OR
Prevents execution of AUTOEXEC.BAT when used with a primary shell, or secondary with /P, (see COMMAND Notes4) |
Notes:
- Every time a Dos window is opened in Windows95, a new (non-permanent) instance of the Command Interpreter is run. Thus several instances of Command.com can be running independently at the same time.
- The EXIT command is used to quit any non-permanent instances of Command.com.
- Under normal circumstances, the only occasion when the /P switch need or should be specified is when Command.com is used within a Shell statement.
- The /MSG switch is quoted as forcing all of Command.com's messages to be loaded into memory on startup. This could save a bit of disk swapping if the machine is running from floppies However, as Dos7 only runs on machines with lots of memory it would seem to be natural for this to be the default. Indeed, when I tried loading Command /p with and without the /MSG switch, both versions were reported to be using exactly the same amount of memory implying that this switch is now redundant.
- The /Y and /Z switches can be particularly useful in helping to debug macros and would typically be used in conjunction with the /C switch. Once the macro was working, the /Y and /Z switches would probably be dropped and the command line assigned its own shortcut.
The /Y switch steps through the macro line by line and gives the choice of processing the line or skipping it. This example is from a fragment of a batch file. The operator is escaping from a loop by not processing a GOTO instruction:
........
C:\WINDOWS>shift
shift [Enter=Y,Esc=N]?Y
C:\WINDOWS>goto start
goto start [Enter=Y,Esc=N]?N
C:\WINDOWS>
C:\WINDOWS>
C:\WINDOWS>_
|
When Command is started with the /Z switch, the initial display on loading is:
C:\WINDOWS>command /z
Microsoft(R) Windows 95
(C)Copyright Microsoft Corp 1981-1996.
Return code (ERRORLEVEL): 0
WARNING: Reloaded COMMAND.COM transient
C:\WINDOWS>_
|
Thereafter, the exit code (ERRORLEVEL number) returned by a program will be appended to any output from that program.
For example, attempting to using XCOPY to transfer files from drive a: to c: when there is no disk in a: will result in an error and XCOPY will quit leaving an exit code of 4. This will display as:
C:\WINDOWS>xcopy a:\*.* c:\
Invalid path - a:\
The device is not ready.
0 File(s) copied
Return code (ERRORLEVEL): 4
C:\WINDOWS>_
|
- COMMAND contains an error handling routine that is used by a number of internal commands. If a command cannot be carried out because of a hardware/operator malfunction, the error message "Abort, Retry, Fail?" is displayed. For example, if the command "DIR a:" is entered and there is no disk in drive a:
C:\> dir a:
Not ready reading drive A
Abort, Retry, Fail?_
|
The only accepted responses to this are:
A | ("Abort") The command is terminated and you are returned to the prompt. |
R | ("Retry") The command is run again - hopefully the problem has been corrected - eg a disk has been put into drive a: |
F | ("Fail") This accepts that the command could not be executed for whatever reason and you are returned to the prompt (though it sometimes takes 2 or 3 F's to get there). |
Ctrl-C | The command is cancelled and you are returned to the prompt. |
There is a difference between the ways A, F, and Ctrl-C are handled but, after much experimenting, I still cannot see any real pattern. In both cases, the command terminates and the user is returned to the prompt. This is true whether the command was issued from the command line or from within a batch file - in the latter case, the batch file also terminates. However, whilst the end result is very similar, it would seem that the F response causes a more orderly closure.
For example: if dir a: is entered and there is no disk in drive a:, A will return you directly to the command prompt whereas F repeats the question. Pressing F a second time, gives the message that the disk in a: has no label and repeats the question. Pressing F a third time gives the message "Fail on interrupt 24", and then returns to the prompt:
C:\WINDOWS> dir a:
Not ready reading drive A
Abort, Retry, Fail?
Abort, Retry, Fail?f
Not ready reading drive A
Abort, Retry, Fail?f
Volume in drive A has no label
Not ready reading drive A
Abort, Retry, Fail?f
Fail on INT 24
C:\WINDOWS>_
|
File Details
File Name | Default Location | Dos Ver. | Win Ver. | Size | Date | Source |
Command.com | c:\windows (normally used)
c:\ (reserve) |
7.0 | Win95 |
92 870 | 11/07/95 | Precopy1.cab |
7.1 | Win95 (OSR2.x) |
93 812 | 24/08/96 | Precopy1.cab |
Win98 |
93 880 | 06/05/98 | Precopy1.cab |
Win98 SE |
93 890 | 23/04/99 | Precopy1.cab |
|