  -34-


  CHAPTER 3 / USING 4DOS, 4OS2, AND 4NT


  4DOS, 4OS2, and 4NT are both a collection of commands and a set of
  features which make your computer easier to use.  The commands are
  explained in the Command Reference section which begins on page
  170.  This chapter explains each of the features that are not
  directly related to individual commands.

  Most of the features described in this section are easy to use,
  but a few are more technical in nature.  Such advanced features
  are marked with a ## next to the feature name or the paragraph
  which describes the feature's operation.

  As you read through this section, we urge you to experiment with
  the features that catch your interest and pass over any which seem
  too complicated.  Come back to this section as you gain expertise,
  and you will probably discover that the more complex features will
  seem easy and very useful.  You don't need to learn any more than
  you want, and even if you are a computer novice, you'll find some
  features that will interest you immediately.

  If you come across terms or concepts in this chapter that you are
  unsure about, refer to Chapter 1 / General Concepts, the Index, or
  the Glossary in the online help.


  4DOS, 4OS2, and 4NT for Take Command Users

       If you're a Take Command user, many of the features in 4DOS,
       4OS2, or 4NT will seem very familiar.  Because the underlying
       command processing is the same in all of these products,
       you'll find Take Command's features are readily accessible.
       All the commands and switches you've used work the same way
       and have the same meaning in 4DOS, 4OS2, or 4NT; the only
       exceptions are those that don't make sense in a command-line
       environment.

       Other features of our command processors are included in
       4DOS, 4OS2, and 4NT as well -- you'll find support for
       command-line editing, command and directory histories,
       aliases, .BTM files, and virtually all the other features you
       already know.

       If you plan to share aliases or batch files between Take
       Command and 4DOS, 4OS2, or 4NT, see page 136 for details
       about choosing compatible command separators, escape
       characters, and parameter characters for two or more
       products.


  At the Command Line

       4DOS displays a c:\> prompt when it is waiting for you to
       enter a command.  4OS2 and 4NT display the similar [c:\]
       prompt.  (In each case, the actual text depends on the
  -35-

       current drive and directory as well as your PROMPT settings.)
       This is called the command line and the prompt is asking you
       to enter a command, an alias or batch file name, or the
       instructions necessary to begin an application program.

       This section of the manual explains the features that will
       help you while you are typing in commands, and how keystrokes
       are interpreted when you enter them at the command line.  The
       keystrokes discussed here are the ones normally used by 4DOS,
       4OS2, and 4NT.  If you prefer using different keystrokes to
       perform these functions, you can assign new ones with
       keystroke directives in the .INI file (see page 142).


       Command-Line Editing

       The command line works like a single-line word processor,
       allowing you to edit any part of the command at any time
       before you press Enter to execute it, or Esc to erase it.

       The command line you enter can be up to 255 characters long
       under 4DOS and 1023 characters long under 4OS2 and 4NT.

       You can use the following editing keys when you are typing a
       command (the words Ctrl and Shift mean to press the Ctrl or
       Shift key together with the other key named):

       Cursor Movement:

            Left arrow          Move the cursor left one character.
            Right arrow         Move the cursor right one character.
            Ctrl-Left arrow     Move the cursor left one word.
            Ctrl-Right arrow    Move the cursor right one word.
            Home                Move the cursor to the beginning of
                                the line.
            End                 Move the cursor to the end of the
                                line.

       Insert and Delete:

            Ins                 Toggle between insert and overtype
                                mode.
            Del                 Delete the character at the cursor.
            Backspace           Delete the character to the left of
                                the cursor.
            Ctrl-L              Delete the word or partial word to
                                the left of the cursor.
            Ctrl-R or Ctrl-Bksp Delete the word or partial word to
                                the right of the cursor.
            Ctrl-Home           Delete from the beginning of the
                                line to the cursor.
            Ctrl-End            Delete from the cursor to the end of
                                the line.
            Esc                 Delete the entire line.

       Execution:
            Ctrl-C or Ctrl-Break     Cancel the command line.
  -36-

            Enter               Execute the command line.

       Most of the command-line editing capabilities are also
       available when a 4DOS, 4OS2, or 4NT command prompts you for a
       line of input.  For example, you can use the command-line
       editing keys when DESCRIBE (page 219) prompts for a file
       description, when INPUT (page 296) prompts for input from an
       alias or batch file, or when LIST (page 308) prompts you for
       a search string.

       If you want your input at the command line to be in a
       different color from the command processor's prompts or
       output, you can use the Display page of the OPTION dialogs,
       or the InputColors directive in your .INI file.  You must
       have an ANSI driver installed to use InputColors under 4DOS.
       See page 160 for more details.

       The command processor will prompt for additional command-line
       text when you include the escape character as the very last
       character of a typed command line.  The default escape
       character is Ctrl-X (ASCII 24, displayed as an up arrow) in
       4DOS, and a caret [^] in 4OS2 and 4NT.  For example:

            [c:\] echo The quick brown fox jumped over the lazy^
            More? sleeping dog. > alphabet

    ## Sometimes you may want to enter one of the command line
       editing keystrokes on the command line, instead of performing
       the key's usual action.  For example, suppose you have a
       program that requires a Ctrl-R character on its command line.
       Normally you couldn't type this keystroke at the prompt,
       because it would be interpreted as a "Delete word right"
       command.

       To get around this problem, use the special keystroke Alt-
       255.  You enter Alt-255 by holding down the Alt key while you
       type 255 on the numeric keypad, then releasing the Alt key
       (you must use the number keys on the numeric pad; the row of
       keys at the top of your keyboard won't work).  This forces
       the command processor to interpret the next keystroke
       literally and place it on the command line, ignoring any
       special meaning it would normally have as a command-line
       editing or history keystroke.  You can use Alt-255 to
       suppress the normal meaning of command-line editing
       keystrokes even if they have been reassigned with key mapping
       directives in the .INI file (see page 142), and Alt-255
       itself can be reassigned with the CommandEscape directive.


       Command History and Recall

       Each time you execute a command, the entire command line is
       saved in a command history list.  You can display the saved
       commands, search the list, modify commands, and rerun
       commands.
  -37-

       The simplest use of the command history list is to repeat a
       command exactly.  For example, you might enter the command

            c:\> dir b:*.wks;*.doc

       to see some of the files on drive B.  You might move some new
       files to drive B and then want to repeat the DIR command.
       Just press the Up Arrow key repeatedly to scan back through
       the history list.  When the DIR command appears, press Enter
       to execute it again.  (You can also view the command history
       in a window -- see page 39 for details.)

       After you have found a command, you can edit it before
       pressing Enter.  You will appreciate this feature when you
       have to execute a series of commands that differ only
       slightly from each other.

       The history list is normally "circular".  If you move to the
       last command in the list and then press the down arrow one
       more time, you'll see the first command in the list.
       Similarly, if you move to the first command in the list and
       then press the up arrow one more time, you'll see the last
       command in the list.  You can disable this feature and make
       command history recall stop at the beginning or end of the
       list by turning off the History Wrap selection on the Command
       Line 1 page of the OPTION dialogs, or setting HistWrap to No
       in the .INI file (see page 157).

       You can search the command history list to find a previous
       command quickly using command completion.  Just enter the
       first few characters of the command you want to find and
       press Up Arrow.  You only need to enter enough characters to
       identify the command that you want to find.  For example, to
       find the DIR command, enter DI and then press Up Arrow.  If
       you press the Up Arrow key a second time, you will see the
       previous command that matches.  The system will beep if there
       are no matching commands.  The search process stops as soon
       as you type one of the editing keys, whether or not the line
       is changed.  At that point, the line you're viewing becomes
       the new line to match if you press Up Arrow again.

       You can specify the size of the command history list on the
       Command Line 1 page of the OPTION dialogs, or with the
       History directive in the .INI file (see page 149).  When the
       list is full, the oldest commands are discarded to make room
       for new ones.  You can also use the HistMin directive in the
       .INI file to enable or disable history saves and to specify
       the shortest command line that will be saved (see page 157).

       You can prevent any command line from being saved in the
       history by beginning it with an at sign [@].

       When you execute a command from the history, that command
       remains in the history list in its original position.  The
       command is not copied to the end of the list (unless you
       modify it).  If you want each command to be copied or moved
       to the end of the list when it is re-executed, set HistCopy
  -38-

       or HistMove to Yes in your .INI file (see page 157).  If you
       select either of these options, the list entry identified as
       "current" (the entry from which commands are retrieved when
       you press Up Arrow) is also adjusted to refer to the end of
       the history list after each recalled command is executed.

       Command History Keys:

            Up Arrow            Recall the previous (or most recent)
                                command, or the most recent command
                                that matches a partial command line.
            Down Arrow          Recall the next (or oldest) command,
                                or the oldest command that matches a
                                partial command line.
            F3                  Fill in the rest of the command line
                                from the previous command, beginning
                                at the current cursor position.
            Ctrl-D              Delete the currently displayed
                                history list entry, erase the
                                command line, and display the
                                previous (matching) history list
                                entry.
            Ctrl-E              Display the last entry in the
                                history list.
            Ctrl-K              Save the current command line in the
                                history list without executing it,
                                and then clear the command line.
            Ctrl-Enter          Copy the current command line to the
                                end of the history list even it has
                                not been altered, then execute it.
            @                   As the first character in a line:
                                Do not save the current line in the
                                history list when it is executed, or
                                store it in the CMDLINE environment
                                variable (see CMDLINE on page 109
                                for further details).  Under DOS,
                                this allows you to squeeze out the
                                last few bytes of environment space
                                before loading TSRs by prefacing
                                each TSR command with an "@".

       Use F3 when your new command is different from your previous
       one by just a character or two at the beginning.  For
       example, suppose you want to execute a DIR on several file
       names then use DEL to delete those same files.  After the DIR
       is complete type DEL and press F3; the rest of the command
       line will be completed for you.  Check that it's correct, and
       then press Enter to delete the files.  F3 also retrieves the
       entire previous command (like up-arrow) if nothing has been
       typed on the line.

       Use Ctrl-E to "get your bearings" by returning to the end of
       the list if you've scrolled around so much that you aren't
       sure where you are any more.

       Use Ctrl-K to save some work when you've typed a long command
       and then realize that you weren't quite ready.  For example,
  -39-

       if you forget to change directories and notice it after a
       command is typed or mostly typed, but before you press Enter,
       just press Ctrl-K to save the command without executing it.
       Use the CD or CDD command to change to the right directory,
       press up-arrow twice to retrieve the command you saved, make
       any final changes to it, and press Enter to execute it.

       Use Ctrl-Enter to organize the history list for repetitive
       tasks.  Instead of searching through the command history for
       the next command in a sequence, you can place all of the
       necessary commands next to each other and make them easier to
       repeat.


       Command History Window

       You can also view the command history in a scrollable command
       history window, and select the command to modify or re-
       execute from those displayed in the window.  To activate the
       command history window press PgUp or PgDn at the command
       line.  A window will appear in the upper right corner of the
       screen, with the command you most recently executed marked
       with a highlight.  (If you just finished re-executing a
       command from the history, then the next command in sequence
       will be highlighted.)

       See page 32 for general information about moving through the
       list in the window.  The display is not circular as it is at
       the prompt; it has a fixed beginning and end.  The Ctrl-D
       (delete from history) key works within the history window as
       it does at the command line.

       Once you have selected a command in the history window, press
       Enter to execute it immediately, or Ctrl-Enter to move the
       line to the prompt for editing (you cannot edit the line
       directly in the history window).

       You can bring up a "filtered" history window by typing some
       characters on the command line, then pressing PgUp or PgDn.
       Only those commands matching the typed characters will be
       displayed in the window.

       Command History Window (see page 32 for general popup window
       keys, and information on customizing window position, size,
       and color):

            PgUp or PgDn        (from the command line) Open the
                                command history window.
            Ctrl-D              Delete the selected line from the
                                history list.
            Enter               Execute the selected line.
            Ctrl-Enter          Move the selected line to the
                                command line for editing.
  -40-

       Local and Global Command History

       The command history can be stored in either a "local" or
       "global" list.

       With a local command history list, any changes made to the
       history will only affect the current copy of the command
       processor.  They will not be visible in other shells, or
       other sessions.  A local command history list is the default
       under 4DOS.

       With a global command history list, all copies of the command
       processor will share the same command history, and any
       changes made to the history in one copy will affect all other
       copies.  Global lists are the default for 4OS2 and 4NT.

       You can control the type of command history on the Startup
       page of the OPTION dialogs, with the LocalHistory directive
       in the .INI file (see page 150), or with the /L and /LH
       options of the START command (see page 374).

       There is no fixed rule for deciding whether to use a local or
       global command history list.  Depending on your work style,
       you may find it most convenient to use one type, or a mixture
       of types in different sessions or shells.  We recommend that
       you start with the default approach for your command
       processor, then modify it if you find a situation where the
       default is not convenient.

4DOS   4DOS can share a global command history list among a parent
       4DOS shell and any child shells you start from that parent
       shell.  For example, if you use 4DOS under DOS, start an
       application, and then "shell to DOS" from the application,
       the original copy of 4DOS and the child shell can share the
       global command history.  If you want to share a global
       command history list among all copies of 4DOS in a multi-
       tasking environment like Windows 3.x or Windows 95, you must
       load a parent copy of 4DOS, usually as the primary command
       processor, before starting the multi-tasking environment.  If
       you run 4DOS under OS/2, global lists can be used within each
       DOS session, but OS/2 will not allow you to share the global
       command history between different DOS sessions.

4OS2,  ##   If you select a global history list for 4OS2 or 4NT, you
4NT    can share the history among all copies of the command
       processor running in any session.  When you close all 4OS2 or
       4NT sessions, the memory for the global history list is
       released, and a new, empty history list is created the next
       time you start 4OS2 or 4NT.  If you want the history list to
       be retained in memory even when no command processor session
       is running, you need to execute the SHRALIAS command, which
       loads a program to perform this service for the global
       command history, directory history, and alias lists (see page
       372).

       Whenever you start a secondary shell (see page 8) which uses
       a local history list, it inherits a copy of the command
  -41-

       history from the previous shell.  However, any changes to the
       history made in the secondary shell will affect only that
       shell.  If you want changes made in a secondary shell to
       affect the previous shell, use a global history list in both
       shells.


       Filename Completion

       Filename completion can help you by filling in a complete
       file name on the command line when you only remember or want
       to type part of the name.  For example, suppose you want to
       copy a file.  You know that its name begins AU but you can't
       remember the rest of the name.  Type:

            c:\> copy au

       and then press the Tab key or F9 key.  4DOS, 4OS2, or 4NT
       will search the current directory for filenames that begin AU
       and insert the first one onto the command line in place of
       the AU that you typed.

       If this is the file that you want, simply complete the
       command.  If the command processor didn't find the file that
       you were looking for, press Tab or F9 again to substitute the
       next filename that begins with AU.  When there are no more
       filenames that match your pattern, the system will beep each
       time you press Tab or F9.

       If you go past the filename that you want, press Shift-Tab or
       F8 to back up and return to the previous matching filename.
       After you back up to the first filename, the system will beep
       each time you press Shift-Tab or F8.

       If you want to enter more than one matching filename on the
       same command line, press F10 when each desired name appears.
       This will keep that name and place the next matching filename
       after it on the command line.  You can then use Tab (or F9),
       Shift-Tab (or F8), and F10 to move through the remaining
       matching files.

       The pattern you use for matching may contain any valid
       filename characters, as well as wildcard characters and
       extended wildcards (see page 64).  For example, you can copy
       the first matching .TXT file by typing

            c:\> copy *.txt

       and then pressing Tab.

       If you don't specify part of a filename before pressing Tab,
       the command processor will match all files.  For example, if
       you enter the above command as "COPY ", without the "*.TXT",
       and then press Tab, the first filename in the current
       directory is displayed.  Each time you press Tab or F9 after
       that, another name from the current directory is displayed,
       until all filenames have been displayed.
  -42-

       If you type a filename without an extension, the command
       processor will add *.* to the name (* on LFN, HPFS, and NTFS
       drives).  It will also place a "*" after a partial extension.
       If you are typing a group of file names in an include list
       (see page 73), the part of the include list at the cursor
       will be used as the pattern to match.

       When filename completion is used at the start of the command
       line, it will only match directories, executable files (see
       page 18), and files with executable extensions, since these
       are the only file names that it makes sense to use at the
       start of a command.  If a directory is found, a "\" will be
       appended to it to enable an automatic directory change (see
       page 45).


4DOS,  Converting Between Long and Short Filenames
4NT

       On LFN drives, 4DOS and 4NT will search for and display long
       filenames during filename completion.  If you want to search
       for traditional 8.3 short filenames, press Ctrl-A before you
       start using filename completion.  This allows you to use
       filename completion on LFN drives with applications that do
       not support long filenames.

       You can press Ctrl-A at any time prior to beginning filename
       completion.  The switch to short filename format remains in
       effect for the remainder of the current command line.  When
       the command processor begins a new command line it will
       return to long filename format until you press Ctrl-A again.

       You can also press Ctrl-A just after a filename is displayed,
       and the name will be converted to short filename format.
       However, this feature only affects the most recently entered
       file or directory name (the part between the cursor and the
       last backslash [\] on the command line), and any subsequent
       entries.  It will not automatically convert all the parts of
       a previously entered path.

       Ctrl-A "toggles" the filename completion mode, so you can
       switch back and forth between long and short filename
       displays by pressing Ctrl-A each time you want to change
       modes.


   ##  Appending Backslashes to Directory Names

       If you set the AppendToDir .INI directive (see page 154), or
       the "Add \ ..." option on the Command Line 1 page of the
       OPTION dialogs, 4DOS, 4OS2, and 4NT will add a trailing
       backslash [\] to all directory names.  This feature can be
       especially handy if you use filename completion to specify
       files that are not in the current directory -- a succession
       of Tab (or F9) and F10 keystrokes can build a complete path
       to the file you want to work with.
  -43-

       The following example shows the use of this technique to edit
       the file C:\DATA\FINANCE\MAPS.DAT.  The lines which include
       <F9> show where F9 (or Tab) is pressed; the other lines show
       how the command line appears after the previous F9 or Tab
       (the example is displayed on several lines here, but all
       appears at a single command prompt when you actually perform
       the steps):

            1    c:\> edit \da <F9>
            2    c:\> edit \data\
            3    c:\> edit \data\f <F9>
            4    c:\> edit \data\frank.doc <F9>
            5    c:\> edit \data\finance\
            6    c:\> edit \data\finance\map <F9>
            7    c:\> edit \data\finance\maps.dat

       Note that F9 was pressed twice in succession on lines 3 and
       4, because the file name displayed on line 3 was not what was
       needed -- we were looking for the FINANCE directory, which
       came up the second time F9 was pressed.  In this example,
       filename completion saves about half the keystrokes that
       would be required to type the name in full.  If you are using
       long file or directory names, the savings can be much
       greater.

       Filename Completion Keys:

            F8 or Shift-Tab     Get the previous matching filename.
            F9 or Tab           Get the next matching filename.
            F10                 Keep the current matching filename
                                and display the next matching name
                                immediately after the current one.
            Ctrl-A              On LFN drives, toggle between long
                                filename and short filename format.


   ##  Customizing Filename Completion

       You can customize filename completion for any internal or
       external command or alias.  This allows the command processor
       to display filenames intelligently based on the command you
       are entering.  For example, you might want to see only .TXT
       files when you use filename completion in the EDIT command.

       To customize filename completion you can use the Command Line
       1 page of the OPTION dialogs, or set the FileCompletion
       directive manually in your .INI file.  You can also use the
       FILECOMPLETION environment variable.  If you use both, the
       environment variable will override the settings in your .INI
       file.  You may find it useful to use the environment variable
       for experimenting, then create permanent settings with the
       OPTION command or the FileCompletion directive.

       The format for both the environment variable and the .INI
       file is:

            cmd1:ext1 ext2 ...; cmd2: ...
  -44-

       where "cmd" is a command name and "ext" is a file extension
       (which may include wildcards) or one of the following file
       types:

            DIRS      Directories
            RDONLY    Read-only files
            HIDDEN    Hidden files
            SYSTEM    System files
            ARCHIVE   Files modified since the last backup

       The command name is the internal command, alias command, or
       executable file name (without a path).  For example, to have
       file completion return only directories for the CD command
       and only .C and .ASM files for B (the Boxer editor), you
       would use this setting for filename completion in the OPTION
       dialogs:

            FileCompletion=cd:dirs; b:c asm

       To set the same values using the environment variable, you
       would use this line:

            c:\> set filecompletion=cd:dirs; b:c asm

       With this setting in effect, if you type "CD " and then
       pressed Tab, the command processor will return only
       directories, not files.  If you type "B " and press Tab, you
       will see only names of .C and .ASM files.

       4DOS, 4OS2, and 4NT do not check your command line for
       aliases before matching the commands for customized file
       completion.  Instead, they ignore any path or file extension
       information in the first word of the command, and then search
       the FILECOMPLETION environment variable and the
       FileCompletion .INI directive to find a match that will limit
       the files selected for filename completion.


       Filename Completion Window

       You can also view filenames in a filename completion window
       and select the file you want to work with.  To activate the
       window, press F7 or Ctrl-Tab at the command line.  You will
       see a window in the upper-right corner of the screen, with a
       sorted list of files that match any partial filename you have
       entered on the command line.  If you haven't yet entered a
       file name, the window will contain the name of all files in
       the current directory.  You can search for a name by typing
       the first few characters; see page 32 for details.  (Ctrl-Tab
       will work only if your keyboard and BIOS or keyboard driver
       support it.  If it does not work on your system, use F7
       instead.)
  -45-

       Filename Completion Window (see page 32 for general popup
       window keys, and information on customizing window position,
       size, and color):

            F7 or Ctrl-Tab      (from the command line)  Open the
                                filename completion window.
            Enter               Insert the selected filename into
                                the command line.


       Automatic Directory Changes

       [Automatic directory changes are part of a set of
       comprehensive directory navigation features built into 4DOS,
       4OS2, and 4NT.  For a summary of these features, and more
       information on the Extended Directory Searches and CDPATH
       features mentioned below, see the Directory Navigation
       section beginning on page 51.]

       The automatic directory change feature lets you change
       directories quickly from the command prompt, without entering
       an explicit CD or CDD command.  To do so, simply type the
       name of the directory you want to change to at the prompt,
       with a backslash [\] at the end.  For example:

            c:\> 4dos\
            c:\4dos>

       This can make directory changes very simple when it is
       combined with Extended Directory Searches or CDPATH .  If you
       have enabled either of those features, the command processor
       will use them in searching for any directory you change to
       with an automatic directory change (see Directory Navigation
       on page 51 for more information on CDPATH and Extended
       Directory Searches).

       For example, suppose Extended Directory Searches are enabled,
       and the directory WIN exists on drive E:.  You can change to
       this directory with a single word on the command line:

            c:\4dos> win\
            e:\win>

       (Depending on the way Extended Directory Searches are
       configured, and the number of subdirectories on your disk
       whose names contain the string WIN, when you execute such a
       command you may see an immediate change as shown above, or a
       popup window which contains a list of subdirectories named
       WIN to choose from.)

       The text before the backslash can include a drive letter, a
       full path, a partial path, or a UNC name (see page 12).
       Commands like "....\" can be used to move up the directory
       tree quickly (see page 64).  Automatic directory changes save
       the current directory, so it can be recalled with a "CDD -"
       or "CD -" command.  For example, any of the following are
       valid automatic directory change entries:
  -46-

            c:\> d:\data\finance\
            c:\> archives\
            c:\> ...\util\win95\
            c:\> \\server\vol1\george\

       The first and last examples change to the named directory.
       The second changes to the ARCHIVES subdirectory of the
       current directory, and the third changes to the UTIL\WIN95
       subdirectory of the directory which is two levels "up" from
       the current directory in the tree.


       Directory History Window

       [The directory history window is part of a set of
       comprehensive directory navigation features built into 4DOS,
       4OS2, and 4NT.  For a summary of these features, and more
       information on enhanced directory navigation features, see
       the Directory Navigation section beginning on page 51.]

       The current directory is recorded automatically in the
       directory history list just before each change to a new
       directory or drive.

       You can view the directory history from a directory history
       window and change to any drive and directory on the list.  To
       activate the directory history window, press Ctrl-PgUp or
       Ctrl-PgDn at the command line.  You can then select a new
       directory with the Enter key.

       If the directory history list becomes full, old entries are
       deleted to make room for new ones.  You can set the size of
       the list with the DirHistory directive in the .INI file (see
       page 148).  In order to conserve space, each directory name
       is recorded just once in the directory history, even if you
       move into and out of that directory several times.  The
       directory history can be stored in either a "local" or
       "global" list; see the next section for details.

       When you switch directories the original directory is saved
       in the directory history list, regardless of whether you
       change directories at the command line, from within a batch
       file, or from within an alias.  However, directory changes
       made by external directory navigation utilities or other
       external programs are not recorded by 4DOS, 4OS2, or 4NT.

       Directory History Window (see page 32 for general popup
       window keys, and information on customizing window position,
       size, and color):

            Ctrl-PgUp or Ctrl-PgDn   (from the command line) Open
                                the directory history window.
            Ctrl-D              Delete the selected line from the
                                directory list.
            Enter               Change to the selected drive and
                                directory.
  -47-

            Ctrl-Enter          Move the selected line to the
                                command line for editing.


       Local and Global Directory History

       The directory history can be stored in either a "local" or
       "global" list.

       With a local directory history list, any changes made to the
       list will only affect the current copy of the command
       processor.  They will not be visible in other shells, or
       other sessions.  A local directory history list is the
       default under 4DOS.

       With a global list, all copies of the command processor will
       share the same directory history, and any changes made to the
       list in one copy will affect all other copies.  Global lists
       are the default for 4OS2 and 4NT.

       You can control the type of directory history list on the
       Startup page of the OPTION dialogs, with the LocalDirHistory
       directive in the .INI file (see page 150), with the /L and
       /LD startup options (see your Introduction and Installation
       Guide), and with the /L and /LD options of the START command
       (see page 374).  Under 4DOS, you can control where a global
       directory history list is stored with the UMBDirHistory
       directive in the .INI file (see page 152), or the
       corresponding setting available from the OPTION command.

       There is no fixed rule for deciding whether to use a local or
       global directory history list.  Depending on your work style,
       you may find it most convenient to use one type, or a mixture
       of types in different sessions or shells.  We recommend that
       you start with the default setting for your command
       processor, then modify it if you find a situation where the
       default is not convenient.

4DOS   4DOS can share a global directory history list among a parent
       4DOS shell and any child shells you start from that parent
       shell.  For example, if you use 4DOS under DOS, start an
       application, and then "shell to DOS" from the application,
       the original copy of 4DOS and the child shell can share the
       global directory history.  If you want to share a global
       directory history list among all copies of 4DOS in a multi-
       tasking environment like Windows or DesqView, you must load
       the parent copy, usually as the primary command processor,
       before starting the multi-tasking environment.  If you run
       4DOS under OS/2, global lists can be used within each DOS
       session, but OS/2 will not allow you to share the global
       directory history between different DOS sessions.

4OS2,##If you select a global directory list for 4OS2 or 4NT, you
4NT    can share the list among all copies of the command processor
       running in any session.  When you close all 4OS2 or 4NT
       sessions, the memory for the global directory history list is
       released, and a new, empty list is created the next time you
  -48-

       start 4OS2 or 4NT.  If you want the list to be retained in
       memory even when no command processor session is running, you
       need to execute the SHRALIAS command, which loads a program
       to perform this service for the global command history,
       directory history, and alias lists (see page 372).

       Whenever you start a secondary shell (see page 8) which uses
       a local directory history list, it inherits a copy of the
       directory history from the previous shell.  However, any
       changes to the list made in the secondary shell will affect
       only that shell.  If you want changes made in a secondary
       shell to affect the previous shell, use a global directory
       history list in both shells.


       Multiple Commands

       At times, you probably know the next two or three commands
       that you want to execute.  Instead of waiting for each one to
       finish before you type the next, you can type them all on the
       same command line, separated by a caret [^] in 4DOS, or an
       ampersand [&] in 4OS2 or 4NT.  For example, if you know you
       want to copy all of your .TXT files to drive A: and then run
       CHKDSK to be sure that drive A's file structure is in good
       shape, in 4DOS you could enter the following command:

            c:\> copy *.txt a: ^ chkdsk a:

       You may put as many commands on the command line as you wish,
       as long as the total length of the command line does not
       exceed 255 characters in 4DOS or 1023 characters in 4OS2 and
       4NT.

       You can use multiple commands in alias definitions (see page
       85) and batch files (see page 88) as well as from the command
       line.

       If you don't like using the default command separator, you
       can pick another character using the SETDOS /C command (see
       page 364) or the CommandSep directive in the .INI file (see
       page 155).  If you plan to share aliases or batch files
       between 4DOS, 4OS2, and 4NT, see page 136 for details about
       choosing compatible command separators for two or more
       products.


   ##  Expanding and Disabling Aliases

       A few command line options are specifically related to
       aliases, and are documented briefly here for completeness.
       If you are not familiar with aliases, see pages 85 and 178
       for complete detail.

       You can expand an alias on the command line and view or edit
       the results by pressing Ctrl-F before the command is
       executed.  Doing so is especially useful when you are
       developing and debugging a complex alias or if you want to
  -49-

       make sure that an alias that you may have forgotten won't
       change the intent of your command.

       At times, you may want to temporarily disable an alias that
       you have defined.  To do so, precede the command with an
       asterisk [*].  For example, if you have an alias for DIR
       which changes the display format, you can use the following
       command to bypass the alias and display the directory in the
       standard format:

            c:\> *dir


       Command Line Help

       All of our products include complete online help.  You can
       start the help system at the command line by entering HELP or
       HELP plus a topic, or by pressing the F1 key at any time.

       If you have already typed part or all of a command on the
       line, the help system will provide "context-sensitive" help
       by using the first word on the line as a help topic.  If it's
       a valid topic, you will see help for that topic
       automatically; if not, you will see a table of contents and
       you can then pick the topic you want.  For example, if you
       press F1 after entering each of the command lines shown below
       you will get the display indicated:

            c:\>                     Topic list / table of contents
            c:\> copy *.* a:         Help on COPY
            c:\> c:\util\map         Topic list / table of contents

       For quick help you can type the name of any internal command
       at the prompt, followed by a slash and a question mark [/?]
       like this:

            copy /?

       In 4DOS and 4OS2, this will show you help for the command in
       a "quick-reference" style (the output can be redirected; see
       page 58 for information on redirection).  In 4NT, /? will
       invoke the standard help system.  The /? option may not work
       correctly if you have redefined how the command operates with
       an alias.  In this case you may need to add an asterisk to
       the beginning of the command (see page 180) to disable alias
       processing:

            alias copy copy /r
            *copy /?

       /? will only access the help system when you use it with an
       internal command.  If you use it with an external command
       name, the external command will be executed and will
       interpret the /? parameter according to its own rules.  Some
       external commands, including some DOS and OS/2 external
       utility programs, do display help when run with a /?
       parameter, but this a characteristic of these commands and
  -50-

       does not depend on the command processor.  Many other
       external commands do not have this feature.

       Please see the Introduction and Installation Guide for
       additional information on the online help system.


   ##  Command-Line Length Limits

       Under 4DOS, when you first enter a command at the prompt or
       in an alias or batch file, it can be up to 255 characters
       long.  The 4OS2 and 4NT command lines can hold 1,023
       characters.

       As the command processor scans the command line and
       substitutes the contents of aliases and environment variables
       for their names, the line usually gets longer.  This expanded
       line is stored in an internal buffer which allows each
       individual command to grow to 255 characters (in 4DOS) or
       1,023 characters (in 4OS2 and 4NT) during the expansion
       process.  In addition, if you have multiple commands on a
       single line, during expansion the entire line can grow to as
       much as 511 characters in 4DOS, or 2,047 characters in 4OS2
       and 4NT.  If your use of aliases or environment variables
       causes the command line to exceed either of these limits as
       it is expanded, you will see a "Command line too long" error
       and the remainder of the line will not be executed.


  Page and File Prompts

       Several 4DOS, 4OS2, and 4NT commands can generate prompts,
       which wait for you to press a key to view a new page or to
       perform a file activity.

       When 4DOS, 4OS2, or 4NT is displaying information in page
       mode, for example with a DIR /P or SET /P command, it
       displays the message

            Press Esc to Quit or any other key to continue...

       At this prompt, you can press Esc, Ctrl-C, or Ctrl-Break if
       you want to quit the command.  You can press almost any other
       key to continue with the command and see the next page of
       information.

       During file processing, if you have activated prompting with
       a command like DEL /P, you will see this prompt before
       processing every file:

            Y/N/R ?

       You can answer this prompt by pressing Y for "Yes, process
       this file;"  N for "No, do not process this file;"  or R for
       "process the Remainder of the files without further
       prompting."  You can also press Ctrl-C, Ctrl-Break, or Esc at
       this prompt to cancel the remainder of the command.
  -51-

       If you press Ctrl-C or Ctrl-Break while a batch file is
       running, you will see a "Cancel batch job" prompt.  For
       information on responses to this prompt see page 93.


  Directory Navigation

       The operating system and command processor remember both a
       current or default drive for your system as a whole, and a
       current or default directory for every drive in your system.
       The current directory on the current drive is sometimes
       called the current working directory.

       With traditional command processors, you change the current
       drive by typing the new drive letter plus a colon at the
       prompt, and you change the current working directory with the
       CD command.  4DOS, 4OS2, and 4NT support those standard
       features, and offer a number of enhancements to make
       directory navigation much simpler and faster.

       This section begins with a summary of all 4DOS, 4OS2, and 4NT
       directory navigation features.  It also provides detailed
       documentation on the enhanced directory search features:
       Extended Directory Searches (page 53) and the CDPATH (page
       56).

       The 4DOS, 4OS2, and 4NT directory navigation features are in
       three groups: features which help the command processor find
       the directory you want, methods for initiating a directory
       change with a minimal amount of typing, and methods for
       returning easily to directories you've recently used.  Each
       group is summarized below.


       Finding Directories

       Traditional command processors require you to explicitly type
       the name of the directory you want to change to.  4DOS, 4OS2,
       and 4NT support this method, and also offer two significant
       enhancements:

            *  Extended Directory Searches (see page 72) allow the
               command processor to search a "database" of all the
               directories on your system to find the one you want.

            *  The CDPATH (see page 71) allows you to enter a
               specific list of directories to be searched, rather
               than searching a database.  Use CDPATH instead of
               Extended Directory Searches if you find the extended
               searches too broad, or your hard drive has too many
               directories for an efficient search.
  -52-

       Initiating a Directory Change

       4DOS, 4OS2, and 4NT support the traditional methods of
       changing directories, and also offer several more flexible
       approaches:

            *  Automatic directory changes (see page 45) allow you
               to type a directory name at the prompt and switch to
               it automatically, without typing an explicit CD or
               similar command.

            *  The CD command (see page 197) can change directories
               on a single drive, and can return to the most
               recently used directory.

            *  The CDD command (see page 199) changes drive and
               directory at the same time, and can return to the
               most recently used drive and directory.

            *  The PUSHD command (see page 339) changes the drive
               and directory like CDD, and records the previous
               directory in a directory "stack."  You can view the
               stack with DIRS and return to the directory on the
               top of the stack with POPD (see the next section).

       CDD, PUSHD, and automatic directory changes can also change
       to a network drive and directory mapped to a drive letter or
       specified with a UNC name (see page 12 for information on UNC
       names).


       Returning to a Previous Directory

       Traditional command processors do not remember previously-
       used directories, and can only "return" to a directory by
       changing back to it with a standard drive change or CD
       command.  4DOS, 4OS2, and 4NT support three additional
       methods for returning to a previous directory:

            *  The CD - and CDD - commands (see pages 197 and 199)
               can be used to return to the previous working
               directory (the one you used immediately before the
               current directory).  Use these commands if you are
               working in two directories and alternating between
               them.

            *  The directory history window (see page 46) allows you
               to select one of several recently-used directories
               from a popup list and return to it immediately.  The
               window displays the contents of the directory history
               list (see the next section for details).

            *  The POPD command  (see page 334) will return to the
               last directory saved by PUSHD (see the previous
               section).  The directory stack holds 511 characters,
               enough for 20 to 40 typical drive and directory
               entries.
  -53-

       Extended Directory Searches

       When you change directories with an automatic directory
       change, CD, CDD, or PUSHD command, 4DOS, 4OS2, or 4NT must
       find the directory you want to change to.  To do so, the
       command processor first uses the traditional method to find a
       new directory:  it checks to see whether you have specified
       either the name of an existing subdirectory below the current
       directory, or the name of an existing directory with a full
       path or a drive letter.  If you have, the command processor
       changes to that directory, and does no further searching.

       This traditional search method requires that you navigate
       manually through the directory tree, and type the entire name
       of each directory you want to change to.  Extended Directory
       Searches speed up the navigation process dramatically by
       allowing the command processor to find the directory you
       want, even if you only enter a small part of its name.

       When the traditional search method fails, 4DOS, 4OS2, and 4NT
       try to find the directory you requested via the CDPATH, then
       via an Extended Directory Search.  This section covers only
       Extended Directory Searches, which are more flexible and more
       commonly used than CDPATH; for details on CDPATH see the next
       section.

       Extended Directory Searches use a database of directory names
       to facilitate changing to the correct directory.  The
       database is used only if Extended Directory Searches are
       enabled, and if the explicit directory search and CDPATH
       search fail to find the directory you requested.

       An extended directory search automatically finds the correct
       path to the requested directory and changes to it if that
       directory exists in your directory database.  If more than
       one directory in the database matches the name you have
       typed, a popup window appears and you can choose the
       directory you want.

       You can control the color, position and size of the popup
       directory search window from the Command line 2 page of the
       OPTION dialogs, or with directives in the .INI file,
       including CDDWinLeft, CDDWinTop, CDDWinWidth, and
       CDDWinHeight (see page 154), and CDDWinColors (page 160).
       You can also change the keys used in the popup window with
       key mapping directives in the .INI file (see page 164).

       To use extended directory searches, you must explicitly
       enable them (see below) and also create the directory
       database.


       The Extended Search Database

       To create or update the database of directory names, use the
       CDD /S command (see page 199 for details).  When you create
       the database with CDD /S, you can specify which drives should
  -54-

       be included.  If you enable Extended Directory Searches and
       do not create the database, it will be created automatically
       the first time it is required, and will include all local
       hard drives.

       The database is stored in the file JPSTREE.IDX, which is
       placed in the root directory of drive C: by default.  The
       same tree file is used by all JP Software command processors.
       You can specify a different location for this file on the
       Command Line 2 page of the OPTION dialogs, or with the
       TreePath .INI directive (see page 152).  If you are using 2
       or more of our products on your computer and want to have
       different drives stored in the database for each, use the
       dialogs or the TreePath directive to place their database
       directories in different locations.

       If you use an internal 4DOS, 4OS2, or 4NT command to create
       or delete a directory, the directory database is
       automatically updated to reflect the change to your directory
       structure.  The updates occur if the command processor can
       find the JPSTREE.IDX file in the root directory of drive C:
       or in the location specified by the TreePath .INI directive.

       The internal commands which can modify the directory
       structure and cause automatic updates of the file are MD, RD,
       COPY /S, DEL /X, MOVE /S, and REN.  The MD /N command can be
       used to create a directory without updating the directory
       database.  This is useful when creating a temporary directory
       which you do not want to appear in the database.

4DOS   In 4DOS, directories can only be added automatically to
       JPSTREE.IDX if the new entry needs to be placed less than 64K
       bytes from the end of the file.  If a directory cannot be
       added automatically, an error message appears.  Automatic
       deletions will work from any location in the file.


       Enabling Extended Searches

       To enable extended directory searches and control their
       operation, you must set the FuzzyCD directive in the .INI
       file.  You can set FuzzyCD with the Search Level option on
       the Command Line 2 page of the OPTION dialogs, or by editing
       the .INI file manually.

            If FuzzyCD = 0, extended searches are disabled, the
            JPSTREE database is ignored, and CD, CDD, PUSHD, and
            automatic directory changes search for directories using
            only explicit names and CDPATH.  This is the default.

            If FuzzyCD = 1 and an extended search is required, then
            the command processor will search the JPSTREE database
            for directory names which exactly match the name you
            specified.

            If FuzzyCD = 2 and an extended search is required, the
            command processor will search the database for exact
  -55-

            matches first, just as when FuzzyCD = 1.  If the
            requested directory is not found, it will search the
            database a second time looking for directory names that
            begin with the name you specified.

            If FuzzyCD = 3 and an extended search is required, the
            command processor will search the database for exact
            matches first, just as when FuzzyCD = 1.  If the
            requested directory is not found, it will search the
            database a second time looking for directory names that
            contain the name you specified anywhere within them.

       For example, suppose that you have a directory called
       C:\DATA\MYDIR, CDPATH is not set, and C:\DATA is not the
       current directory on drive C:.  The following chart shows
       what CDD command you might use to change to this directory.

            FuzzyCD
            Setting        CDD Command

               0      cdd c:\data\mydir
               1      cdd mydir
               2      cdd myd
               3      cdd yd

       An extended directory search is not used if you specify a
       full directory path (one beginning with a backslash [\], or a
       drive letter and a backslash).  If you use a name which
       begins with a drive letter (e.g. C:MYDIR), the extended
       search will examine only directories on that drive.


   ##  Forcing an Extended Search with Wildcards

       Normally you type a specific directory name for the command
       processor to locate, and the search proceeds as described in
       the preceding sections.  However, you can also force the
       command processor to perform an extended directory search by
       using wildcard characters (see page 64) in the directory
       name.  If you use a wildcard, an extended search will occur
       whether or not extended searches have been enabled.

       When 4DOS, 4OS2, or 4NT is changing directories and it finds
       wildcards in the directory name, it skips the explicit search
       and CDPATH steps and goes directly to the extended search.

       If a single match is found, the change is made immediately.
       If more than one match is found, a popup window is displayed
       with all matching directories.

       Wildcards can only be used in the final directory name in the
       path (after the last backslash in the path name).  For
       example you can find COMM\*A*.* (all directories whose parent
       directory is COMM and which have an A somewhere in their
       names), but you cannot find CO?M\*A*.* because it uses a
       wildcard before the last backslash.
  -56-

       If you use wildcards in the directory name as described here,
       and the extended directory search database does not exist, it
       will be built automatically the first time a wildcard is
       used.  You can update the database at any time with CDD /S.

       Internally, extended directory searches use wildcards to scan
       the directory database.  If FuzzyCD is set to 2, an extended
       search looks for the name you typed followed by an asterisk
       (i.e. DIRNAME*).  If FuzzyCD is set to 3, it looks for the
       name preceded and followed by an asterisk (i.e. *DIRNAME*).

       These internal wildcards will be used in addition to any
       wildcards you use in the name.  For example if you search for
       ABC?DEF (ABC followed by any character followed by DEF) and
       FuzzyCD is set to 3, the command processor will actually
       search the directory database for *ABC?DEF*.


   ##  CDPATH

       When you change directories with an automatic directory
       change or the CD, CDD, or PUSHD command, 4DOS, 4OS2, or 4NT
       must find the directory you want to change to.  To do so, the
       command processor first uses the traditional method to find a
       new directory.

       When the traditional search method fails, 4DOS, 4OS2, and 4NT
       try to find the directory you requested via the CDPATH, then
       via an Extended Directory Search.  This section covers only
       the CDPATH; for details on Extended Directory Searches see
       the previous section.

       Enabling both CDPATH and Extended Directory Searches can
       yield confusing results, so we recommend that you do not use
       both features at the same time.  If you prefer to explicitly
       list where the command processor should look for directories,
       use CDPATH.  If you prefer to have the command processor look
       at all of the directory names on your disk, use Extended
       Directory Searches.

       CDPATH is an environment variable, and is similar to the PATH
       variable used to search for executable files:  it contains an
       explicit list of directories to search when attempting to
       find a new directory.  The command processor appends the
       specified directory name to each directory in CDPATH and
       attempts to change to that drive and directory.  It stops
       when it finds a match or when it reaches the end of the
       CDPATH list.

       CDPATH is ignored if a complete directory name (one beginning
       with a backslash [\]) is specified, or if a drive letter is
       included in the name.  It is only used when a name is given
       with no drive letter or leading backslash.

       CDPATH provides a quick way to find commonly used
       subdirectories in an explicit list of locations.  You can
       create CDPATH with the SET command.  The format of CDPATH is
  -57-

       similar to that of PATH:  a list of directories separated by
       semicolons [;].  For example, if you want the directory
       change commands to search the C:\DATA directory, the
       D:\SOFTWARE directory, and the root directory of drive E:\
       for the subdirectories that you name, you should create
       CDPATH with this command:

            c:\> set cdpath=c:\data;d:\software;e:\

       Suppose you are currently in the directory
       C:\WP\LETTERS\JANUARY, and you'd like to change to
       D:\SOFTWARE\UTIL.  You could change directories explicitly
       with the command:

            c:\wp\letters\january> cdd d:\software\util

       However, because the D:\SOFTWARE directory is listed in your
       CDPATH variable as shown in the previous example (we'll
       assume it is the first directory in the list with a UTIL
       subdirectory), you can simply enter the command

            c:\wp\letters\january> cdd util

       or, using an automatic directory change:

            c:\wp\letters\january> util\

       to change to D:\SOFTWARE\UTIL.

       As it handles this request, the command processor looks first
       in the current directory, and attempts to find the
       C:\WP\LETTERS\JANUARY\UTIL subdirectory.  Then it looks at
       CDPATH, and appends the name you entered, UTIL, to each entry
       in the CDPATH variable -- in other words, it tries to change
       to C:\DATA\UTIL, then to D:\SOFTWARE\UTIL.  Because this
       change succeeds, the search stops and the directory change is
       complete.


  Input and Output

       Internal commands and many external programs get their input
       from the computer's standard input device and send their
       output to the standard output device.  Some programs also
       send special messages to the standard error device.
       Normally, the keyboard is used for standard input and the
       video screen for both standard output and standard error, but
       you can temporarily change these assignments for special
       tasks.

       For example, suppose you want a printed list of the files in
       a directory.  If you change the standard output to the
       printer and issue a DIR command, the task is easy.  DIR
       prints to standard output, and you have redirected standard
       output to the printer, so the DIR command prints filenames
       instead of displaying them on the screen.  You can just as
  -58-

       easily send the output of DIR (or any other command) to a
       file or a serial port.

       We offer three methods of manipulating input and output:
       Redirection, Piping, and (under 4DOS and 4OS2) the Keystack.
       All three are explained in this section.

       Redirection and piping affect the standard input, standard
       output, and standard error devices.  They do not work with
       application programs which read the keyboard hardware
       directly, or which write directly to the screen.


       Redirection

       Redirection can be used to reassign the standard input,
       standard output, and standard error devices from their
       default settings (the keyboard and screen) to another device
       like the printer or serial port, to a file, or to the
       clipboard.  You must use some discretion when you use
       redirection with a device; there is no way to get input from
       the printer, for example.

       Redirection always applies to a specific command, and lasts
       only for the duration of that command.  When the command is
       finished, the assignments for standard input, standard
       output, and standard error revert to whatever they were
       before the command.

       In the descriptions below, filename means either the name of
       a file or of an appropriate device (PRN, LPT1, LPT2, or LPT3
       for printers; COM1 to COM4 for serial ports; CON for the
       keyboard and screen; CLIP: for the clipboard; NUL for the
       "null" device, etc.).

       Here are the redirection symbols supported by 4DOS, 4OS2, and
       4NT:

            To get input from a file or device instead of from the
            keyboard:

                 < filename

            To redirect standard output to a file or device:

                 > filename

            To redirect standard output and standard error to a file
            or device:

                 >& filename

            To redirect standard error only to a file or device:

                 >&> filename
  -59-

       If you want to append output to the end of an existing file,
       rather than creating a new file, replace the first ">" in the
       last three commands above with ">>" (i.e., use >>, >>&, and
       >>&>).

       To use redirection, place the redirection symbol and filename
       at the end of the command line, after the command name and
       any parameters.  For example, to redirect the output of the
       DIR command to a file called DIRLIST, you could use a command
       line like this:

            c:\> dir /b *.dat > dirlist

       You can use both input and output redirection for the same
       command, if both are appropriate.  For example, this command
       sends input to SORT from the file DIRLIST, and sends output
       from SORT to the file DIRLIST.SRT:

            c:\> sort < dirlist > dirlist.srt

       You can redirect text to or from the Windows or OS/2
       clipboard by using the pseudo-device name CLIP: (the colon is
       required).  The clipboard device is always available in 4OS2
       and 4NT.  It can only be used in 4DOS when you are running in
       a DOS session under Windows 3.x or Windows 95.  The clipboard
       is not available in a DOS session under OS/2.

       If you redirect the output of a single internal command like
       DIR, the redirection ends automatically when that command is
       done.  If you start a batch file with redirection, all of the
       batch file's output is redirected, and redirection ends when
       the batch file is done.  Similarly, if you use redirection at
       the end of a command group (see page 81), all of the output
       from the command group is redirected, and redirection ends
       when the command group is done.


   ##  Advanced Redirection Options

       When output is directed to a file with >, >&, or >&>, if the
       file already exists, it will be overwritten.  You can protect
       existing files by using the SETDOS /N1 command (see page
       366), the "Protect redirected output files" setting on the
       Options 1 page of the OPTION dialogs, or the NoClobber
       directive in the .INI file (see page 158).

       When output is appended to a file with >>, >>&, or >>&>, the
       file will be created if it doesn't already exist.  However,
       if NoClobber is set as described above, append redirection
       will not create a new file; instead, if the output file does
       not exist a "File not found" or similar error will be
       displayed.

       You can temporarily override the current setting of NoClobber
       by using an exclamation mark [!] after the redirection
       symbol.  For example, to redirect the output of DIR to the
  -60-

       file DIROUT, and allow overwriting of any existing file
       despite the NoClobber setting:

            c:\> dir >! dirout

       Redirection is fully nestable.  For example, you can invoke a
       batch file and redirect all of its output to a file or
       device.  Output redirection on a command within the batch
       file will take effect for that command only; when the command
       is completed, output will revert to the redirected output
       file or device in use for the batch file as a whole.

       You can use redirection if you need to create a zero-byte
       file.  To do so, enter  >filename as a command, with no
       actual command before the > character.

       4DOS For another method of changing the standard input and
       output devices see CTTY on page 212.

4OS2,  In addition to the redirection options above, 4OS2 and 4NT
4NT    also support the OS/2 and Windows NT CMD.EXE syntax:

                 n>file

       and

                 n>&m

       where [n] and [m] are digits between 0 and 9.  You may not
       put any spaces between the n and the >, or between the >, &,
       and m in the second form.   The digits represent file
       handles; OS/2 and Windows NT interpret "0" as standard input,
       "1" as standard output, and "2" as standard error.  Handles 3
       to 9 will probably not be useful unless you have an
       application which uses those handles for a specific,
       documented purpose, or you have opened a file with the
       %@FILEOPEN variable function (see page 127) and the file
       handle is between 3 and 9.

       The n>file syntax redirects output from handle n to a file.
       You can use this form to redirect two handles to different
       places.  For example:

            [c:\] dir > outfile 2> errfile

       sends normal output to a file called OUTFILE and any error
       messages to a file called ERRFILE.

       The n>&m syntax redirects handle n to the same location as
       the previously assigned handle m.  For example, to send
       standard error to the same file as standard output, you could
       use this command:

            [c:\] dir > outfile 2>&1
  -61-

       Notice that you can perform the same operations by using
       standard 4OS2 or 4NT redirection features.  The two examples
       above could be written as

            [c:\] dir > outfile >&> errfile

       and

            [c:\] dir >&outfile


       Piping

       You can also create a "pipe," which means sending the
       standard output of one command to the standard input of
       another command.  To send the standard output of command1 to
       the standard input of command2:

            command1 | command2

       To send the standard output and standard error of command1 to
       the standard input of command2:

            command1 |& command2

       For example, to take the output of the SET command (which
       displays a list of your environment variables and their
       values) and pipe it to the SORT utility to generate a sorted
       list, you would use the command:

            c:\> set | sort

       To do the same thing and then pipe the sorted list to the
       internal LIST command for full-screen viewing (see page 308):

            c:\> set | sort | list

    ## The TEE and Y commands (see pages 385 and 407) are "pipe
       fittings" which add more flexibility to pipes.

    ## Like redirection, pipes are fully nestable.  For example, you
       can invoke a batch file and send all of its output to another
       command with a pipe.  A pipe on a command within the batch
       file will take effect for that command only; when the command
       is completed, output will revert to the pipe in use for the
       batch file as a whole.  You may also have 2 or more pipes
       operating simultaneously if, for example, you have the pipes
       running in different windows in a multitasking system.

4DOS ##4DOS creates one or two temporary files to hold the output of
       pipes.  The files are given unique names.  By default, these
       files are stored in the root directory of the boot drive, but
       you can override this with either the TEMP4DOS or TEMP
       environment variable (see page 110).
  -62-

4OS2,##4OS2 and 4NT implement pipes by starting a new process for
4NT    the receiving program instead of using temporary files.  The
       sending and receiving programs run simultaneously; the
       sending program writes to the pipe and the receiving program
       reads from the pipe.  When the receiving program finishes
       reading and processing the piped data, it endsautomatically.

       If you are used to using pipes under 4DOS, you normally will
       not see any difference with a 4OS2 or 4NT pipe except perhaps
       less disk activity.  But you may not get the results you
       expect if you use a pipe command like:

                 [c:\] echo test | input %%var

4DOS   In 4DOS, this pipe will create an environment variable called
       VAR and set its value as "test."  You will be able to see the
       new variable by typing SET at the prompt.

4OS2,  In 4OS2 and 4NT, VAR will be set in the environment that
4NT    belongs to the receiving program.  But that environment will
       be discarded when the pipe has been emptied and the process
       ends.  You will never see VAR in the environment even though
       the command processor and the operating system are both
       operating correctly.

       The same cautions apply to the "pipe-fitting" commands, TEE
       and Y.  When you use pipes with 4OS2 or 4NT, make sure you
       think about any possible consequences that can occur from
       using a separate process to run the receiving program.


4DOS,  Keystack
4OS2

       The Keystack overcomes two weaknesses of input redirection:
       some programs ignore standard input and read the keyboard
       directly, and input redirection doesn't end until the program
       or command terminates.  You can't, for example, use
       redirection to send the opening commands to a program and
       then type the rest of the commands yourself.  But the
       Keystack lets you do exactly that.

       The Keystack sends keystrokes to an application program.
       Once the Keystack is empty, the program will receive the rest
       of its input from the keyboard.  The Keystack is useful when
       you want a program to take certain actions automatically when
       it starts.  It is most often used in batch files and aliases.
       The Keystack is invoked with the KEYSTACK command (see page
       300).

4DOS   In 4DOS, KEYSTACK depends on a small resident program called
       KSTACK.COM, which may be installed from your AUTOEXEC.BAT
       file (see page 94).  If you don't have KSTACK.COM installed,
       the KEYSTACK command will display an error message.  If you
       are using a multitasking system such as Windows 3.x or
       Windows 95, see the Compatibility section of the online help
       for information on loading KSTACK within a window.
  -63-

4OS2   In 4OS2, KEYSTACK depends on a program called KEYSTACK.EXE.
       This file must be in the same directory as 4OS2.EXE, or in a
       directory listed in your PATH.  You don't have to take any
       special action to activate KEYSTACK.EXE; 4OS2 will run it
       automatically when you use the KEYSTACK command.  If 4OS2
       cannot find KEYSTACK.EXE, the KEYSTACK command will display
       an error message.

4NT    Due to operating system limitations, the Keystack is not
       available in 4NT.

       To place the letters, digits, and punctuation marks you would
       normally type for your program into the keystack, enclose
       them in double quotes:

            c:\> keystack "myfile"

       Many other keys can be entered into the Keystack using their
       names.  This example puts the F1 key followed by the Enter
       key in the keystack:

            c:\> keystack F1 Enter

       See page 30 for details on how key names are entered.  See
       the KEYSTACK command on page 300 for information on using
       numeric key values along with or instead of key names, and
       other details about using the Keystack.

       The following command creates an alias (see page 178) that
       will run a FoxPro report called TIMEREP (it should be entered
       on one line):

            c:\> alias timerep `keystack "use times index times"
                 Enter "report form timerep to print" Enter "quit"
                 Enter ^ foxpro`

       This command creates an alias called timerep which puts the
       following characters on the keystack:

            the characters "use times index times"
            the Enter key's code
            the characters "report form timerep to print"
            the Enter key's code
            the characters "quit"
            and one more Enter key

       The alias then runs the program FOXPRO which receives those
       characters just as if you had typed them.

       When you use the Keystack, remember that you must put the
       keystrokes into the Keystack before you run the program that
       will receive them.  The Keystack will hold the keystrokes
       until the program asks for them.
  -64-

  File Selection

       Most internal commands (like COPY, DIR, etc.) work on a file
       or a group of files.  Besides typing the exact name of the
       file you want to work with, you can use several shorthand
       forms for naming or selecting files and the applications
       associated with them:  Extended Parent Directory Names;
       Wildcards; Date, Time, and Size Ranges; File Exclusion
       Ranges; Multiple Filenames; Include Lists; and Executable
       Extensions.  These seven features are explained in this
       section.

       Most of these features apply to 4DOS, 4OS2, and 4NT commands
       only, and can not be used to pass file names to external
       programs.  For example, the file name ...\FILE.DAT uses an
       extended parent directory name ("...").  It can be used in an
       internal command like COPY or MOVE.  However, your editor may
       not have been designed to support this extension to
       traditional directory names, and is likely to give an error
       message if you try to pass it such a name.

       Remember throughout this section that, if you are using DOS,
       or the FAT file system under OS/2, a filename is a base name
       of 1 to 8 characters, optionally followed by an extension
       which is a period [.] and 1 to 3 more characters.  On drives
       which support long filenames, the names can contain up to 255
       characters, including spaces.  If a long filename includes
       spaces, you must place it in quotation marks on the command
       line.  (See page 14 for additional details on filename
       formats and restrictions.)


       Extended Parent Directory Names

       4DOS, 4OS2, and 4NT allow you to extend the traditional DOS
       ".." syntax for naming the parent directory, by adding
       additional [.] characters.  Each additional [.] represents an
       additional directory level above the current directory.  For
       example, .\FILE.DAT refers to a file in the current
       directory, ..\FILE.DAT refers to a file one level up (in the
       parent directory), and ...\FILE.DAT refers to a file two
       levels up (in the parent of the parent directory).  If you
       are in the C:\DATA\FINANCE\JANUARY directory and want to copy
       the file LETTERS.DAT from the directory C:\DATA to drive A:

            C:\DATA\FINANCE\JANUARY>copy ...\LETTERS.DAT A:


       Wildcards

       Wildcards let you specify a file or group of files by typing
       a partial filename.  The appropriate directory is scanned to
       find all of the files that match the partial name you have
       specified.

       Wildcards are usually used to specify which files should be
       processed by a command.  If you need to specify which files
  -65-

       should not be processed see File Exclusion Ranges on page 72
       (for internal commands), or EXCEPT on page 255 (for external
       commands).

       Most internal commands accept filenames with wildcards
       anywhere that a full filename can be used.  There are two
       wildcard characters, the asterisk [*] and the question mark
       [?], plus a special method of specifying a range of
       permissible characters.

       An asterisk [*] in a filename means "any zero or more
       characters in this position."  For example, this command will
       display a list of all files in the current directory:

            c:\> dir *.*

       If you want to see all of the files with a .TXT extension,
       you could type this:

            c:\> dir *.txt

       If you know that the file you are looking for has a base name
       that begins with ST and an extension that begins with .D, you
       can find it this way.  Filenames such as STATE.DAT,
       STEVEN.DOC, and ST.D will all be displayed:

            c:\> dir st*.d*

       With 4DOS, 4OS2, or 4NT, you can also use the asterisk to
       match filenames with specific letters somewhere inside the
       name.  The following example will display any file with a
       .TXT extension that has the letters AM together anywhere
       inside its base name.  It will, for example, display
       AMPLE.TXT, STAMP.TXT, CLAM.TXT, and AM.TXT:

            c:\> dir *am*.txt

       A question mark [?] matches any single filename character.
       You can put the question mark anywhere in a filename and use
       as many question marks as you need.  The following example
       will display files with names like LETTER.DOC and LATTER.DAT,
       and LITTER.DU:

            c:\> dir l?tter.d??

       The use of an asterisk wildcard before other characters, and
       of the character ranges discussed below, are enhancements to
       the standard wildcard syntax, and may not work properly with
       software other than 4DOS, 4OS2, 4NT, and Take Command.


   ##  Advanced Wildcards

       "Extra" question marks in your wildcard specification are
       ignored if the file name is shorter than the wildcard
       specification.  For example, if you have files called
  -66-

       LETTER.DOC, LETTER1.DOC, and LETTERA.DOC, this command will
       display all three names:

            c:\> dir letter?.doc

       The file LETTER.DOC is included in the display because the
       "extra" question mark at the end of "LETTER?" is ignored when
       matching the shorter name LETTER.

       In some cases, the question mark wildcard may be too general.
       You can also specify what characters you want to accept (or
       exclude) in a particular position in the filename by using
       square brackets.  Inside the brackets, you can put the
       individual acceptable characters or ranges of characters.
       For example, if you wanted to match LETTER0.DOC through
       LETTER9.DOC, you could use this command:

            c:\> dir letter[0-9].doc

       You could find all files that have a vowel as the second
       letter in their name this way.  This example also
       demonstrates how to mix the wildcard characters:

            c:\> dir ?[aeiouy]*.*

       You can exclude a group of characters or a range of
       characters by using an exclamation mark [!] as the first
       character inside the brackets.  This example displays all
       filenames that are at least 2 characters long except those
       which have a vowel as the second letter in their names:

            c:\> dir ?[!aeiouy]*.*

       The next example, which selects files such as AIP, BIP, and
       TIP but not NIP, demonstrates how you can use multiple ranges
       inside the brackets.  It will accept a file that begins with
       an A, B, C, D, T, U, or V:

            c:\> dir [a-dt-v]ip

       You may use a question mark character inside the brackets,
       but its meaning is slightly different than a normal
       (unbracketed) question mark wildcard.  A normal question mark
       wildcard matches any character, but will be ignored when
       matching a name shorter than the wildcard specification, as
       described above.  A question mark inside brackets will match
       any character, but will not be discarded when matching
       shorter filenames.  For example:

            c:\> dir letter[?].doc

       will display LETTER1.DOC and LETTERA.DOC, but not LETTER.DOC.

       A pair of brackets with no characters between them [], or an
       exclamation point and question mark together [!?], will match
       only if there is no character in that position.  For example:
  -67-

            [c:\] dir letter[].doc

       will not display LETTER1.DOC or LETTERA.DOC, but will display
       LETTER.DOC.  This is most useful for commands like:

            [c:\] dir /I"[]" *.btm

       which will display a list of all .BTM files which don't have
       a description, because the empty brackets match only an empty
       description string (DIR /I selects files to display based on
       their descriptions).

       You can repeat any of the wildcard characters in any
       combination you desire within a single file name.  For
       example, the following command lists all files which have an
       A, B, or C as the third character, followed by zero or more
       additional characters, followed by a D, E, or F, followed
       optionally by some additional characters, and with an
       extension beginning with P or Q.  You probably won't need to
       do anything this complex, but we've included it to show you
       the flexibility of extended wildcards:

            c:\> dir ??[abc]*[def]*.[pq]*

       You can also use the square bracket wildcard syntax to work
       around a conflict between long filenames containing
       semicolons [;], and the use of a semicolon to indicate an
       include list (see page 73).  For example, if you have a file
       on an HPFS drive named C:\DATA\LETTER1;V2 and you enter this
       command:

            [c:\] del \data\letter1;v2

       you will not get the results you expect.  Instead of deleting
       the named file, 4DOS, 4OS2 or 4NT will attempt to delete
       LETTER1 and then V2, because the semicolon indicates an
       include list.  However, if you use square brackets around the
       semicolon it will be interpreted as a filename character, and
       not as an include list separator.  For example, this command
       would delete the file named above:

            [c:\] del \data\letter1[;]v2


       Date, Time, and Size Ranges

       Most internal commands which accept wildcards also allow
       date, time, and size ranges to further define the files that
       you wish to work with.  4DOS, 4OS2, and 4NT will examine each
       file's size and timestamp (a record of when the file was
       created, last modified, or last accessed) to determine if the
       file meets the range criteria you have specified.

       A range begins with the switch character (usually a slash
       [/]), followed by a left square bracket ("[") and a character
       that specifies the range type:  "s" for a size range, "d" for
       a date range, or "t" for a time range.  The "s", "d", or "t"
  -68-

       is followed by a start value, and an optional comma and end
       value.  The range ends with a right square bracket ("]").
       For example, to select files between 100 and 200 bytes long
       you could use the range /[s100,200].

       All ranges are inclusive.  For example, a size range which
       selects files from 10,000 to 20,000 bytes long will match
       files that are exactly 10,000 bytes and 20,000 bytes long, as
       well as all sizes in between; a date range that selects files
       last modified between 10-27-97 and 10-30-97 will include
       files modified on each of those dates, and on the two days in
       between.

       If you reverse range start and end values the command
       processor will recognize the reversal, and will use the
       second (lower) value as the start point of the range and the
       first (higher) value as its end point.  For example, the
       range above for files between 10 and 200 bytes long could
       also be entered as /[s200,100].


       Size Ranges

       Size ranges simply select files whose size is between the
       limits given.  For example, /[s10000,20000] selects files
       between 10,000 and 20,000 bytes long.

       Either or both values in a size range can end with "k" to
       indicate thousands of bytes, "K" to indicate kilobytes (1,024
       bytes), "m" to indicate millions of bytes, or "M" to indicate
       megabytes (1,048,576 bytes).  For example, the range above
       could be rewritten as /[s10k,20k].

       The second argument of a size range is optional.  If you use
       a single argument, like /[s10k], you will select files of
       that size or larger.  You can also precede the second
       argument with a plus sign [+]; when you do, it is added to
       the first value to determine the largest file size to include
       in the search.  For example,  /[s10k,+1k] select files from
       10,000 through 11,000 bytes in size.

       Some further examples of size ranges:

            Specification       Selects Files
            -------------       -------------

            /[s0,0]             of length zero (empty)
            /[s1M]              1 megabyte or more in length
            /[s10k,+200]        between 10,000 and 10,200 bytes


       Date Ranges

       Date ranges select files that were created or last modified
       at any time between the two dates.  For example,
       /[d12-1-97,12-5-97] selects files that were last modified
       between December 1, 1997, and December 5, 1997.
  -69-

       The time for the starting date defaults to 00:00:00 and the
       time for the ending date defaults to 23:59:59.  You can alter
       these defaults, if you wish, by including a start and stop
       time inside the date range.  The time is separated from the
       date with an at sign [@].  For example, the range
       /[d7-1-97@8:00a,7-3-97@6:00p] selects files that were
       modified at any time between 8:00 am on July 1, 1997 and 6:00
       pm on July 3, 1997.  If you prefer, you can specify the times
       in 24-hour format (e.g., @18:00 for the end time in the
       previous example).

       If you omit the second argument in a date range, the command
       processor substitutes the current date and time.  For
       example, /[d10-1-97] selects files dated between October 1,
       1997 and today.

       You can use an offset value for either the beginning or
       ending date, or both.  An offset begins with a plus sign [+]
       or a minus sign [-] followed by an integer.  If you use an
       offset for the second value, it is calculated relative to the
       first.  If you use an offset for the first (or only) value,
       the current date is used as the basis for calculation.  For
       example:

            Specification       Selects Files
            -------------       -------------

            /[d10-27-97,+3]     modified between 10-27-97 and
                                10-30-97

            /[d10-27-97,-3]     modified between 10-24-97 and
                                10-27-97

            /[d-0]              modified today (from today minus
                                zero days, to today)

            /[d-1]              modified yesterday or today (from
                                today minus one day, to today)

            /[d-1,+0]           modified yesterday (from today minus
                                one day, to zero days after that)

       As a shorthand way of specifying files modified today, you
       can also use /[d]; this has the same effect as the /[d-0]
       example shown above.

       To select files last modified n days ago or earlier, use
       /[d-n,1/1/80].  For example, to get a directory of all files
       last modified 3 days or more before today (i.e., those files
       not modified within the last 3 days), you could use this
       command:

            c:\> dir /[d-3,1/1/80]

       This reversed date range (with the later date given first)
       will be handled correctly by 4DOS, 4OS2, or 4NT.  It takes
       advantage of the facts that an offset in the start date is
  -70-

       relative to today, and that the base or "zero" point for PC
       file dates is January 1, 1980.

       You cannot use offsets in the time portion of a date range
       (the part after an at sign), but you can combine a time with
       a date offset.  For example, /[d12-8-97@12:00,+2@12:00]
       selects files that were last modified between noon on
       December 8 and noon on December 10, 1997.  Similarly,
       /[d-2@15:00,+1] selects files last modified between 3:00 pm
       the day before yesterday and the end of the day one day after
       that, i.e., yesterday.  The second time defaults to the end
       of the day because no time is given.

       See Using Ranges below for information on selecting files
       based on creation or access time, rather than modification
       time.


       Time Ranges

       A time range specifies a file modification time without
       reference to the date.  For example, to select files modified
       between noon and 2:00 pm on any date, use /[t12:00p,2:00p].
       The times in a time range can either be in 12-hour format,
       with a trailing "a" for AM or "p" for PM, or in 24-hour
       format.

       If you omit the second argument in a time range, you will
       select files that were modified between the first time and
       the current time, on any date.  You can also use offsets,
       beginning with a plus sign [+] or a minus sign [-] for either
       or both of the arguments in a time range.  The offset values
       are interpreted as minutes.  Some examples:

            Specification       Selects Files
            -------------       -------------

            /[t12:00p,+120]     modified between noon and 2:00 PM on
                                any date
            /[t-120,+120]       modified between two hours ago and
                                the current time on any date
            /[t0:00,11:59]      modified in the morning on any date

       See the next section for information on selecting files based
       on creation or access time, rather than modification time.


       Using Ranges

       If you combine two types of ranges, a file must satisfy both
       ranges to be included.  For example, /[d2-8-97,2-9-97]
       /[s1024,2048] means files last modified on February 8 or
       February 9, 1997, which are also between 1,024 and 2,048
       bytes long.

       When you use a date, time, or size range in a command, it
       should immediately follow the command name.  Unlike some
  -71-

       command switches which apply to only part of the command
       line, the range usually applies to all file names specified
       for the command.  Any exceptions are noted in the
       descriptions of individual commands.

       For example, to get a directory of all the *.C files dated
       October 1, 1997, you could use this command:

            c:\> dir /[d10-1-97,+0] *.c

       To delete all of the 0-byte files on your hard disk, you
       could use this command:

            c:\> del /[s0,0] *.* /s

       And to copy all of the non-zero byte files that you changed
       yesterday or today to your floppy disk, you can use this
       command:

            c:\> copy /[d-1] /[s1] *.* a:

       Date, time, and size ranges can be used with the ATTRIB,
       COPY, DEL, DESCRIBE, DIR, EXCEPT, FOR, LIST, MOVE, RD, REN,
       SELECT, and TYPE commands.  They cannot be used with filename
       completion or in filename arguments for variable functions.

    ## It can be complex to type all of the elements of a range,
       especially when it involves multiple dates and times.  In
       this case you may find it easier to use aliases for common
       operations.  For example, if you often wish to select from
       .DAT files modified over the last three days and copy the
       selected files to the floppy disk, you might define an alias
       like this:

            alias workback `select /[d-2] copy (*.dat) a:`

       For more complex requirements, you may want to use internal
       variables (e.g. _DATE or _TIME, see page 110) and variable
       functions (e.g. @DATE, @TIME, @MAKEDATE, @MAKETIME,
       @FILEDATE, @FILETIME, or @EVAL, see page 119).  These
       variables and functions allow you to perform arithmetic and
       date / time calculations.

       The FAT file system maintains a single date and time for each
       file, reflecting the last time the file was written.  This is
       the date and time used by 4DOS on a FAT drive with no LFN
       support (e.g. under MS-DOS 6.22, PC-DOS 7, or OS/2).

       The HPFS, NTFS, and LFN file systems maintain 3 sets of dates
       and times for each file: creation, last access, and last
       write.  By default, date and time ranges work with the last
       write time stamp.  You can use the "last access" (a) or
       "created" (c) time stamp in a date or time range with the
       syntax:

            /[da...]  or  /[dc...]  or .. /[ta...]  or  /[tc...]
  -72-

       For example, to select files that were last accessed
       yesterday or today:

            /[da-1]

4DOS,  The LFN file systems used by Windows 95, and by Windows NT on
4NT    FAT volumes, store an incomplete time stamp for last access.
       You can select files by the date of last access but not by
       the time of last access, since the time of last access is not
       retained by the operating system.


       File Exclusion Ranges

       Most internal commands which accept wildcards also accept
       file exclusion ranges to further define the files that you
       wish to work with.  4DOS, 4OS2, and 4NT examine each file
       name and exclude files that match the names you have
       specified in a file exclusion range.

       A file exclusion range begins with the switch character
       (usually a slash), followed by a left square bracket and an
       exclamation mark ("[!")  The range ends with a right square
       bracket ("]").

       Inside the brackets, you can list one or more filenames to be
       excluded from the command.  The filenames can include
       wildcards and extended wildcards, but cannot include path
       names or drive letters.

       The following example will display all files in the current
       directory except backup files (files with the extension .BAK
       or .BKP):

            c:\> dir /[!*.bak *.bkp] *.*

       You can combine file exclusion ranges with date, time, and
       size ranges (see page 67).  This example displays all files
       that are 10K bytes or larger in size and that were created in
       the last 7 days, except .C and .H files:

            c:\> dir /[s10k] /[d-7] /[!*.c *.h] *.*

       File exclusion ranges will only work for 4DOS, 4OS2, and 4NT
       internal commands.  The EXCEPT command (page 255) can be used
       to exclude files from processing by many external commands.


       Multiple Filenames

       Most file processing commands can work with multiple files at
       one time.  To use multiple file names, you simply list the
       files one after another on the command line, separated by
       spaces.  You can use wildcards in any or all of the
       filenames.  For example, to copy all .TXT and .DOC files from
       the current directory to drive A, you could use this command:
  -73-

            c:\> copy *.txt *.doc a:

       If the files you want to work with are not in the default
       directory, you must include the full path with each filename:

            c:\> copy a:\details\file1.txt a:\details\file1.doc c:

       Multiple filenames are handy when you want to work with a
       group of files which cannot be defined with a single filename
       and wildcards.  They let you be very specific about which
       files you want to work with in a command.

    !  When you use multiple filenames with a command that expects
       both a source and a destination, like COPY or MOVE, be sure
       that you always include a specific destination on the command
       line.  If you don't, the command will assume that the last
       filename is the destination and may overwrite important
       files.

       Like extended wildcards and include lists (see below),
       multiple filenames will work with internal commands but not
       with external programs, unless those programs have been
       written to handle multiple file names on the command line.

       If you have a list of files to process that's too long to put
       on the command line or too time-consuming to type, see FOR on
       page 263 or SELECT on page 353 for other ways of passing
       multiple file names to a command.


       Include Lists

       Any internal command that accepts multiple filenames will
       also accept one or more include lists.  An include list is
       simply a group of filenames, with or without wildcards,
       separated by semicolons [;].  All files in the include list
       must be in the same directory.  You may not add a space on
       either side of the semicolon.

       If you used an include list instead of multiple file names
       for the previous examples, they would look like this:

            c:\> copy *.txt;*.doc a:
            c:\> copy a:\details\file1.txt;file1.doc c:

       Include lists are similar to multiple filenames, but have
       three important differences.  First, you don't have to repeat
       the path to your files if you use an include list, because
       all of the included files must be in the same directory.
       Second, if you use include lists, you aren't as likely to
       accidentally overwrite files if you forget a destination path
       for commands like COPY, because the last name in the list
       will be part of the include list, and won't be seen as the
       destination file name.  (Include lists can only be used as
       the source parameter -- the location files are coming from --
       for COPY and other similar commands.  They cannot be used to
       specify a destination for files.)
  -74-

       Third, multiple filenames and include lists are processed
       differently by the DIR and SELECT commands.  If you use
       multiple filenames, all of the files matching the first
       filename are processed, then all of the files matching the
       second name, and so on.  When you use an include list, all
       files that match any entry in the include list are processed
       together, and will appear together in the directory display
       or SELECT list.  You can see this difference clearly if you
       experiment with both techniques and the DIR command.  For
       example:

            c:\> dir *.txt *.doc

       will list all the .TXT files with a directory header, the
       file list, and a summary of the total number of files and
       bytes used.  Then it will do the same for the .DOC files.
       However,

            c:\> dir *.txt;*.doc

       will display all the files in one list.

       Like extended wildcards and multiple filenames (see above),
       include lists will work with internal commands, but not with
       external programs (unless they have been programmed to
       support them).  The maximum length of an include list is 260
       characters.


       LFN File Searches

    ## Under Windows 95 and Windows NT (version 3.5 and later),
       files on VFAT volumes can have both a long file name (LFN)
       and a short FAT-compatible file name.  4NT and 4DOS (under
       Windows 95) normally examine both forms of each file name
       when searching for files.  They do so in order to remain
       compatible with the default command processors, CMD.EXE and
       COMMAND.COM.

       The long filename is checked first, and if it does not match
       then the short name is checked.  Matching files which have
       only a short filename will be found during the first search,
       because in that case Windows treats the short name as if it
       were a long name.

       For example, suppose you have two files in a directory with
       these names:

            Long Name                Short Name
            ---------                ----------

            Letter Home.DOC          LETTER~1.DOC
            Letter02.DOC             LETTER02.DOC

       A search for LETTER??.DOC will find both files.  The second
       file (LETTER02.DOC) will be found during the search of long
  -75-

       filenames.  The first file ("Letter Home.DOC") will be found
       during the search of short filenames.

    !  Take extra care when you use wildcards to perform operations
       on LFN volumes because you may select more files than you
       intended.  For example, both Windows 95 and Windows NT often
       create short filenames that end "~1.", "~2.", etc.  If you
       use a command like:

            del *1.*

       you will delete all such files, including most files with
       long filenames, which is probably not the result you
       intended!

4DOS   Under 4DOS, you can change this default behavior with the
       Win95SFNSearch directive in 4DOS.INI.  Set Win95SFNSearch to
       No to disable the secondary short filename search.  This will
       prevent the potential problem described above, but will make
       4DOS's behavior inconsistent with that of COMMAND.COM.


       Executable Extensions

       Normally, when you type a filename (as opposed to an alias or
       internal command name) as the first word on the command line,
       the command processor looks for a file with that name to
       execute.  The file's extension may be .EXE or .COM to
       indicate that it contains a program, or it may have a batch
       file extension like .BTM (under OS/2, a file's contents may
       also indicate that it is executable).

       The exact list of default extensions for executable files
       varies slightly depending on which operating system you use,
       because each has its own rules for batch file extensions (see
       page 18 for details).

       You can add to the default list of extensions, and have 4DOS,
       4OS2, or 4NT take the action you want with files that are not
       executable programs or batch files.  The action taken is
       always based on the file's extension.  For example, you could
       start your text editor whenever you type the name of a .DOC
       file, or start your database manager whenever you type the
       name of a .DAT file.

4NT    Windows also includes the ability to associate file
       extensions with specific applications.  See the next section
       for details on Windows file associations and their
       relationship to 4NT executable extensions.

       You can use environment variables to define the internal
       command, external program, batch file, or alias to run for
       each defined file extension.  To create an executable
       extension, use the SET command to create a new environment
       variable.  An environment variable is recognized as an
       executable extension if its name begins with a period.
  -76-

       For example, if you want to run a word processor called
       EDITOR whenever you type the name of a file that has an
       extension of .EDT, you could use this command:

            c:\> set .edt=c:\edit\editor.exe

       The syntax for creating an executable extension is:

            set .ext=command [options]

       where .EXT is the executable file extension; command is the
       name of the internal command, external program, alias, or
       batch file to run; and [options] are any command-line startup
       options you want to specify for the program, batch file, or
       alias.

       If the command is a batch file or external program, the
       command processor will search the PATH for it if necessary.
       However, you can make sure that the correct program or batch
       file is used, and speed up the executable extension, by
       specifying the full name including drive, path, filename, and
       extension.

       Once an executable extension is defined, any time you name a
       file with that extension the corresponding program, batch
       file, or alias is started, with the name of your file passed
       to it as a parameter.

       The following example defines B.EXE (the Boxer text editor)
       as the processor for .MAK files:

            c:\> set .mak=c:\boxer\b.exe -s

       With this definition, if you have a file named INIT.MAK in
       the current directory and enter the command:

            c:\source> init

       the command processor will execute the command:

            c:\boxer\b.exe -s c:\source\init.mak

       Notice that the full pathname of INIT.MAK is automatically
       included.  If you enter parameters on the command line, they
       are appended to the end of the command.  For example, if you
       changed the above entry to:

            c:\source> init -w

       the command processor would execute the command:

            c:\boxer\b.exe -s c:\source\init.mak -w

       In order for executable extensions to work, the command,
       program, batch file, or alias must be able to interpret the
       command line properly.  For example, if a program you want to
       run doesn't accept a file name on its command line as shown
  -77-

       in these examples, then executable extensions won't work with
       that program.

    ## Executable extensions may include wildcards, so you could,
       for example, run your text editor for any file with an
       extension beginning with T by defining an executable
       extension called .T*.  Extended wildcards (e.g., DO[CT] for
       .DOC and .DOT files) may also be used.

       The search for executable files starts in the current
       directory, then proceeds to each subdirectory specified by
       the PATH environment variable (if a "." is used in the PATH
       the current directory is not searched first; see the PATH
       command on page 331 for details).

       You may need to take this search order into account when
       using executable extensions.  Using the .MAK example above,
       if you had a file named FORMAT.MAK in the current directory
       and entered the command FORMAT A:, your command would run the
       Boxer editor specified by the executable extension, instead
       of finding the standard DOS FORMAT command as you perhaps
       intended.  You can get around this by remembering that the
       DOS FORMAT command is in the file FORMAT.COM.  If you entered
       the command FORMAT.COM A: then the .MAK executable extension
       would not be checked, and the search would continue until it
       found the FORMAT.COM file.

       To remove an executable extension, use the UNSET command (see
       page 399) to remove the corresponding variable.


4NT    Using Windows NT File Associations

       Windows NT includes the ability to associate file extensions
       with specific applications; this feature is sometimes called
       "file associations".  For example, within Windows NT a
       graphics program might be associated with files with a .BMP
       extension, while Notepad could be associated with files with
       a .TXT extension.  Windows NT supports two different kinds of
       file associations ("direct" and "indirect"); for a complete
       description see page 20.

       When you attempt to start an application from the command
       line or a batch file, 4NT first searches for an external
       program file with a standard extension (.COM, .EXE, etc.).
       It then checks 4NT executable extensions, followed by direct
       file associations inherited from Windows NT.  If  all of
       these tests fail, 4NT passes the command name to Windows NT
       to see if it can find an indirect association.

       4NT offers two commands which provide limited control over
       indirect file associations.  Both should be used with caution
       to avoid creating errors in the registry or damaging existing
       file types.  The ASSOC command (see page 188) modifies or
       displays the associations between extensions and file types
       in the Windows registry.  The FTYPE command (page 273)
  -78-

       modifies or displays the command used to open a file of a
       specified type.

       Executable extensions defined in 4NT always take precedence
       over the direct and indirect file associations defined in
       Windows NT.  For example, if you associate the .TXT extension
       with your own editor using a 4NT executable extension, and
       Windows NT has associated .TXT with Notepad, your setting
       will have priority, and the association with Notepad will be
       ignored when you invoke a .TXT file from within 4NT.

       Unfortunately, it is not unusual to find both a direct
       association and an indirect association in the Windows NT
       registry for the same extension.  This can happen when an
       ill-behaved install or uninstall program modifies the wrong
       registry entry, or when a 16-bit application registers one
       type of association and a 32-bit application registers the
       other type for the same extension.  For example, you might
       have a direct association between .GIF files and one graphics
       program, and an indirect association between .GIF files and
       another graphics application.  When this happens 4NT will
       find the direct association first, which may not be the
       result you want.

       To address such problems, you can correct the registry
       entries (use extreme caution when modifying the registry
       manually as errors in the registry can prevent your system
       from booting); create a 4NT executable extension which
       explicitly specifies the application to run; disable the
       loading of direct associations from the Startup page of the
       OPTION dialogs, or with a LoadAssociations = No directive in
       the .INI file; or disable an individual association with the
       UNSET command (see below).

       You can also disable individual direct file associations
       while you are working in 4NT.  To do so, use the UNSET
       command plus the appropriate file extension for each
       association that you want 4NT to ignore.  UNSET will disable
       that file association within 4NT, but will not affect the use
       of the association by other Windows NT applications.  For
       example, to disable a direct association between .WAV files
       and a sound player while you are working in 4NT, you could
       use this command:

            c:\> unset .wav

       This approach can only be used to disable direct
       associations.  Indirect associations cannot be disabled
       (although they can be overridden with a 4NT executable
       extension).


4NT    Using Internet URLs

       If you type an Internet URL (Uniform Resource Locator) which
       begins with http: at the prompt, 4NT will pass the URL to
       Windows NT.  Normally Windows NT will start your web browser,
  -79-

       and request that the browser retrieve the page pointed to by
       the URL.  This feature will only work if Windows NT can find
       the proper association between the http: prefix and the
       browser software.  While this association is standard for
       most browser installations, it may not be present on all
       systems.

       The ability to "start" URLs in this way is restricted to
       those beginning with http:.  Other standard prefixes such as
       ftp:, mail:, and news: cannot be started directly from the
       prompt; you must enter these URLs directly into the browser
       software.

       See Waiting for Applications to Finish below for information
       on problems with waiting for the browser to finish after
       starting a URL.


  Waiting for Applications to Finish

4OS2,  (This section applies only to 4OS2 and 4NT.  You cannot
4NT    control how 4DOS waits for applications started from the
       prompt.)

       When you start an OS/2 Presentation Manager application
       (under 4OS2) or a Windows application (under 4NT) from the
       prompt, the command processor does not normally wait for the
       application to finish before returning to the prompt.  This
       allows you to continue your work at the prompt while the
       application is running.  You can force 4OS2 and 4NT to wait
       for applications to finish before continuing by selecting the
       "Wait for Completion" option on the Options 2 page of the
       OPTION dialogs, with the ExecWait directive in the .INI file
       (see page 156), or with the START command's /WAIT switch
       (START can also control many other aspects of how your
       applications are started).

       Regardless of the ExecWait setting, 4OS2 and 4NT always wait
       for applications which are run from batch files before
       continuing with subsequent commands in the batch file.  To
       start an application from a batch file and continue with the
       batch file immediately, without waiting for the application
       to finish, use the START command (without the /WAIT switch).

4NT    Due to the way Windows NT handles URLs, you cannot wait for
       the browser software to finish when you enter an http: URL at
       the prompt; in this situation, 4NT always displays the next
       prompt immediately.


  Critical Errors

       DOS, OS/2, and Windows NT all watch for physical errors
       during input and output operations.  Physical errors are
       those due to hardware problems, such as trying to read a
       floppy disk while the drive door is open.
  -80-

       These errors are called critical errors because the operating
       system, command processor, or application cannot proceed
       until the error is resolved.

       When a critical error occurs, you will see a message asking
       you to choose one of four error handling options.  The
       message comes from the command processor or the operating
       system, and will vary slightly depending on your operating
       system and (under OS/2 and Windows NT) whether you are in
       full-screen or windowed mode.  You can respond with a single
       character (under DOS), or a mouse click or menu selection
       (under OS/2 or Windows).  However, the options and their
       meanings are similar in all cases:

            Retry   Retry the operation.  Choose this option if you
                    have corrected the problem.

            Ignore  Ignore the error and continue.  Use caution when
                    choosing this option.  Ignoring critical errors,
                    especially on the hard disk, can cause
                    additional errors or damage data on the disk.

            Fail    Tell the program that the operation failed.
                    This option returns an error code to the command
                    processor or to the application program that was
                    running when the error occurred.  4DOS, 4OS2,
                    and 4NT generally stop the current command when
                    an operation fails.  This option is not
                    available for all errors; if you don't see it,
                    use Abort instead.  Under DOS, you can force a
                    Fail response to all critical errors with the
                    CritFail directive in 4DOS.INI (see page 166).

            Abort   Abort the program.  Choose this option to stop
                    the program that was running when the error
                    occurred.  Choosing Abort after an error in 4DOS
                    or 4NT will abort the command, but not the
                    command processor itself.  Choosing Abort after
                    an error in 4OS2 will abort both the command and
                    the command processor.  To avoid this, use Fail
                    rather than Abort.


  ##  Advanced Features

       The next three features are designed for advanced users.  If
       you are a novice user, you might want to skim over this
       section and return to it as your computing skills and needs
       progress.


       Conditional Commands

       When an internal command or external program finishes, it
       returns a result called the exit code.  Conditional commands
       allow you to perform tasks based upon the previous command's
  -81-

       exit code.  Many programs return a 0 if they are successful
       and a non-zero value if they encounter an error.

       If you separate two commands by && (AND), the second command
       will be executed only if the first returns an exit code of 0.
       For example, the following command will only erase files if
       the BACKUP operation succeeds:

            c:\> backup c:\ a: && del c:\*.bak;*.lst

       If you separate two commands by || (OR), the second command
       will be executed only if the first returns a non-zero exit
       code.  For example, if the following BACKUP operation fails,
       then ECHO will display a message:

            c:\> backup c:\ a: || echo Error in the backup!

       All internal commands return an exit code, but not all
       external programs do.  Conditional commands will behave
       unpredictably if you use them with external programs which do
       not return an explicit exit code.  To determine whether a
       particular external program returns a meaningful exit code
       use an ECHO %? command immediately after the program is
       finished.  If the program's documentation does not discuss
       exit codes you may need to experiment with a variety of
       conditions to see how the exit code changes.


       Command Grouping

       Command grouping allows you to logically group a set of
       commands together by enclosing them in parentheses.  The
       parentheses are similar in function to the BEGIN and END
       block statements in some programming languages.

       There are two primary uses for command grouping.  One is to
       execute multiple commands in a place where normally only a
       single command is allowed.  For example, suppose you want to
       execute two different REN commands in all subdirectories of
       your hard disk.  You could do it like this:

            c:\> global ren *.wx1 *.wxo
            c:\> global ren *.tx1 *.txo

       But with command grouping you can do the same thing in one
       command:

            c:\> global (ren *.wx1 *.wxo ^ ren *.tx1 *.txo)

       The two REN commands enclosed in the parentheses appear to
       GLOBAL as if they were a single command, so both commands are
       executed for every directory, but the directories are only
       scanned once, not twice.  (To use a command like this under
       4OS2 or 4NT, replace the caret [^] with an ampersand [&].)

       This kind of command grouping is most useful with the EXCEPT,
       FOR, GLOBAL, and IF commands.  When you use this approach in
  -82-

       a batch file you must either place all of the commands in the
       group on one line, or place the opening parenthesis at the
       end of a line and place the commands on subsequent lines.
       For example, the first two of these sequences will work
       properly, but the third will not:

            for %f in (1 2 3) (echo hello %f ^ echo goodbye %f)

            for %f in (1 2 3) (
                 echo hello %f
                 echo goodbye %f
            )

            for %f in (1 2 3) (echo hello %f
            echo goodbye %f)

       The second common use of command grouping is to redirect
       input or output for several commands without repeatedly using
       the redirection symbols.  For example, consider the following
       batch file fragment which places some header lines (including
       today's date) and directory displays in an output file using
       redirection.  The first ECHO command creates the file using
       >, and the other commands append to the file using >>:

            echo Data files %_date > filelist
            dir *.dat >> filelist
            echo. >> filelist
            echo Text files %_date >> filelist
            dir *.txt >> filelist

       Using command grouping, these commands can be written much
       more simply.  Enter this example on one line (use an
       ampersand [&] as the command separator if you try this under
       4OS2 or 4NT):

            (echo Data files %_date ^ dir *.dat ^ echo. ^ echo Text
            files %_date ^ dir *.txt) > filelist

       The redirection, which appears outside the parentheses,
       applies to all the commands within the parentheses.  Because
       the redirection is performed only once, the commands will run
       slightly faster than if each command was entered separately.
       The same approach can be used for input redirection and for
       piping.

       You can also use command grouping in a batch file or at the
       prompt to split commands over several lines.  This last
       example is like the redirection example above, but is entered
       at the prompt.  Note the "More?" prompt after each incomplete
       line.  None of the commands are executed until the command
       group is completed with the closing parenthesis.  This
       example does not have to be entered on one line:

            c:\> (echo Data files %_date
            More? dir *.dat
            More? echo.
            More? echo Text files %_date
  -83-

            More? dir *.txt) > filelist
            c:\>

       A group of commands in parentheses is like a long command
       line.  The total length of the group may not exceed 511
       characters in 4DOS, or 2,047 characters in 4OS2 and 4NT,
       whether the commands are entered from the prompt, an alias,
       or a batch file.  The limit includes the space required to
       expand aliases and environment variables used within the
       group.  In addition, each line you type at the normal prompt
       or the More? prompt, and each individual command within the
       line, must meet the usual length limits:  255 characters in
       4DOS, or 1,023 characters in 4OS2 and 4NT.


       Escape Character

       4DOS, 4OS2, and 4NT recognize a user-definable escape
       character.  This character gives the following character a
       special meaning; it is not the same as the ASCII ESC that is
       often used in ANSI and printer control sequences.

       The default 4DOS escape character is Ctrl-X (ASCII 24), which
       will be displayed here -- and on your screen -- as an up
       arrow.  The default 4OS2 and 4NT escape character is a caret
       [^].

       If you don't like using the default escape character, you can
       pick another character using the SETDOS /E command (see page
       365), the Options 1 page of the OPTION dialogs, or the
       EscapeChar directive in your .INI file (see page 156).  If
       you plan to share aliases or batch files between 4DOS, 4OS2,
       and 4NT, see page 136 for details about choosing compatible
       escape characters for two or more products.

       Ten special characters are recognized when they are preceded
       by the escape character.  The combination of the escape
       character and one of these characters is translated to a
       single character, as shown below.  These are primarily useful
       for redirecting codes to the printer; a Ctrl-X or caret
       followed by the letter e is also useful to generate ANSI
       "escape sequences" in your PROMPT, ECHO, or other output
       commands.  The special characters which can follow the escape
       character are:

            b       backspace
            c       comma
            e       the ASCII ESC character (ASCII 27)
            f       form feed
            k       back quote
            n       line feed
            q       double quote
            r       carriage return
            s       space
            t       tab character
  -84-

       If you follow the escape character with any other character,
       the escape character is removed and the second character is
       copied directly to the command line.  This allows you to
       suppress the normal meaning of special characters (such as ?
       * / \ | " ` > < and &).  For example, to display a message
       containing a > symbol, which normally indicates redirection:

            c:\> echo 2 is [Ctrl-X]> 4

       To send a form feed followed by the sequence ESC Y to the
       printer, you can use this command:

            c:\> echos [Ctrl-X]f[Ctrl-X]eY > prn

       where [Ctrl-X] represents the up-arrow character (in 4OS2 and
       4NT replace the [Ctrl-X] in these examples with a caret [^]).

       The escape character has an additional use when it is the
       last character on any line of a .BAT or .BTM batch file.
       4DOS, 4OS2, and 4NT recognize this use of the escape
       character to signal line continuation:  the command processor
       removes the escape character and appends the next line to the
       current line before executing it.
