From 80ab2fddfdf30f09f0a0a637654cbb3cd5c7baa6 Mon Sep 17 00:00:00 2001 From: Rich Turner Date: Fri, 12 Aug 1983 17:53:34 -0700 Subject: MS-DOS v2.0 Release --- v2.0/bin/UTILITY.DOC | 813 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 813 insertions(+) create mode 100644 v2.0/bin/UTILITY.DOC (limited to 'v2.0/bin/UTILITY.DOC') diff --git a/v2.0/bin/UTILITY.DOC b/v2.0/bin/UTILITY.DOC new file mode 100644 index 0000000..a63793c --- /dev/null +++ b/v2.0/bin/UTILITY.DOC @@ -0,0 +1,813 @@ + + + + + + + + + + + + + + + + + + + MS-DOS 2.0 + + Utility Extensions + + + + + + + + + The following notation is used below: + + [item] item is optional. + item* item is repeated 0 or more times. + item+ item is repeated 1 or more times. + {item1 | item2} + item1 is present or item 2 is present but + not both. + indicates a syntactic variable. + + +COMMAND invokation + +COMMAND [[:]] [] [-D] [-P] [-C ] + + -P If present COMMAND will be permanent, otherwise + this is a transient command. + + -D If present COMMAND will not prompt for DATE and + TIME when it comes up. + + d: Specifies device where command will look for + COMMAND.COM current default drive if absent. + + Specifies a directory on device d: root + directory if absent. + + Name of the CTTY device. /DEV/CON if absent + and command is permanent. The /DEV/ may be left + off if AVAILDEV is TRUE (see sysinit doc). + + -C If present -C must be the last switch. + This causes COMMAND to try to execute the string + as if the user had typed it at the standard input. + COMMAND executes this single command string and + then exits. If the -P switch is present it is + ignored (can't have a single command, permanent + COMMAND). NOTE: ALL of the text on the command + line after the -C is just passed on. It is not + processed for more arguments, this is why -C must + be last. + +COMMAND extensions + +IF + + where is one of the following: + + ERRORLEVEL + true if and only if the previous program EXECed by + COMMAND had an exit code of or higher. + + == + true if and only if and are + identical after parameter substitution. Strings + may not have embedded delimiters. + + EXIST + true if and only if exists. + + NOT + true if and only if is false. + + The IF statement allows conditional execution of commands. + When the is true, then the is + executed otherwise, the is skipped. + + Examples: + + IF not exist /tmp/foo ECHO Can't find file /tmp/foo + + IF $1x == x ECHO Need at least one parameter + + IF NOT ERRORLEVEL 3 LINK $1,,; + + +FOR %% IN DO + + can be any character but 0,1,2,3,..,9 (so there is no + confusion with the %0 - %9 batch parameters). + + is ( * ) + + The %% variable is sequentially set to each member of + and then is evaluated. If a member of + is an expression involving * and/or ?, then the + variable is set to each matching pattern from disk. In + this case only one such may be in the set, any + s after the first are ignored. + + Example: + + FOR %%f IN ( *.ASM ) DO MASM %%f; + + for %%f in (FOO BAR BLECH) do REM %%f to you + + NOTE: The '%%' is needed so that after Batch parameter + (%0 - %9) processing is done, there is one '%' left. + If only '%f' were there, the batch parameter processor + would see the '%' then look at 'f', decide that '%f' + was an error (bad parameter reference) and throw out + the '%f' so that FOR would never see it. If the FOR + is NOT in a batch file, then only ONE '%' should be + used. + + +SHIFT + + Currently, command files are limited to handling 10 + parameters: %0 through %9. To allow access to more than + these, the command SHIFT will perform a 'pop' of the + command line parameters: + + if %0 = "foo" + %1 = "bar" + %2 = "blech" + %3...%9 are empty + + then a SHIFT will result in the following: + + %0 = "bar" + %1 = "blech" + %2...%9 are empty + + If there are more than 10 parameters given on a command + line, then the those that appear after the 10th (%9) will + be shifted one at a time into %9 by successive shifts. + +: