;---------------------------------------------------------------------------
; Copyright 1988 - 2004, JP Software Inc., All Rights Reserved.
; Published by JP Software Inc., P.O. Box 328, Chestertown, MD  21620, USA.
;
;   This is a variant help text for Luchezar Georgiev's updated release
;   of 4DOS.
;
;   Changes since 2006-04-04:
;
;   2006-12-15 CED   Changes for build 136:  Startup option /Y reenabled
;                    (yeah!); changes to RMDIR, SET, SHIFT, @FILESIZE.
;                    Stripped out the wishlist and change log pages.
;
;   2006-12-22 LIG   Changes for build 140:  Removed warning about @READY.
;                    Added _CPU information about the Pentium 4 and newer.
;
;   2006-12-24 LIG   Changes for build 141:  Added gigabyte suffix to file
;                    size ranges and units pages, and for DIR /4.
;
;   2006-12-26 LIG   Added help for @SERIAL and compatibility information
;                    about CADStar PCB.
;
;   2006-12-30 LIG   Changes for build 144:  Added /V option to TYPE.
;                    Added SMARTDRV cache flushing and /P option to REBOOT.
;
;   2007-1-6   LIG   Changes for build 145:  Added EJECTMEDIA and CLOSETRAY.
;                    Added "DVD" to most places where a CD-ROM is mentioned.
;                    Added a @READY warning about some CD-ROM drivers.
;
;   2007-1-7   LIG   Changes for build 146:  Added @CWD and @CWDS functions.
;
;   2007-1-8   LIG   Changes for build 147:  Added @EVAL hex output option.
;                    Corrected the limits of @CONVERT value.
;
;   2007-1-31  LIG   Changes for build 151 (7.51):
;                    Changed some error strings to reflect changes in 4DOS.
;                    Updated version number which now equals 7.(build-100).
;
;   2007-2-4   LIG   Changes for build 152 (7.52):  Added /L option to LIST.
;
;   2007-2-15  LIG   Changes for build 153 (7.53):
;                    Maximal description length before wrapping decremented.
;                    Updated File Not Found & No More Files error messages.
;                    Second error list column condensed to hide less of it.
;
;   2007-4-20  LIG   Changes for build 154 (7.54):
;                    Added _ALT, _CAPSLOCK, _CTRL, _LSHIFT, _NUMLOCK,
;                          _RSHIFT, _SCROLLLOCK and _SHIFT variables.
;
;   2007-6-25  LIG   Changes for build 156 (7.56):
;                    Added _DATETIME and _MONTHF variables.
;                    Added @AGEDATE and @MONTHF functions.
;
;   2007-7-27  LIG   Changes for build 157 (7.57):  Added @FIELDS function.
;
;   2007-10-27 LIG   Changes for build 159 (7.59):  Added @MD5 function.
;
;   2008-5-24  LIG   Changes for build 164 (7.64):  Added EQC operator.
;
;   2008-6-11  LIG   Changes for build 165 (7.65):
;                    Added _LALT, _LCTRL, _RALT, _RCTRL variables.
;                    Changed and amended text for the _DOS variable.
;                    Added newer Windows versions to the Windows NT topic
;                    and changed the URL for 4NT (now named TCC).
;
;   2008-6-29  LIG   Changes for build 167 (7.67):
;                    Added _EXECSTR variable.
;                    Deleted the note about REBOOT not working in Windows 9x
;                    and added a similar note about the /P option.
;
;   2008-7-1   LIG   Changes for build 168 (7.68):
;                    Added a warning for REBOOT under Windows (important!).
;                    Deleted text saying REBOOT /P does not work in W9x/ME.
;                    Added text about showing the "brand string" for _CPU.
;
;   2008-7-4   LIG   Changes for build 169 (7.69):
;                    Added _STDIN, _STDOUT and _STDERR variables.
;                    Added @SHA1 function.
;
;   2008-7-9   LIG   Changes for build 170 (7.70):
;                    Added /N option and case-sensitive search to LIST.
;
;   2008-7-10  LIG   Changes for build 171 (7.71):
;                    Added _EDITMODE and _EXPANSION variables.
;                    Added user-defined function expansion (9) to SETDOS /X.
;
;   2008-7-15  LIG   Changes for build 172 (7.72):
;                    Added @LTRIM, @RTRIM and @TRUNCATE functions.
;                    Added text for @RANDOM to describe the new algorithm.
;                    Removed text on SETDOS /W failing in MS-/PC DOS/W9x/ME.
;                    and added a link to SETDOS in the UnixPaths topic.
;
;   2008-7-17  LIG   Added a recommendation to set Logo=0 in MSDOS.SYS.
;
;   2008-8-4   LIG   Changes for build 173 (7.73):
;                    Added @SMBSTR.
;                    Removed text in MEMORY and @EXTENDED topics saying that
;                    XMS excludes extended memory because it's no longer so.
;
;   2008-8-12  LIG   Changes for build 174 (7.74):
;                    Added @FILEREADB.
;                    Added text for the mode of @FILEWRITEB when length = -1
;
;   2008-8-24  LIG   Changes for build 175 (7.75):
;                    Added SET /E option.
;                    Added @AVERAGE and _SYSREQ.
;                    Added text that labels are not limited to 8 characters.
;
;   2008-8-29  LIG   Changes for build 176 (7.76):
;                    Added MOD operator for @EVAL.
;                    Added @ISODOWI, @ISOWEEK, _ISODOWI, _ISOWEEK.
;
;   2008-8-31  LIG   Changes for build 177 (7.77):
;                    Added _ISOWDATE.
;                    Added ISO week date input to Date Formats, DATE, TOUCH
;                    and ranges.
;                    Added format 5 (ISO week date) to @AGEDATE, @FILEDATE
;                    and @MAKEDATE.
;
;   2008-9-8   LIG   Changes for build 178 (7.78):
;                    Removed text for 55 ms DELAY resolution limit, updated
;                    maximum allowed delay and added default value.
;                    Added details for TIMER smallest and largest interval,
;                    documented its already existing OFF option and added /Q
;                    Added _TSC and _CPUSPEED.
;
;   2008-9-11  LIG   Changes for build 179 (7.79):
;                    Added _BATCHTYPE, _BDEBUGGER, _CMDSPEC, _V86 variables.
;                    Added @QUOTE and @UNQUOTE functions.
;                    Marked all 4DOS-unique variables and functions by '!'.
;
;   2008-9-14  LIG   Changes for build 180 (7.80):
;                    Added _ININAME and _TICK variables.
;                    Added @COUNT, @ISALNUM, @ISALPHA, @ISASCII, @ISCNTRL,
;                    @ISDIGIT, @ISPRINT, @ISPUNCT, @ISSPACE and @ISXDIGIT.
;
;   2008-9-17  LIG   Changes for build 181 (7.81):
;                    Added _CDROMS, _DRIVES, _ISOWYEAR and _READY variables.
;                    Added @DATECONV, @HISTORY, @ISOWYEAR, @SUBST and
;                    @UNQUOTES functions.
;
;   2008-9-19  LIG   Changes for build 182 (7.82):
;                    Added text that SETDOS /C|E|P accept decimal ASCII code
;                    Added $A and $K special characters to the PROMPT page.
;                    Added _HDRIVES variable.
;                    Added @CEILING, @DRIVETYPE and @FLOOR functions.
;
;   2008-9-22  LIG   Changes for build 183 (7.83):
;                    Added @COMPARE, @LCS and @REVERSE functions.
;
;   2008-9-24  LIG   Changes for build 184 (7.84):
;                    Added format 6 (ISO ordinal date)
;                    to @AGEDATE, @DATECONV, @FILEDATE and @MAKEDATE.
;                    Added _ISORDATE and _WINTICKS variables.
;                    Added @DIRSTACK and @SIMILAR functions.
;                    Reflected the actual order of lines shown by DIRS.
;
;   2008-9-26  LIG   Changes for build 185 (7.85):
;                    Added ISO ordinal date input
;                    to Date Formats, DATE, TOUCH and ranges.
;                    Added _STARTPATH variable.
;                    Noted that _WINTITLE now works also under W9x/ME.
;                    Updated the "Keywords" page.
;
;   2008-10-6   LIG  Changes for build 186 (7.86):
;                    Added _DST,_MJD,_STZN,_STZO,_TZN,_TZO,_UNIXTIME,
;                    _UTCDATE,_UTCDATETIME,_UTCHOUR,_UTCISODATE,_UTCMINUTE,
;                    _UTCSECOND,_UTCTIME.
;                    Updated the "Keywords" page.
;
;   2008-10-10  LIG  Changes for build 187 (7.87):
;                    Edited the TZ text to stress the universality and
;                    importance of this environment variable.
;                    Removed text on old CPU limitations for TIMER,_WINTICKS
;                    Added text that TITLEPROMPT works under OS/2 too.
;                    Added TITLE and moved most TITLEPROMPT text there.
;                    Updated the "Keywords" page.
;
;   2008-10-12  LIG  Changes for build 188 (7.88):
;                    Added hex input format for SETDOS /C|E|P, @CHAR and
;                    @FILEWRITEB (others accept it too but it's unusual).
;                    Added =X hex output format with a leading 0x for @EVAL.
;                    Added TRANSIENT.
;                    Updated the "Keywords" page.
;
;   2008-10-20  LIG  Changes for build 190 (7.90):
;                    Added IDLE.
;                    Updated the errors page.
;                    Updated the "Keywords" page.
;
;   2008-10-27  LIG  Changes for build 191 (7.91):
;                    Added COUNTRY.
;                    Updated the "Keywords" page.
;
;   2008-10-31  LIG  Changes for build 192 (7.92):
;                    Updated the KSTACK page for the /U(ninstall) option.
;                    Updated ALIAS, FUNCTION and SET pages for wildcards.
;                    Added @FSTYPE, _KEYSTACKED and _VCPI.
;                    Added VCPI in the glossary.
;                    Updated the "Keywords" page.
;
;   2008-11-7   LIG  Changes for build 193 (7.93):
;                    Added /E option to BATCOMP.
;                    Added _FONTPAGE.
;                    Updated the "Keywords" page.
;
;   2008-11-18  LIG  Changes for build 194 (7.94):
;                    Added notes for a possible crash of _CPUSPEED and _TSC.
;                    Added a V86 mode description in the glossary.
;                    Added @DDCSTR, _MACHINE, _NETWORK, _NLSFUNC and _SHARE.
;                    Updated the "Keywords" page.
;
;   2008-11-24  LIG  Changes for build 195 (7.95):
;                    @DDCSTR: Added a warning about switching to a VESA mode
;                    Added @CLUSTSIZE and @HDDSIZE functions.
;                    Added APPEND,_ASSIGN,_DISPLAY,_DRIVER,_EGA,_GRAFTABL,
;                    _GRAPHICS,_MSCDEX,_PRINT,_SMARTDRV,_TASKMAX and
;                    _TASKSWITCHER variables.
;                    Updated the "Keywords" page.
;
;   2008-12-1   LIG  Changes for build 196 (7.96):
;                    Added /M and /S options to REBOOT.
;                    Added @CODEPAGE and _POWER.
;                    Added a VESA description in the glossary.
;                    Updated the "Keywords" page.
;
;   2008-12-12  LIG  Changes for build 197 (7.97):
;                    Replaced the JP Software support forum with the
;                    comp.os.msdos.4dos newsgroup in the "Unsupported" topic.
;                    Removed the obsolete 4NT and Take Command descriptions.
;                    Rewrote the Copyright and Contacting JP Software topics.
;                    Added NO_SEP environment variable.
;                    Added _VDS variable.
;                    Added VDS definition in the glossary.
;                    Updated the "Keywords" page.
;
;   2008-12-19  LIG  Changes for build 198 (7.98):
;                    Added "svga" to the list of returned values for _VIDEO.
;                    Added @COM function and _SBDSP variable.
;                    Updated the "Keywords" page.
;
;   2008-12-29  LIG  Changes for build 199 (7.99):
;                    Updated the _CPU, _NPU, _CPUSPEED and Copyright pages
;                    (renamed the later to Legal).
;
;   2009-2-27  LIG   Changes for build 200 (8.00):
;                    Added SETERROR.
;                    Added /N option to ATTRIB.
;                    Added @ISLOWER and @ISUPPER functions.
;                    Updated the "Keywords" page.
;
;---------------------------------------------------------------------------
!WIDTH 80
!FIRST 1
!KEYS 13
!EXTERNAL HELP.COM DOSHELP
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 1 Table of Contents
!NOINDEX

Welcome to the 731free 4DOS 8.00 help system.  Please select a topic area:

!NOWRAP
Using 4DOS                    031Using the Command Line
                              071File Selection
                              047Directory Navigation
                              046Other Features

Commands                      592Commands by Category
                              593Commands by Name

Aliases and Batch Files       101Aliases
                              102Batch Files

The Environment               131Using the Environment
                              161Internal Variables
                              241Variable Functions

Configuring 4DOS              3514DOS.INI

Setup and Troubleshooting     352Starting 4DOS
                              719Error Messages
                              751Compatibility
                              720Troubleshooting

Additional Help               012The 4DOS Help System
                              0004DOS Help Index
                              016External (DOS) Help

Reference Information         941File Systems and File Name Conventions
                              891Miscellaneous Reference Information
                              911ASCII and Key Codes
                              920An Embarrassment of Riches
                              971Glossary
                              011Legal

!WRAP
;;version
                                                 [2009-2-27 CED/LIG -- 8.00]
;---------------------------------------------------------------------------
; Topic equates for index ---------------------------------------------
!TOPIC 1001 =31  Cmd Line
!INDEX 1
!TOPIC 1002 =71  File Sel
!INDEX 2
!TOPIC 1003 =47  Dir Nav
!INDEX 3
!TOPIC 1004 =46  Other Feat
!INDEX 4
!TOPIC 1005 =592 Commands
!INDEX 5
!TOPIC 1006 =101 Aliases
!INDEX 6
!TOPIC 1007 =102 Batch File
!INDEX 7
!TOPIC 1008 =131 Environ
!INDEX 8
!TOPIC 1009 =161 Variables
!INDEX 9
!TOPIC 1010 =241 Functions
!INDEX 10
!TOPIC 1011 =351 4DOS.INI
!INDEX 11
!TOPIC 1012 =352 Startup
!INDEX 12
!TOPIC 1014 =719 Errors
!INDEX 14
!TOPIC 1015 =751 Compat
!INDEX 15
!TOPIC 1017 =720 Support
!INDEX 17
!TOPIC 1018 =12  Help Sys
!INDEX 18
!TOPIC 1019 =16  DOS Help
!INDEX 19
!TOPIC 1020 =941 File Sys
!INDEX 20
!TOPIC 1021 =891 Reference
!INDEX 21
!TOPIC 1022 =911 Codes
!INDEX 22
!TOPIC 1024 =971 Glossary
!INDEX 24
!TOPIC 1025 =11  Legal
!INDEX 25
;---------------------------------------------------------------------------
!TOPIC 11 Legal
!NOINDEX
 Ŀ
  Help Text Copyright 1988-2004,  JP Software Inc., Worton, MD, USA      
  Changes Charles Dye 2004-2006 JP Software is not responsible for any 
  & Luchezar Georgiev 2006-2009.  inaccuracies introduced in this text. 
 
The help system is based on an extensively modified version of the TPHELP
unit from TurboPower Software's Turbo Professional 5.2 Turbo Pascal toolkit.
Portions Copyright 1985-1986, Sunny Hill Software.
!LINE
Portions Copyright 1987-1992 TurboPower Software  Aristocrat Leisure Ltd.
Portions Copyright 1987-1992 Borland Software Corporation.

Software Copyright 1988-2004 Rex Conn and JP Software Inc.
!LINE
Portions Copyright 1983-2002 Watcom International Corporation  Sybase Inc.
!LINE
Portions Copyright 1985-1992 Microsoft Corporation.
!LINE
Portions Copyright 1991-1992 RSA Data Security Inc.
!LINE
Portions Copyright 1995-2004 The Internet Society.
!LINE
Portions Copyright 1996-2000 Vladimir Zakharychev.
!LINE
Portions Copyright 1991-1995 Mix Software Inc.
           Updates 2006-2009 Luchezar Georgiev and Jaelani Utomo

4DOS and 0204NT are trademarks of 732JP Software Inc. for its family
of character- mode command processors.  4DOS and 20Take Command are
registered trademarks of JP Software Inc.  JP Software, jpsoft.com, and all
JP Software's designs and logos are also trademarks of JP Software Inc.  All
other trademarked product and company names are the property of their
respective trademark holders.
;---------------------------------------------------------------------------
!TOPIC 12 The 4DOS Help System
!NOINDEX

For information on using the help system see:

        013Help Keys
        014Help Reference
        015Using the Mouse
        016External (DOS) Help
;---------------------------------------------------------------------------
!TOPIC 13 Help Keys
!NOINDEX

  Ŀ
   Scroll down                         Next link      Tab,         
   Scroll up                           Prev link      Shift-Tab,   
   Next page       PgDn, Space          Select link    Enter         
   Prev page       PgUp                                              
  Ĵ
   Back up / exit  Esc, Ctrl-B          Next topic     F8, Ctrl     
   Quick exit      Alt-F4, Ctrl-C       Prev topic     F7, Ctrl     
   Exit, no clear  Alt-X                                             
  Ĵ
   Search topic    F5, Ctrl-F           Go to index    F1            
   Search all      F6, Ctrl-G           Go to ToC      F2            
   Search again    Shift-F5/F6, Ctrl-N  External help  F4            
  Ĵ
   Print topic     F9, Ctrl-P           (Go to keys)   F3            
  

   Press Esc to return; press Enter or 014click here for more information.
;---------------------------------------------------------------------------
!TOPIC 14 Help Reference
!NOINDEX

The 4DOS help system includes complete help for all 4DOS internal commands
and most 4DOS features, and can allow you to load the DOS help system for
help on DOS external commands.  The information is fully cross-referenced,
so you can move easily among related commands.

This section explains in detail how to use and configure the 4DOS help
system.  The help system is easy to navigate and uses standard keystrokes
or mouse clicks to move between the table of contents, help text, and
cross-referenced topics.  In most cases you'll be able to find what you
want by experimenting, without studying the details below.  However if you
want to know what shortcuts are built into the system, reconfigure it to
your liking, or see the full range of options available, then read on.

For information on using the mouse see 015Using the Mouse.  For
information on customization options for use with the 380HelpOptions
directive in 4DOS.INI, see the end of this section.

The help system supports most screen heights, and will adjust the height of
the help index and text display to match the height of your screen.  The
width of the help text display is fixed at 80 characters.  To modify the
help colors see the section on HELPCFG below.

Starting the Help System

To start the help system and go to the table of contents, press F1 or
type HELP at the 4DOS prompt.

If you type part or all of a command on the line before you press F1, 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 the help table of contents and
you can pick the topic you want.

You can also invoke help for the word immediately above (or immediately to 
the left of) the cursor by pressing Ctrl-F1. (This can be useful when you 
need the syntax for a variable function.)

You can get help on a specific command by entering the command HELP
[command name] (for example, HELP COPY) at the 4DOS prompt.  You can use
this feature to obtain help on any topic -- not just on commands.  For
example, if you enter the command HELP _DOSVER you will see help for the
_DOSVER internal variable.

Quick Help

If you type the name of any internal command at the prompt, followed by a
slash and a question mark [e.g. COPY /?] then you will see help for the
command in a "quick-reference" style.  Output from a /? display may be
redirected with > or >>.

The /? option may not work correctly if you have used an alias to
redefine how an internal command operates.  To view the /? help for
such a command you must add an asterisk to the beginning of the command to
disable alias processing.  For example, if you have defined this alias:

     alias copy *copy /r

then the command COPY /? will be translated to COPY /R /?, which will not
work properly.  However, if you use *COPY /?, the alias will be ignored and
the /? will work as you intended.

Using the Keyboard

The following keys can be used within the HELP system (see 013Help Keys
for a quick-reference chart):

!NOWRAP
    F1            Display the help index.

    PgDn          Display the next page of text for the current topic.
     or Space

    PgUp          Display previous page of text for the current topic.

                 Select the next cross-reference, or scroll one line
                  toward the bottom of the topic (see below).

                 Select the previous cross-reference, or scroll one
                  line toward the top of the topic (see below).

    Tab           Select the next cross-reference.
     or 

    Shift-Tab     Select the previous cross-reference.
     or 

    Enter         Switch to the selected cross-reference topic.

    F8            Display help for the next topic in the index.
     or Ctrl 

    F7            Display help for the previous topic in the index.
     or Ctrl 

    F5            Find a string in the current help topic (a topic search).
     or Ctrl-F

    F6            Find a string in any help topic (a global search).
     or Ctrl-G

    Shift-F5      Find the next occurrence of the search string.
     or Ctrl-N

    F9            Print the current topic.
     or Ctrl-P

    Esc           Go back to the last topic you viewed (the help system
     or Ctrl-B    saves the last 15 topics).  If there is no previous
                  topic, exit from the help system.

    Alt-F4        Exit the help system immediately, without returning to
     or Ctrl-C    the index or Table of Contents.

    Alt-X         Exit the help system without restoring the screen
                  (leaves the topic you were viewing visible after you
                  exit).
!WRAP

F9 or Ctrl-P will print the topic on LPT1 at 58 lines per page.  You
can select another output device or file if you wish (you will be prompted
for the output device each time you print a topic).

If there are any cross-references highlighted in the text you can use the
Tab and arrow keys (Tab, Shift-Tab, , or ) to select a topic, and
<Enter> to switch to the selected topic.

You can also move between cross-reference topics by typing text which
matches the topic name.  For example, in the list of 593Commands by
Name you can jump to the DIR command by typing DI.

You can use F5 or Ctrl-F to search the current topic for a string, and
F6 or Ctrl-G to search all topics, starting with the current topic (a
"global" search).  Shift-F5 or Ctrl-N continues either type of
search.  The search is not case sensitive.  If the string is found, the line
containing it is highlighted with marks ( ) at either end.  If the
string is not found, the help program beeps.

The Esc Key

Pressing Esc or Ctrl-B will "backtrack" through the most recent 15
help topics you have viewed.  As you back up through the list each topic
will be displayed at the same screen position it was at when you last saw
it.  When you "back up" from the Table of Contents, or the first topic you
viewed, the help system exits.

The default behavior of the Esc key allows you to navigate through a
hierarchy of topics and quickly back up to previous screens.  If you
prefer, you can change the default so that Esc does not back up
through previous topics, and always returns immediately to the first
topic shown (the table of contents or index), or exits completely if
HELP was started with an explicit topic.  To do so, add the /E switch
to the 380HelpOptions directive in 4DOS.INI (see below for additional
details on help system options).  If you use /E, you can still back up
to previous topics with Ctrl-B.  Using /E also affects the right mouse
button, which always has the same effect as the Esc key.


The  and  Arrow Keys

The  and  keys normally move the cross-reference highlight in the
appropriate direction.  Once the highlight is at the first or last
cross-reference on the screen, the screen begins to scroll.  This allows
you to scroll through long cross-reference lists easily.  If you want to
change the behavior of the arrow keys so that they always scroll the text
immediately, without moving the cross-reference highlight, add the /L
switch to the 380HelpOptions directive in 4DOS.INI (see below for
additional details on help system options).  If you use /L, you can still
move the cross-reference highlight with , , Tab, or Shift-Tab.

Using the Index

While in the index, pressing an alphabetic key will move the highlighted box
to the first topic starting with that letter.  If you continue to press
alphabetic keys the string being entered will be displayed at the lower left
of the screen and the highlight bar will be placed on the first topic that
matches the entered string, moving, if necessary, to a new topic as the
string is being entered.

If a character is entered that results in no matching topic, the entered
string will be reset and the highlight bar will be placed on the first
topic that begins with that letter.

Pressing <Enter> selects the highlighted help topic and displays the
appropriate text.

Changing the Help Colors

The HELPCFG.EXE program included with 4DOS allows you to customize the HELP
colors.  To use it, just change to your 4DOS directory, enter the command
HELPCFG, and follow the instructions it displays.  To force HELPCFG to adjust
the monochrome HELP colors, even if you are using a color system, use the
command HELPCFG /M to start the program.

;NOTE - Synch the switch information below with the text in HelpOptions

Help System Options

You can set several options for the help system with the 380HelpOptions
directive in 3514DOS.INI.  The options are:

!INDENT 5 5 0 5
     /E:  (Esc) Changes the Esc key and right mouse button so that they
     return you to the table of contents immediately, rather than backing up
     through recently viewed topics (see above for details on the effects of
     /E).

     /F:  (Full screen index) Forces the index to occupy the entire screen.
     Primarily included for the convenience of blind users, to prevent speech
     software from reading the underlying screen when the index is up.

     /I:  (Index) Starts the help system at the index page, rather than
     the Table of Contents.

     /L:  (Lock scrolling) Changes the behavior of the up and down arrow
     keys so that they always scroll the text, and do not move the
     cross-reference highlight first (see above for details on the effects
     of /L).

     /M:  (Monochrome) Forces HELP to use monochrome display mode.  This
     is useful on a system which has a color video board and a monochrome
     display (for example, portable computers with LCD screens).

     /Sn:  (Speed) Sets the HELP mouse movement speed.  /S0 sets the
     speed to one half the default mouse speed.  /S2 sets it to twice the
     default, and /S4 sets it to four times the default.  The higher values
     may be useful if you use a screen larger than the standard size of 80
     x 25.

     /X:  Disable the mouse while HELP is running.  If you have a
     Microsoft serial or PS/2 mouse and are experiencing long delays when
     HELP starts, or you are running with a screen width larger than 80
     columns which is not supported properly by your 846mouse driver,
     you can use this option to disable the mouse.  (The delay with some
     mice is caused by the extended time required by some versions of the
     Microsoft mouse driver to initialize these devices.)
!INDENT 0

For example, if you want HELP to use a monochrome display and disable the
mouse by default, you could include the following line in your 4DOS.INI
file:

     HelpOptions = /M /X

You can include the same options on the HELP command line if you
wish.  Options used on the HELP command line will override any that are set
in the 4DOS.INI file.  For example, to obtain help on the COPY command, and
disable the mouse, you could use this command:

     c:\> help /x copy

You can also use the 384InstallPath directive in your 3514DOS.INI file
to inform 4DOS of the location of the HELP files (4HELP.EXE and 4DOS.HLP).  If
you don't use the InstallPath directive, the HELP program must be in the
current directory or in one of the directories specified in your 138PATH
setting.  If you use the InstallPath directive, the HELP command will
generally respond more quickly because 4DOS won't have to search the
directories in your PATH setting to find the help files.
;---------------------------------------------------------------------------
!TOPIC 15 Using the Mouse
!NOINDEX

This topic covers mouse usage in the HELP system.  For general information
on the help system, including keyboard usage, see 014Help Reference.

The mouse is fully supported in this help system.  It can be used to scroll
the display, select a cross-reference topic, and perform other actions.

When the table of contents or index is displayed, you can highlight a topic
by positioning the mouse cursor on the topic and pressing the left
button.  Pressing the left button a second time on that topic will display
the help text.

Once in the help screen, most standard keyboard actions can be selected with
the mouse by placing the mouse cursor on the appropriate section of the
"button bar" at the bottom of the screen and pressing the left button.

Pressing the left mouse button while highlighting the diamond in the upper
left corner will exit to the menu or the 4DOS prompt.

Pressing the right mouse button will back up through the topics you have
viewed, then exit to the menu or the 4DOS prompt (like the Esc key).  If
you use the /E switch to change Esc so it returns to the table of
contents or exits immediately, the behavior of the right mouse button will
change as well.  See 014Help Reference for details on /E.

Pressing the left and right buttons together will display the help index.

When the topic you are viewing is longer than one screen, you can move
through the text by placing the mouse cursor on the "scroll bar" at the
right side of the screen and pressing the left button.  A "slider" is
displayed in the scroll bar to show the relative position of the current
page of text within the topic.  Different parts of the scroll bar can be
used to move the text by lines or pages, or to "drag" it vertically within
the window.  The action taken depends on where the mouse cursor is when you
press the left button:

        Mouse cursor position           Action of left button
        ---------------------           ---------------------
        On the  at the bottom          Scroll down one line
        On the  at the top             Scroll up one line
        Below the slider                Move down one page
        Above the slider                Move up one page
        On the slider                   Drag the slider and the text in
                                        either direction

If you hold the button down while scrolling by line, the scrolling will
be repeated until the beginning or end of the topic is reached.  If you
hold the button down while paging from the scroll bar, the paging will be
repeated until the slider reaches or moves past the mouse cursor.

To make the scroll bar easier to "hit" with the mouse, the help system
responds to mouse clicks in the column immediately to the left of the scroll
bar as if they had taken place in the scroll bar itself.
;---------------------------------------------------------------------------
!TOPIC 16 External Help
!NOINDEX

65535Select this link to invoke the external DOS help program.

Normally 4DOS help searches your 138PATH for the file HELP.COM, and
executes it.  If 4DOS help cannot find the external help program, or the
program cannot be loaded for another reason (for example, if there is
not enough memory) you will hear two beeps.

If the external help you want to use is not called HELP.COM, or is not
accessible via the PATH on your system, you must specify its location in
the 145DOSHELP environment variable before 4DOS help can find
it.  Doing so overrides the default search for HELP.COM via the PATH.

If you use IBM PC DOS you must set the DOSHELP variable, because the
PC DOS help program is called HELP.EXE or VIEW.EXE.  For example, in
your AUTOEXEC.BAT or 4START file you might include a line like the
following to use the PC DOS help program (alter this for the location of
the help program on your system):

     set doshelp=c:\dos\help.exe

Similarly, you must set the DOSHELP variable to point to DOSBOOK.EXE for
external help under DR DOS 6.0 and later.

You can not put parameters after the file name; the DOSHELP variable
must be set to the path and file name only.
;---------------------------------------------------------------------------
!TOPIC 17 OPTION Dialog Keys
!NOINDEX

  General
  Ŀ
   Next control         Tab           Menu bar             F10          
   Previous control     Shift-Tab     Field help           F1           
   Select control       Space         Close menu           Esc          
   Navigate menus &               Exit OPTION          Ctrl-C,      
    list-boxes                                              Alt-F4      
  

  Data entry fields
  Ŀ
   Move through text                Beginning of field   Home, Ctrl  
   Delete character     Backspace     Clear field          Ctrl-Home    
   Insert/Overstrike    Insert        Clear field to end   Ctrl-End     
  

   Press Esc to return; press Enter or 018click here for more information.
;---------------------------------------------------------------------------
!TOPIC 18 OPTION Reference
!NOINDEX

This section describes how to use the OPTION dialogs to change 4DOS
configuration settings.  The dialogs are run by using the 648OPTION
command.

Each setting in the dialogs corresponds to a directive in the 4DOS.INI
file.  If you save the changes made in the dialogs, 4DOS.INI will be
updated automatically (additional details are below).

See 017OPTION Dialog Keys for a summary of the keys that can be used in
OPTION.

Menu bar

You can access the menu bar at the top of the screen in one of three
ways:  Selecting a menu item with the left mouse button, hitting F10, or
holding down the Alt key while typing one of the highlighted letters
(i.e. Alt-X for Exit, Alt-C for Configure, or Alt-H for help).  Once the
menu is active, you can move the selection bar between the items with the
arrow keys.

As you move the selection bar from item to item in a menu, the status
bar at the bottom of the screen will show a description of the currently
highlighted item.  Hitting Esc while in a menu will return you to the
dialog area.  Pressing Enter selects the menu item.

The main menu items are Exit, Configure, and Help.  The Exit sub-menu
displays three options for leaving the program:  Save, Use, and Cancel.  For
an explanation each option, see the Exiting OPTION topic below.

The Configure menu lists the major categories of options.  Selecting a
category will change the dialog area of the screen to allow you to
modify that group of options.

The Help menu allows you to access this help topic and the help file
Table of Contents, as well as additional information on the 4DOS.INI
directive corresponding to the current option, the 4DOS.INI file in
general, and the keys that can be used to navigate the OPTION dialogs.


Dialogs

The dialog area displays "controls" (numeric values, check boxes, etc.)
which allow you to modify specific 4DOS configuration settings.

In addition to displaying a short description of the current option,
the status bar at the bottom of the screen contains the corresponding
4DOS.INI directive name enclosed in brackets.

You can use the Tab key to move forward (down or right) and Shift-Tab to
move backward through the controls.  In addition, each control has a
highlighted letter which represents its hot key.  By holding down Alt
and striking the hot key, the appropriate control will be selected.

The integer and text controls are simple data entry fields.  You can use
the keyboard to edit the information contained in the data area; see
017OPTION Dialog Keys for the keys that can be used.

Check box controls are represented by brackets "[ ]", which either have
an X or a blank space between them.  When a check box contains an X,
the 4DOS.INI directive will be given the value of "Yes"; if it is blank,
the directive will be assigned "No."  You can toggle the value of a
check box by selecting it with the spacebar.

Radio buttons are represented by parentheses "( )" and are found in
groups of two or more controls.  Only one radio button in a group may be
active, signifying the current value of the option, and this is
indicated by the character "".  To change the selection, use Tab or
Shift-Tab to move to the value you want selected, and press the spacebar.

"Combo boxes" look like a text field followed by a down arrow symbol
[].  However, a combo box is not editable because the directive it
represents can only be assigned one of a specific set of values.  When a
combo box is active, pressing the spacebar or the down arrow [] will
display this set in a list and allow you to choose a value.  Once the list is
displayed, you can move a selection bar within it by using the up and
down arrows [], PageUp, PageDown, End, Home, or by typing the
first character of an item in the list.  You can then select that value with
the spacebar.  The list will disappear when you Tab to a different
control or hit the left arrow key.

Using the Mouse

The mouse is supported when OPTION is run in 80 column mode.  It can be
used to select controls, menu items, and buttons, and to perform other
actions.  (On screens wider than 80 columns you can use the keyboard to
control OPTION.)

To select a control or menu item, position the mouse cursor on it and
press the left mouse button.  The color of the text for that item will
change to show that it is active.

When selecting a text or numeric field, clicking on the text preceeding
the entry field will position the cursor at the left edge of the field.  You
can put the cursor elsewhere by clicking on a location inside the
data entry field.  A numeric field may also have "spin buttons"; arrow
controls which can be clicked on to increment [] or decrement [] the
value in the field.  The value used to raise or lower the number in the
field is different for each numeric field.

Selecting a check box with the mouse will toggle the setting.  Selecting
a radio button option will turn on that option and turn off the others.

Selecting a combo box control will drop the list to allow you to choose
a setting.  You can also display the list by clicking on the []
character to the right of the list box.

You can move through the selections in a combo box list with the "scroll
bar" at the right side of the list.  You can use the arrows at the top
and bottom of the scroll bar to move a line at a time; click above or
below the "slider" to move a page at a time; or drag the slider for
continuous scrolling.  To select an item in the list, click on it with
the left mouse button.

You can close an open list by clicking on the [] character or by
selecting another control or menu item.

Exiting OPTION

When you are finished modifying the 4DOS options you can exit the
program by selecting Exit on the main menu, or by typing Ctrl-C or
Alt-F4.

When you use the Exit selection on the menu bar you can select Save
to save your changes in 4DOS.INI for use in the current session and all
future sessions, Use to use your changes in the current session only,
or Cancel to discard the changes.

Save saves all changes since the last Save, or since the last time
you started 4DOS.  If you run OPTION and exit with
Use, any changes will not be saved in the .INI file at that time.  However,
if you run OPTION again and exit with Save, any earlier
changes will automatically be saved in 4DOS.INI along with any new
changes.

Using Ctrl-C or Alt-F4 to exit OPTION displays a popup box containing a
button for each of the options found on the exit menu.  There is an
additional button, labeled Resume, which will return you to the OPTION
dialogs without affecting 4DOS.INI or the current session.  You can
choose a button with the arrow keys or Tab and select it with the
spacebar or Enter, or click on it with the left mouse button.

In most cases, changes you make in the Startup section of the OPTION
dialogs or notebook will only take effect when you reboot your system.

Other changes take effect as soon as you exit the dialogs or notebook
with Save or Use.  However, not all option changes will appear
immediately, even if they have taken effect.  For example, some color
changes will only appear after a 604CLS command.
;---------------------------------------------------------------------------
!TOPIC 20 4NT and Take Command
!NOINDEX

4NT is the old name (before version 9) of the Take Command Console (TCC),
a powerful alternative to the 25Windows NT line command processor
(CMD.EXE) that enhances most of its standard commands and adds a wide
variety of new ones.

Take Command offers a new approach to working in Windows that brings users
the "best of both worlds."  It is a powerful command line utility, fully
integrated into the Windows graphical environment.

Visit http://jpsoft.com for up-to-date features, system requirements and
pricing and ordering information.
;---------------------------------------------------------------------------
!TOPIC 25 The Windows NT Line
!NOINDEX

Microsoft's Windows NT line includes Windows NT, 2000, XP, Server 2003,
Vista, Server 2008 and 7.  Unlike Windows ME, 98, 95 and earlier Windows
versions, these operating systems do not contain or require an underlying
MS-DOS layer; they instead include a DOS emulation system which is loaded as
needed.

4DOS is a DOS-based program; it was not designed for Windows NT.  It can be
run under the NT line, but with some limitations.  Files and directories with
extremely long DOS-compatible filenames, or without DOS-compatible filenames,
will be inaccessible.  Long filename support is disabled by default, and must
be explicitly enabled through an .INI directive.  Very large or deeply-nested
directories may cause out-of-memory errors.  4DOS does not support internet
files, Windows file associations, graphical controls, or true pipes.  4DOS
is also unable to access the clipboard under Windows NT.

0204NT and Take Command are the preferred command shells for Windows
NT.  They were designed for these systems, and do not suffer from the
DOS-imposed limitations of 4DOS.
;---------------------------------------------------------------------------
;OPTION equates (for help from OPTION)
!TOPIC 27 =17  OPTKEYS
!NOINDEX
!TOPIC 28 =18  OPTHELP
!NOINDEX
;---------------------------------------------------------------------------
!TOPIC 31 Using the Command Line
!NOINDEX

4DOS displays a c:\> prompt when it is waiting for you to enter a
command.  (The actual text depends on the 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 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.  If you prefer using different keystrokes to perform these functions,
you can assign new ones with 481Key Mapping Directives in 4DOS.INI.

The standard command line features documented in this section are:

        032Command-Line Editing
        033Command History and Recall
        034Command History Window
        058Command Names and Parameters
        035Filename Completion
        039Automatic Directory Changes
        040Directory History Window
        041Multiple Commands
        042Expanding and Disabling Aliases
        043Command Line Help
        117Command Parsing
        118Argument Quoting
        044Command Line Length Limits

Additional command-line features are documented under 071File Selection
and 047Directory Navigation.
;---------------------------------------------------------------------------
!TOPIC 32 Command-Line Editing
!NOINDEX

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 511 characters long.

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):

!NOWRAP
     Cursor Movement

          Left arrow        Move the cursor left one character.
          Right arrow       Move the cursor right one character.
          Ctrl-Left         Move the cursor left one word.
          Ctrl-Right        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 overstrike 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            Delete the word or partial word to the right
           (or Ctrl-Bksp)   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.
          Ctrl-V            Insert the first line in the clipboard.

     Marking Text

          Shift-Left        Mark the character to the left.
          Shift-Right       Mark the character to the right.
          Shift-Home        Mark from the beginning of the line to the
                            cursor.
          Shift-End         Mark from the cursor to the end of the line.
          Ctrl-Shift-Left   Mark the word to the left.
          Ctrl-Shift-Right  Mark the word to the right.
          Ctrl-Y            Copy the marked text to the clipboard 
                            (Windows only).

     Execution

          Ctrl-C            Cancel the command line.
           (or Ctrl-Break)
          Enter             Execute the command line.
          Ctrl-F5           Toggle batch debug mode.

!WRAP

Most of the command-line editing capabilities are also available when a
4DOS command prompts you for a line of input.  For example, you can use
the command-line editing keys when 611DESCRIBE prompts for a file
description, when 636INPUT prompts for input from an alias or batch
file, or when 640LIST prompts you for a search string.

If you want your input at the command line to be in a different color from
4DOS's prompts or output, you can use the Display page of the 648OPTION
dialogs, or the 465InputColors directive in 4DOS.INI.  You must have an
842ANSI driver installed to use InputColors.

4DOS 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
(see 086Escape Character.)  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 4DOS to interpret the next keystroke literally and places 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
351.INI File), and Alt-255 itself can be reassigned with the
513CommandEscape directive.
;---------------------------------------------------------------------------
!TOPIC 33 Command History and Recall
!NOINDEX

Command History Keys

!NOWRAP
     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 132CMDLINE environment
                     variable.  This allows you to squeeze out the last
                     few bytes of environment space before loading TSRs by
                     prefacing each TSR command with an "@".
!WRAP

Use the Up Arrow key repeatedly to scan back through the history list.
When the desired command appears, press Enter to execute it again.  After
you have found a command, you can edit it before pressing Enter. See
034Command History Window for information on viewing previous commands in
a popup window.

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 page of the 648OPTION dialogs, or setting
435HistWrap to No in the .INI file.

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.  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 page of the 648OPTION dialogs, or with the 382History
directive in 4DOS.INI.  When the list is full, the oldest commands
are discarded to make room for new ones.  You can also use the
433HistMin directive in 4DOS.INI to enable or disable history
saves and to specify the shortest command line that will be saved.

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
431HistCopy or 434HistMove to Yes in 4DOS.INI.  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.

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 4DOS.  They will not be visible in other shells,
or other sessions.  A local command history list is the default.

With a global command history list, all copies of 4DOS will share the same
command history, and any changes made to the history in one copy will affect
all other copies.

You can control the type of command history on the Startup page of the
648OPTION dialogs, with the 388LocalHistory directive in 4DOS.INI, with
the /L and /LH 352startup options, and with the /L and /LH options
of the 667START command.

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 4DOS, then
modify it if you find a situation where the default is not convenient.

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, 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.
;---------------------------------------------------------------------------
!TOPIC 34 Command History Window
!NOINDEX

Command History Window Keys

!NOWRAP
     PgUp or PgDn      (from the command line) Open the command history
                       window.
     Up Arrow          Scroll the display up one line.
     Down Arrow        Scroll the display down one line.
     Left Arrow        Scroll the display left 4 columns.
     Right Arrow       Scroll the display right 4 columns.
     PgUp              (inside the window) Scroll the display up one
                       page.
     PgDn              (inside the window) Scroll the display down one
                       page.
     Ctrl-PgUp         Go to the beginning of the history list.
      (or Home)
     Ctrl-PgDn         Go to the end of the history list.
      (or End)
     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.
!WRAP

You can view the command history in a scrollable 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.)

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.

4DOS also supports the mouse in popup windows.

See 894Popup Windows for information on customizing window position,
size, and color.
;---------------------------------------------------------------------------
!TOPIC 35 Filename/Variable Completion
!NOINDEX

Filename Completion Keys

!NOWRAP
     F8                Get the previous matching filename.
      (or Shift-Tab)
     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.
     F12               Repeat the filename just returned from an F9 match.
     Ctrl-A            Toggle between long filename and short filename
                       (Windows 95/98/ME only).
!WRAP

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, if you want to copy a file whose name begins with AU, but you
can't remember the rest of the name, type copy au, then press the Tab
key or F9 key. 4DOS 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 4DOS
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 073wildcard characters and extended wildcards.  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, 4DOS 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.

If you type a filename without an extension, 4DOS will add *.* to the name
(* on LFN drives).  It will also place a "*" after a partial
extension.  If you are typing a group of file names in an 080include
list, 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, 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 039automatic directory change.

If the name to be completed begins with a %, the completion routines will
scan the environment for matching variable names.

Converting Between Long and Short Filenames

On LFN drives, 4DOS 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.

The switch to the short filename format remains in effect for the remainder
of the current command line.  When 4DOS begins a new
command line it will return to long filename format unless 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.

Several topics are related to filename completion:

     036Appending Backslashes to Directory Names
     037Customizing Filename Completion
     038Filename Completion Window
;---------------------------------------------------------------------------
!TOPIC 36 Appending Backslashes to Directory Names
!NOINDEX

If you set the 413AppendToDir .INI directive, or the "Add \ .." option
on the Command Line page of the 648OPTION dialogs, 4DOS 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.

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.
;---------------------------------------------------------------------------
!TOPIC 37 Customizing Filename Completion
!NOINDEX

You can customize filename completion for any internal or external command
or alias.  This allows the DOS 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 page of the
648OPTION command, or set the 429FileCompletion directive manually in
your .INI file.  You can also use the 137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: ...

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
     FILES     Files only (no directories)

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,
4DOS will return only directories, not files.  If you type "B "
and press Tab, you will see only names of .C and .ASM files.

You can specify extensions NOT to match by prefacing the extension with a !.

4DOS does 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 137FILECOMPLETION environment variable and the 429FileCompletion
.INI directive to find a match that will limit the files selected for
filename completion.
;---------------------------------------------------------------------------
!TOPIC 38 Filename Completion Window
!NOINDEX

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.  (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.)

The keys you can use in the filename completion window are:

     F7 or Ctrl-Tab    (from the command line)  Open the filename
                       completion window.
     Up Arrow          Scroll the display up one line.
     Down Arrow        Scroll the display down one line.
     Left Arrow        Scroll the display left 4 columns.
     Right Arrow       Scroll the display right 4 columns.
     PgUp              Scroll the display up one page.
     PgDn              Scroll the display down one page.
     Ctrl-PgUp         Go to the beginning of the filename list.
      (or Home)
     Ctrl-PgDn         Go to the end of the filename list.
      (or End)
     Enter             Insert the selected filename into the command
                       line.

See 894Popup Windows for information on customizing window position,
size, and color.
;---------------------------------------------------------------------------
!TOPIC 39 Automatic Directory Changes
!NOINDEX

[Automatic directory changes are part of a set of comprehensive directory
navigation features built into 4DOS.  For a summary of these features, and
more information on the 048Extended Directory Searches and 049CDPATH features
mentioned below, see 047Directory Navigation.]

The automatic directory change feature lets you change directories quickly
from the command prompt, without entering an explicit 601CD or
602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
048Extended Directory Searches or 049CDPATH.  If you have enabled
either of those features, 4DOS will use them in searching
for any directory you change to with an automatic directory change.

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, or a
partial path.  Commands like "....\" can be used to move up the directory
tree quickly (see 072Extended Parent Directory Names).  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:

     c:\> d:\data\finance\
     c:\> archives\
     c:\> ...\util\win95\

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.

;---------------------------------------------------------------------------
!TOPIC 40 Directory History Window
!NOINDEX

[The directory history window is part of a set of comprehensive directory
navigation features built into 4DOS.  For a summary of these features, and
more information on enhanced directory navigation features, see
047Directory Navigation.]

Directory History Window Keys

     Ctrl-PgUp         (from the command line) Open the directory history
      (or Ctrl-PgDn)   window.
     Up Arrow          Scroll the display up one line.
     Down Arrow        Scroll the display down one line.
     Left Arrow        Scroll the display left 4 columns.
     Right Arrow       Scroll the display right 4 columns.
     PgUp              Scroll the display up one page.
     PgDn              Scroll the display down one page.
     Ctrl-PgUp         Go to the beginning of the directory
      (or Home)        list.
     Ctrl-PgDn         Go to the end of the directory list.
      (or End)
     Ctrl-D            Delete the selected line from the directory list.
     Enter             Change to the selected drive and directory.
     Ctrl-Enter        Move the selected line to the command line
                       for editing.

See 894Popup Windows for information on customizing window position,
size, and color.

The current directory is recorded automatically in the directory history
list just before each change to a new directory and 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 376DirHistory
directive in the .INI file.  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.

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.

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 4DOS.  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 4DOS will share the same
directory history, and any changes made to the list in one copy will affect
all other copies.

You can control the type of directory history list on the Startup page
of the 648OPTION dialogs, with the 386LocalDirHistory directive in
4DOS.INI, with the /L and /LD 352startup options, and with the /L
and /LD options of the 667START command.  You can control where a
global directory history list is stored with the 394UMBDirHistory
directive in 4DOS.INI, 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 4DOS,
then modify it if you find a situation where the default is not convenient.

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.

Whenever you start a secondary shell 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.
;---------------------------------------------------------------------------
!TOPIC 41 Multiple Commands
!NOINDEX

You can type several commands on the same command line, separated by a
caret [^].  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, 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 511 characters.

You can use multiple commands in 101aliases and 102batch files
as well as at the command line.

If you don't like using the default command separator, you can pick another
character using the 664SETDOS /C command or the 418CommandSep
directive in 4DOS.INI.  If you plan to share aliases or batch files between
4DOS and 0204NT or Take Command, see 054Special Character Compatibility
for details about choosing compatible command separators for two or more
products.
;---------------------------------------------------------------------------
!TOPIC 42 Expanding and Disabling Aliases
!NOINDEX

A few command line options are specifically related to 101aliases, and are
documented briefly here for completeness.

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 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
;---------------------------------------------------------------------------
!TOPIC 43 Command Line Help
!NOINDEX

You can start the online help system at the command line by entering HELP
or HELP plus a topic, or by pressing F1 or Ctrl-F1 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

Ctrl-F1 works just like F1 except that it provides help for the word at
the cursor instead of the first word on the command line.  Where F1 is good
for checking the syntax of commands, Ctrl-F1 is useful for reviewing
internal variables and variable functions.

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 /?

This will show you help for the command in a "quick-reference" style (the
output can be 051redirected.)  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 to 042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 external utility programs, do
display help when run with a /? parameter, but this a characteristic of
these commands and does not depend on 4DOS.  Many other
external commands do not have this feature.
;---------------------------------------------------------------------------
!TOPIC 44 Command Line Length Limits
!NOINDEX

A command line can be up to 511 characters long, including aliases,
environment variables, and multiple commands.  If your use of aliases or
environment variables causes the command line to exceed 511 characters,
you will see a "Command line too long" error and the remainder of the
line will not be executed.
;---------------------------------------------------------------------------
!TOPIC 45 Page and File Prompts
!NOINDEX

Several 4DOS 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 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 another 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/A/R ?

You can answer this prompt by pressing Y for Yes, N for No, or A or
R to process all remaining files without further prompting.  (A and R
are equivalent.)  You can also press Ctrl-C, Ctrl-Break, or Esc at this
prompt to cancel the remainder of the command.
;---------------------------------------------------------------------------
!TOPIC 46 Other Features
!NOINDEX

For information on other features of 4DOS see:

        045Page and File Prompts
        050Redirection and Piping
        053Keystack
        083Critical Errors
        084Conditional Commands
        085Command Grouping
        086Escape Character
;---------------------------------------------------------------------------
!TOPIC 47 Directory Navigation
!NOINDEX

The operating system remembers 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 supports those standard
features, and offers a number of enhancements to make directory navigation
much simpler and faster.

This section begins with a summary of all 4DOS directory navigation features.
It also provides detailed documentation on the enhanced directory search
features:  048Extended Directory Searches and the 049CDPATH.

The 4DOS directory navigation features are in three groups: features which
help 4DOS 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 supports this method, and also offers
two significant enhancements:

!INDENT 7 5 5 5
     * 048Extended Directory Searches allow 4DOS to
     search a "database" of all the directories on your system to find
     the one you want.

     * The 049CDPATH 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.
!INDENT 0

Initiating a Directory Change

4DOS supports the traditional methods of changing directories, and also
offers several more flexible approaches:

!INDENT 7 5 5 5
     * 039Automatic Directory Changes allow you to type a directory name
     at the prompt and switch to it automatically, without typing an
     explicit CD or similar command.

     * The 601CD command can change directories on a single
     drive, and can return to the most recently used directory.

     * The 602CDD command changes drive and directory at the same time,
     and can return to the most recently used drive and directory.

     * The 653PUSHD command changes the drive and directory like CDD,
     and records the previous directory in a directory "stack."  You can
     view the stack with 614DIRS and return to the directory on the top of
     the stack with 651POPD.
!INDENT 0

CDD, PUSHD, and automatic directory changes can also change to a network
drive and directory mapped to a drive letter.

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 supports three additional methods for
returning to a previous directory:

!INDENT 7 5 5 5
     * The 601CD - and 602CDD - commands 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 040Directory History Window 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.

     * The 651POPD command will return to the last directory saved by
     653PUSHD.  The directory stack holds 511 characters, enough for 20 to
     40 typical drive and directory entries.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 48 Extended Directory Searches
!NOINDEX

When you change directories with an 039automatic directory change,
601CD, 602CDD, or 653PUSHD command, 4DOS must find the
directory you want to change to.  To do so, 4DOS 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, 4DOS 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 4DOS to find the directory you
want, even if you only enter a small part of its name.

When the traditional search method fails, 4DOS tries to find the directory
you requested via the 049CDPATH, then via an Extended Directory
Search.  This section covers only Extended Directory Searches, which are more
flexible and more commonly used than CDPATH.

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 Windows page of the 648OPTION dialogs, or with
directives in the .INI file, including 417CDDWinLeft, CDDWinTop,
CDDWinWidth, and CDDWinHeight, and 462CDDWinColors.  You can also change
the keys used in the popup window with 481Key Mapping Directives in the
.INI file.

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

The Extended Search Database

To create or update the database of directory names, use the 602CDD /S
command.  When you create the database with CDD /S, you can specify which
drives should 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 Windows page of the 648OPTION dialogs, or with the
392TreePath .INI directive.  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 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 4DOS 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 644MD, 655RD,
606COPY /S, 609DEL /X, 609ERASE /X, 646MOVE /S, and
658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.

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 430FuzzyCD directive in the .INI file.  You can set FuzzyCD
with the Search Level option on the Windows page of the 648OPTION
dialogs, or by editing the .INI file manually.

!INDENT 5 5 5 5
     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, 4DOS
     will search the JPSTREE database for directory names which
     exactly match the name you specified.

     If FuzzyCD = 2 and an extended search is required, 4DOS
     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
     begin with the name you specified.

     If FuzzyCD = 3 and an extended search is required, 4DOS
     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.
!INDENT 0

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 4DOS to
locate, and the search proceeds as described in the preceding
sections.  However, you can also force 4DOS to perform an
extended directory search by using 073wildcard characters in the directory
name.  If you use a wildcard, an extended search will occur whether or not
extended searches have been enabled.

When 4DOS is changing directories and it finds wildcards in the directory
name, it skips the explicit search and 049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.

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 602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, 4DOS
will actually search the directory database for *ABC?DEF*.

Disabling Extended Searches in Batch Files

When writing batch files you may want to use the 601CD or
602CDD command to switch directories without triggering an extended
search.  For example, you may need the search to fail (rather than search
the extended search database) if a directory does not exist, or you may want
to ensure that the extended search popup window does not appear in a
batch file designed to run in unattended mode.

To disable extended searches, use the /N option of CD or CDD.  When
this option is used and a directory does not exist below the current
directory or on the CDPATH, the command will fail with an error message,
and will not search the extended search database.  For example this
command might trigger an extended search:

     cdd testdir

but this one will not:

     cdd /n testdir

Note that this option is not available for 653PUSHD.  To perform the
same function when using PUSHD, save the current directory with PUSHD
(without parameters) and then use CDD /N to change directories, for
example:

     pushd
     cdd /n testdir
;---------------------------------------------------------------------------
!TOPIC 144 = 49  _CDPATH
!NOINDEX
!TOPIC 49 CDPATH
!NOINDEX

When you change directories with an 039automatic directory change,
601CD, 602CDD, or 653PUSHD command, 4DOS must find the
directory you want to change to.  To do so, it first uses the traditional
method to find a new directory.

When the traditional search method fails, 4DOS tries to find the directory
you requested via the CDPATH, then via an
048Extended Directory Search.  This section covers only the CDPATH.

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 4DOS should
look for directories, use CDPATH.  If you prefer to have 4DOS
look at all of the directory names on your disk, use Extended
Directory Searches.

CDPATH is an environment variable, and is similar to the 138PATH variable
used to search for executable files:  it contains an explicit list of
directories to search when attempting to find a new directory.  4DOS
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 663SET
command.  The format of CDPATH is similar to that of 138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, 4DOS 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.

An alternative for the CDPATH environment variable is _CDPATH
(see 862Compatibility with Microsoft Bookshelf).
;---------------------------------------------------------------------------
!TOPIC 50 Redirection and Piping
!NOINDEX

This section covers redirection and piping.  You can use these features
to change how 4DOS and some application programs handle 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.

Redirection and piping allow you to change these assignments temporarily.

051Redirection changes the standard input, standard output, or standard
error device for a program or command from the default device (the keyboard or
screen), to another device or to a file.

052Piping changes the standard output and/or standard error device so
that the output of one command becomes the standard input for another
program or command.
;---------------------------------------------------------------------------
!TOPIC 51 Redirection
!NOINDEX

Redirection can be used to reassign 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 (for example PRN, LPT1, LPT2, LPT3 for printers; AUX
and 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 options supported by 4DOS:

     < filename     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

If you want to append output to the end of an existing file, rather than
creating a new file, replace the first ">" in the output redirection
symbol with ">>" (i.e., use >>, >>&, and >>&>).  This 055table of
all legal output redirection operators in 4DOS may be helpful.

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 clipboard by using the
pseudo-device name CLIP: (the colon is required).  It can only be
used in 4DOS when you are running in a DOS session under Windows 3.xx
or Windows 95/98/ME.  The clipboard is not available in a DOS session
under OS/2 or the 025Windows NT line.

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 085command group, all of the output from
the command group is redirected, and redirection ends when the command
group is done.

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 664SETDOS /N1 command, the "Protect redirected output
files" setting available on the Options 1 page of the 648OPTION dialogs,
or the 438NoClobber directive in 4DOS.INI.

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 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.

Redirections are performed before the command is executed.  If a redirection
fails for any reason -- an illegal filename or a nonexistant file, a device
which is not available or not ready, NoClobber protection, etc. -- then the
command will not be executed at all, and the 164_? internal variable will
be set to a nonzero value.

For another method of changing the standard input and output devices, see
607CTTY.
;---------------------------------------------------------------------------
!TOPIC 52 Piping
!NOINDEX

You can use the | character to create a "pipe" which sends the standard
output of one command to the standard input of another command:

     command1 | command2      Sends the standard output of command1 to
                              the standard input of command2

     command1 |& command2     Sends the standard output and standard
                              error of command1 to the standard input of
                              command2

For example, to take the output of the 663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 640LIST
command for full-screen viewing:

     c:\> set | sort | list

The 670TEE and 686Y commands 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.

4DOS creates one or two temporary files to hold the output of pipes.  The
files are given unique names, and deleted when the pipe is completed.  By
default, these files are stored in the root directory of the boot drive,
but you can override this with either the 141TEMP4DOS or 140TEMP
environment variable.
;---------------------------------------------------------------------------
;This is the keystack explanation; see also KEYSTACK
!TOPIC 53 Keystack
!NOINDEX

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 638KEYSTACK command.

KEYSTACK depends on a small resident program called 703KSTACK.COM, which
may be installed from your 109AUTOEXEC.BAT file.  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, see the
751Compatibility section of the online help for information on loading
KSTACK within a window.

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 893Keys and Key Names for details on how key names are entered.  See
the 638KEYSTACK command 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 595alias 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.
;---------------------------------------------------------------------------
!TOPIC 54 Special Character Compatibility
!NOINDEX

If you use two or more of our products, or if you want to share aliases and
batch files with users of different products, you need to be aware of the
differences in three important characters:  the Command Separator (see
041Multiple Commands), the Escape Character (see 086Escape
Character), and the Parameter Character (see 105Batch File
Parameters).

The default values of each of these characters in each product is shown in
the following chart:

     Product                Separator     Escape     Parameter

     4DOS                       ^                        &

     4OS2, 4NT, Take Command    &            ^            $

(The up-arrow [] represents the ASCII Ctrl-X character, numeric value 24.)

In your batch files and aliases, and even at the command line, you can
smooth over these differences in three ways:

!INDENT 7 5 5 5
     * Select a consistent set of characters from the Options 1 page of the
     648OPTION dialogs, or with .INI file 410Configuration
     Directives.  For example, to set the 4DOS characters to match
     0204NT, use these lines in 4DOS.INI:
!INDENT 7 5 7 5

             418CommandSep = &
             426EscapeChar = ^
             439ParameterChar = $

!INDENT 7 5 5 5
     * Use internal variables that contain the current special character,
     rather than using the character itself (see 166+ and 165=).  For
     example, this command:
!INDENT 7 5 7 5

             if "%1" == "" (echo Argument missing! ^ quit)

     will only work if the command separator is a caret.  However, this
     version works regardless of the current command separator:

             if "%1" == "" (echo Argument missing! %+ quit)

!INDENT 7 5 5 5
     * In a batch file, use the 665SETLOCAL command to save the command
     separator, escape character, and parameter character when the batch
     file starts.  Then use 664SETDOS as described below to select the
     characters you want to use within the batch file.  Use an 621ENDLOCAL
     command at the end of the batch file to restore the previous settings.
!INDENT 0

You can also use the SETDOS command to change special characters on the
command line.  However, when setting new special character values on the
command line you must take into account the possibility that one of your new
values will have a current meaning that causes problems with the setting.  For
example, this command:

     c:\> setdos /e^

would not set the escape character to a caret [^] in 4DOS if the standard
4DOS special characters were currently in effect.  The ^ would be seen as a
command separator, and would terminate the SETDOS command before the escape
character was set.  To work around this, use the escape character variable
%= before each setting to ensure that the following character is not
treated with any special meaning.

For example, the following sequence of commands in a batch file will always
set the special characters correctly to their standard 4NT values, no matter
what their current setting, and will restore them when the batch file is
done:

     setlocal
     setdos /c%=& /e%=^ /p%=$
     .....
     endlocal

A similar sequence can be used to select the standard 4DOS characters,
regardless of the current settings:

     setlocal
     setdos /c%=^ /e%= /p%=&
     .....
     endlocal
;---------------------------------------------------------------------------
!TOPIC 55 Output Redirection Operators
!NOINDEX
!NOWRAP

   Ŀ
    Symbol  Redirects          NoClobber=No      NoClobber=Yes    
   Ĵ
    >       stdout             Create/Overwrite  Create, or error 
    >>      stdout             Create/Append     Append, or error 
    >!      stdout             Create/Overwrite  Create/Overwrite 
    >>!     stdout             Create/Append     Create/Append    
    >&>     stderr             Create/Overwrite  Create, or error 
    >>&>    stderr             Create/Append     Append, or error 
    >&>!    stderr             Create/Overwrite  Create/Overwrite 
    >>&>!   stderr             Create/Append     Create/Append    
    >&      stdout and stderr  Create/Overwrite  Create, or error 
    >>&     stdout and stderr  Create/Append     Append, or error 
    >&!     stdout and stderr  Create/Overwrite  Create/Overwrite 
    >>&!    stdout and stderr  Create/Append     Create/Append    
   
!WRAP

This table summarizes all the legal output redirection operators in
4DOS.  The first column lists operators; the second tells which output
stream (standard output, standard error, or both) each one redirects.  The
third column indicates how the output file is opened when the NoClobber
feature is disabled, 4DOS's default condition.  The fourth is for when
NoClobber is enabled.  NoClobber support is set by the 438NoClobber .INI
directive at startup, and can be dynamically changed using 664SETDOS /N.

For most devices (as opposed to files), there is no real difference between
appending and overwriting:  DIR > LPT1 and DIR >> LPT1 are
equivalent.  However, you can overwrite or append to the clipboard contents
when redirecting to the CLIP: pseudo-device:  DIR > CLIP: replaces any text
on the clipboard, but DIR >> CLIP: adds to it.

stdout is the command's standard output; stderr is its standard
error.

Create/Overwrite:  The output file will be created if it does not already
exist, overwritten if it does.

Create/Append:  The output file will be created if it does not already
exist; otherwise the command's output will be added to the end of to the
existing file.

Create, or error:  A new output file will be created.  If the specified
file already exists, 4DOS will display a "File exists" error.

Append, or error:  The command's output will be added to the end of to an
existing file.  If the file does not exist, 4DOS will display a "File not
found" error.
;---------------------------------------------------------------------------
!TOPIC 56 Command Switches for File Selection
!NOINDEX

The 4DOS file processing commands (606COPY, 609DEL,
646MOVE, 658REN, 677TYPE, etc.) support several standard
switches for selecting files to process.  Be sure to see the
individual commands for details on which switches are supported for
each command and how they work, and for additional switches specific
to each command.

The common file selection switches include:

     /A:[[+|-]rhsad]:  Select files based on their attributes.  Preceding
     an attribute letter with a hyphen [-] will select files that do not
     have that attribute set.  You can OR attributes by preceding each
     attribute letter with a plus sign [+].  For example:

        dir /a:rh     lists all files with both the read-only and hidden
                      attributes set

        dir /a:-a     lists files which do not have the archive attribute

        dir /a:d      lists subdirectories only, not files

        dir /a:-d     lists files only, not subdirectories

        dir /a:+s+h   lists all files with either the system or the hidden
                      attribute (or both) set

     See 946File Attributes and Time Stamps for more information on
     attributes.

     /I"text":  Select files based on their description.
     073Wildcards are supported.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.

        del /i"*agua*" *.txt     deletes all .TXT files with the string
                                 "agua" somewhere in the file description

        del /i"[]" *.txt         deletes all .TXT files which do not
                                 have a description

     See 611DESCRIBE for details on file descriptions.

     /N:  Don't actually process any files.  This allows you to
     test what the results of a command would be, without actually
     performing the operation.

     /P:  Prompt for confirmation of each file individually.  See
     also 045Page and File Prompts.

     /S:  Process files in the current (or specified) directory and all
     of its subdirectories.  In most cases, /S will not search into
     subdirectories with the hidden or system attributes set unless you
     also specify /A:.  Do not use /S in combination with 057@file lists!
;---------------------------------------------------------------------------
!TOPIC 57 @File Lists
!NOINDEX

Certain 4DOS file processing commands allow you to specify the files
you want to process in a file list instead of on the command line.
We call these "@file lists" because the "@" sign is used in the
command, preceding the list filename.

An @file list is simply a standard ASCII file containing the names
of the files to process, one per line.  This allows you to create a
list of files for processing using output from 612DIR /B, DIR /F, or
625FFIND, a text editor, or any other method that produces a file in
the proper format.  Paths may be included in the file; see below for
details.

@File lists are supported by the 596ATTRIB, 606COPY,
609DEL, 611DESCRIBE, 623EXCEPT, 697HEAD,
640LIST, 646MOVE, 655RD / RMDIR, 658REN,
698TAIL, 674TOUCH, and 677TYPE commands.

Note:  Elements of an @file list are always processed exactly "as is".  No
further checking is done.  This means that if a command allows options to
restrict operations based on age (/U, /C), ranges (/[d..., /[t...),
descriptions (/I), attributes (/A:), or location (/S), those options
will not apply to the @file contents.

To use an @file list, precede its name with an "@" sign in the
command.  For example, to copy all of the files listed in MYLIST.TXT
to D:\SAVE\:

     c:\> copy @mylist.txt d:\save\

If you use a drive and/or path specification the "@" sign can appear
before the path or before the file name.  For example, these are
equivalent:

     c:\> copy @e:\lists\mylist.txt d:\save\
     c:\> copy e:\lists\@mylist.txt d:\save\

To use appropriately formatted data on the Windows clipboard as an
@file list use @CLIP: as the file name, for example:

    c:\> copy @clip: d:\save\

@File Lists, Paths, and Subdirectories

The entries in @file lists may contain no path, a relative path, or
an absolute path, for example:

     file1
     mydir\file1
     d:\data\mydir\file1

If a filename has no path the command processor will look for the
file in the directory that is current when the operation takes
place.  Similarly, if a relative path is used it will be interpreted
as relative to the directory that is current when the operation
takes place.

@file lists should not be used with the subdirectory switches in
file processing commands (COPY /S, DEL /S, etc.).  To process files
listed in a single @file list across multiple subdirectories use
626FOR's ability to read the list and handle each file name
individually, for example:

     for %file in (@flist) copy /s %file d:\target\

@File Lists and "@" Signs in File Names

Note that the "@" sign is a rarely used, but legal filename
character in some environments.  If a file whose name begins with
@ exists and you attempt to use an @file list with the same name,
the file whose name begins with @ will take precedence.  For
example, if C:\ contains both a file named @MYLIST.TXT and another
named MYLIST.TXT, this command:

     c:\> copy @mylist.txt d:\save\

will copy the single file @MYLIST.TXT to D:\SAVE\, and will not
process the list of files in MYLIST.TXT.  To avoid this confusion,
use a different name for one of the files.
;---------------------------------------------------------------------------
!TOPIC 58 Command Names and Parameters
!NOINDEX

When you enter a command you type its name at the prompt, followed by a
space and any parameters for the command.  For example, all of these
could be valid commands:

      c:\> dir
      c:\> copy file1 file2 d:\
      c:\> f:\util\mapmem /v
      c:\> "c:\program files\jp software\take command\tcmd.exe" /l

The last three commands above include both a command name, and one or
more parameters.  There are no spaces within the command name (except in
quoted file names), but there is a space between the command name and
any parameters, and there are spaces between the parameters.

Some commands may work when parameters are entered directly after the
command (without an intervening space, e.g. DIR/P), or when several
parameters are entered without spaces between them (e.g. DIR /2/P).
A very few older programs may even require this approach.  However
leaving out spaces in this way is usually technically incorrect, and is
not recommended as a general practice, as it may not work for all
commands.

If the command name includes a path, the elements must be separated with
backslashes (e.g. F:\UTIL\MAPMEM).  If you are accustomed to Unix syntax
where forward slashes are used in command paths, and want 4DOS to
recognize this approach, you can set 476UnixPaths to Yes in
4DOS.INI.

For more information on command entry see 041Multiple Commands and
044Command Line Length Limits.  For details on how 4DOS handles the
various elements it finds on the command line see 117Command Parsing.
;---------------------------------------------------------------------------
!TOPIC 71 File Selection
!NOINDEX

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.

Most of the features explained in this section apply to 4DOS commands only,
and can not be used to pass file names to external programs unless
those programs were specifically written to support these features.

The file selection features are:

        072Extended Parent Directory Names
        073Wildcards
        074Date, Time, and Size Ranges
        078File Exclusion Ranges
        079Multiple Filenames
        080Include Lists
        081LFN File Searches
        082Executable Extensions
        057@File Lists
        056Command Switches for File Selection
;---------------------------------------------------------------------------
!TOPIC 72 Extended Parent Directory Names
!NOINDEX

4DOS allows 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:
;---------------------------------------------------------------------------
!TOPIC 73 Wildcards
!NOINDEX

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 should not be processed see
078File Exclusion Ranges (for internal commands), or 623EXCEPT (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:

     c:\> dir *.*        Displays a list of all files in the current
                         directory

     c:\> dir *.txt      Displays a list of all .TXT files in the current
                         directory

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, 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 and Take
Command.

"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 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,

     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 080Include List.  For example, if you have a
file 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 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

Also, extra caution should be taken using wildcards on long file names
because operations using wildcards will be performed on both long and short
filenames.  See 081LFN File Searches for more information.
;---------------------------------------------------------------------------
!TOPIC 74 Ranges -- Date, Time, and Size Ranges
!NOINDEX

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
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.

(4DOS also supports 078File Exclusion Ranges to exclude files from a
command.  These are similar to date, time, and size ranges, but have a
slightly different purpose and therefore are documented separately.)

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" 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].

See the individual range types for details on specifying ranges:

        075Size Ranges
        076Date Ranges
        077Time Ranges

Using Ranges

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 6-27-2000 and 6-30-2000 will include files
modified on each of those dates, and on the two days in between.

If you reverse range start and end values 4DOS 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, selecting files between 100 and 200 bytes long could also
be entered as /[s200,100].

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

When you use a date, time, size, or file exclusion range in a
command, it should immediately follow the command name, so that any
additional switches for the command are after any range(s) used.  If
the range is placed later in the command it may be ignored, or cause
an error.  Unlike some command switches which apply to only part of
the command line, the range usually applies to all file names
specified for the command.

For example:

     c:\> dir /[d6-1-00,+0] *.c      Get a directory of all the *.C files
                                     dated June 1, 2000.

     c:\> del /[s0,0] *.* /s         Delete all the 0-byte files on the
                                     hard disk.

     c:\> copy /[d-1] /[s1] *.* a:   Copy all the non-zero byte files
                                     that were changed yesterday or today
                                     to the floppy disk.

     c:\> copy /[s10k,20k] *.* a:    Copy all the files with sizes from
                                     10,000 to 20,000 bytes to drive A:.

The standard 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.0 or 2000, DR-DOS 7.03 without LONGNAME loaded, or OS/2).

Drives which support long filenames (e.g. under Windows 95/98/ME, or
under plain DOS with a suitable LFN driver loaded) maintain 3 sets of
dates and times for each file: creation, last access, and last write
(for last access only the date is recorded; the last access time is
always returned as 00:00).  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...]

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

     /[da-1]

Date, time, and size ranges can be used with the 596ATTRIB,
606COPY, 609DEL, 611DESCRIBE, 612DIR, 615DO,
623EXCEPT, 625FFIND, 626FOR, 697HEAD, 640LIST,
646MOVE, 655RD / RMDIR, 658REN, 662SELECT,
698TAIL, 674TOUCH, 675TREE, and 677TYPE commands.  They
cannot be used with filename completion or in filename arguments for
variable functions.
;---------------------------------------------------------------------------
!TOPIC 75 Size Ranges
!NOINDEX

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, "M" to indicate megabytes (1,048,576 bytes),
"g" to indicate billions of bytes or "G" to indicate gigabytes
(1,073,741,824 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
;---------------------------------------------------------------------------
!TOPIC 76 Date Ranges
!NOINDEX

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

You can use hyphens, slashes, or periods to separate the month, day, and
year.  4DOS generally accepts dates between January 1, 1980 and
December 31, 2099.  The year can be entered as a 2-digit or 4-digit
value.  Two-digit years between 80 and 99 are interpreted as
1980 - 1999; values between 00 and 79 are interpreted as
2000 - 2079.  References to years beyond 2079 must be entered
with 4 digits.  For example, /[d12-31-99,1-1-00] is equivalent
to /[d12-31-1999,1-1-2000], and selects files modified on
December 31, 1999 or January 1, 2000.

If an argument begins with a four digit year greater than 1900, it's assumed
to be a date in the ISO 8601 international format (yyyy-mm-dd).  If the
date contains the letter "W", it is assumed to be in the ISO 8601 week date
format yyyy-Www-d, where yyyy = year, ww = week, d = week day.  If the
date is entered as two numbers in the format yyyy-ddd, it is assumed to be
in the ISO 8601 ordinal date format, where yyyy = year, ddd = day of the
year.

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-00@8:00a,7-3-00@6:00p] selects files that were modified at any
time between 8:00 am on July 1, 2000 and 6:00 pm on July 3, 2000.  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, 4DOS substitutes the
current date and time.  For example, /[d10-1-99] selects files dated
between October 1, 1999 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-99,+3]     modified between 10-27-99 and 10-30-99
     /[d10-27-99,-3]     modified between 10-24-99 and 10-27-99
     /[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
/[dn,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.  It takes advantage of the facts that an offset in the
start date is relative to today, and that the base or "zero" point for PC
file dates is January 1, 1980.

Note:  If you do not specify a time in a reversed date range, the default
times will be applied before the first and second dates are swapped to become
the ending and starting dates respectively.  If you want to include the
entire first and last days of a reversed date range, simply add a specific
@00:00:00 to your intended start date and a @23:59:59 to your intended
end date.

You cannot use offsets in the time portion of a date range (the part after
an @ sign), but you can combine a time with a date offset.  For example,
/[d12-8-99@12:00,+2@12:00] selects files that were last modified
between noon on December 8 and noon on December 10, 1999.  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.

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

Drives which support long filenames (e.g. under Windows 95/98/ME, or
under plain DOS with a suitable LFN driver loaded) maintain 3 sets
of dates and times for each file: creation, last access, and last write
(for last access only the date is recorded; the last access time is
always returned as 00:00).  By default, date ranges work with the last
write time stamp.  You can use the "last access" (a) or "created" (c)
date/time stamp in a date range with the syntax:

     /[da...]  or  /[dc...]

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

     /[da-1]
;---------------------------------------------------------------------------
!TOPIC 77 Time Ranges
!NOINDEX

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

The standard FAT file system maintains a single time for each file,
reflecting the last time the file was written.  This is the time
used by 4DOS on a FAT drive with no LFN support (e.g. under MS-DOS 6.22,
PC DOS 7.0 or 2000, DR-DOS 7.03 without LONGNAME loaded, or OS/2).

Drives which support long filenames (e.g. under Windows 95/98/ME,
or under plain DOS with a suitable LFN driver loaded) maintain 3 sets
of dates and times for each file: creation, last access, and last write
(for last access only the date is recorded; the last access time is always
returned as 00:00).  By default, time ranges work with the last
write time stamp.  You can use the "last access" (a) or "created" (c)
time stamp in a time range with the syntax:

     /[ta...]  or  /[tc...]
;---------------------------------------------------------------------------
!TOPIC 78 File Exclusion Ranges
!NOINDEX

Most internal commands which accept wildcards also accept file exclusion
ranges to further define the files that you wish to work with.  4DOS
examines each file name and excludes 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 074date, time, and size ranges.
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 internal commands.  The
623EXCEPT command can be used to exclude files from processing by many
external commands.

When you use a file exclusion range in a command it should
immediately follow the command name.  See Using Ranges under
074Date, Time, and Size Ranges for additional details.

See also 080Include Lists.
;---------------------------------------------------------------------------
!TOPIC 79 Multiple Filenames
!NOINDEX

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:

     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.

(For another method which allows you to specify multiple filenames with a
single path before them, see 080Include Lists.)

Caution:  When you use multiple filenames with a command that expects both a
source and a destination, like 606COPY or 646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, the 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 626FOR or 662SELECT
for another way of passing multiple file names to a command.
;---------------------------------------------------------------------------
!TOPIC 80 Include Lists
!NOINDEX

Any internal command that accepts 079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.

For example, you can shorten this command which uses multiple file names:

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

to this using an include list:

     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.

Third, multiple filenames and include lists are processed differently by the
612DIR and 662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     Lists the .TXT files then the .DOC files,
                              in two separate lists.

     c:\> dir *.txt;*.doc     Lists the .TXT and .DOC files in a single list.

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

See also 078File Exclusion Ranges.
;---------------------------------------------------------------------------
!TOPIC 81 LFN File Searches
!NOINDEX

Under Windows 95/98/ME, files on volumes which support long
filenames (VFAT, FAT32, etc. volumes) can have both a long file name
(LFN) and a short FAT-compatible file name.  4DOS normally examines
both forms of each file name when searching for files.  It does
so in order to remain compatible with the default command
processor, 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 filenames.  The
firstfile ("Letter Home.DOC") will be found during the search of short
filenames.

You can change this default behavior with the 447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.

Caution:  Take extra care when you use wildcards to perform operations on
LFN volumes because you may select more files than you intended.  For example,
Windows often creates 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!
;---------------------------------------------------------------------------
!TOPIC 82 Executable Extensions
!NOINDEX

Normally, when you type a filename (as opposed to an alias or internal
command name) as the first word on the command line, 4DOS 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 .BTM or .BAT to indicate a batch file.  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 649PATH and 143PATHEXT for additional
ways to control the search for executable files.)

You can add to the default list of extensions, and have 4DOS 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.

You 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 for use only in 4DOS, 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.

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.  You can specify multiple extensions
for a single command by separating them with semicolons, for example:

     set .txt;.doc;.lst=command [options]

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

If the command is a batch file or external program, 4DOS will search the
138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.

This 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

4DOS 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

4DOS 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 in these examples, then executable extensions won't
work with that program.  However, you can always point it to a 4DOS batch
file which will do the necessary parameter conversions for you and then
call the desired destination program.

Executable extensions may include 073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.

To remove an executable extension, use the 680UNSET command to remove the
corresponding variable.
;---------------------------------------------------------------------------
!TOPIC 83 Critical Errors
!NOINDEX

DOS watches 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.

These errors are called critical errors because DOS, 4DOS, or your
application program 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 4DOS or your
application, and will vary slightly depending on your operating system and
whether you are in full-screen or windowed mode.  However, the options and
their neanings 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 errors in your
                applications or damage data on the disk.

     Fail       Tell the program that the operation failed.  This option
                returns an error code to 4DOS or to the application
                program that was running when the error occurred.  4DOS
                generally stops the current command when an operation
                fails.  This option is not available for all errors; if
                you don't see it, use Abort instead.  You can force a Fail
                response to all critical errors with the 562CritFail
                directive in 4DOS.INI.

     Abort      Abort the program.  Choose this option to stop the
                program that was running when the error occurred.
                Choosing Abort will abort the command, but not 4DOS
                itself.
;---------------------------------------------------------------------------
!TOPIC 84 Conditional Commands
!NOINDEX

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 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.
;---------------------------------------------------------------------------
!TOPIC 85 Command Grouping
!NOINDEX

Command grouping allows you to group a set of commands together logically
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 658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 628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.

This kind of command grouping is most useful with the 623EXCEPT, 626FOR,
628GLOBAL, and 633IF commands.  When you use this approach in 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 050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:

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

The redirection 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 051redirection and for 052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
     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, 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 length limit of 511 characters.
;---------------------------------------------------------------------------
!TOPIC 86 Escape Character
!NOINDEX

4DOS recognizes 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 915ANSI and printer control sequences.

The default escape character is Ctrl-X (ASCII 24), which will be displayed
here as an up arrow [].

If you don't like using the default escape character, you can pick another
character using the 664SETDOS /E command, the Options 1 page of the
648OPTION dialogs, or the 426EscapeChar directive in 4DOS.INI.  If you
plan to share aliases or batch files between 4DOS and 0204NT or 021Take
Command, see 054Special Character Compatibility 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
useful for redirecting codes to the printer; e is also useful to
generate 915ANSI escape sequences in your 652PROMPT, 619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

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 < 4

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

     c:\> echos feY > prn

The escape character has an additional use when it is the last character on
any line of a .BAT or .BTM batch file.  4DOS recognizes this use
of the escape character to signal line continuation:  4DOS removes the escape
character and appends the next line to the current line before executing it.
;---------------------------------------------------------------------------
!TOPIC 101 Aliases
!NOINDEX

Much of the power of 4DOS comes together in aliases, which give you the
ability to create your own commands.  An alias is a name that you
select for a command or group of commands.  Simple aliases substitute a new
name for an existing command.  More complex aliases can redefine the default
settings of internal or external commands, operate as very fast in-memory
batch files, and perform commands based on the results of other commands.

This topic will show you some examples of the power of aliases.
See the 595ALIAS command for complete details about writing your
own aliases.

The simplest type of alias gives a new name to an existing command.  For
example, you could create a command called ROOT which uses 601CD
to switch to the root directory this way:

     c:\> alias root = cd \

After the alias has been defined this way, every time you type the command
ROOT, you will actually execute the command CD \.

Aliases can also create customized versions of commands.  For example, the
612DIR command can sort a directory in various ways.  You can create an
alias called DE that means "sort the directory by filename extension, and
pause after each page while displaying it" like this:

     c:\> alias de = dir /oe /p

Aliases can be used to execute sequences of commands as well.  The following
command creates an alias called W which saves the current drive and
directory, changes to the WP directory on drive C, runs the program
E:\WP60\WP.EXE, and, when the program terminates, returns to the original
drive and directory:

     c:\> alias w = `pushd c:\wp ^ e:\wp60\wp.exe ^ popd`

This alias is enclosed in back-quotes because it contains multiple
commands.  You must use the back-quotes whenever an alias contains multiple
commands, environment variables, parameters (see below), redirection, or
piping.  See the 595ALIAS command for full details.

Aliases can be nested, that is, one alias can invoke another.  For example,
the alias above could also be written as:

     c:\> alias wp = e:\wp60\wp.exe
     c:\> alias w = `pushd c:\wp ^ wp ^ popd`

If you enter W as a command, 4DOS will execute the
653PUSHD command, detect that the next command (WP) is another alias, and
execute the program E:\WP60\WP.EXE, and - when the program exits - return
to the first alias, execute the 651POPD command, and return to the prompt.

You can use aliases to change the default options for both internal commands
and external commands.  Suppose that you always want the 609DEL
command to prompt before it erases a file:

     c:\> alias del = *del /p

An asterisk [*] is used in front of the second "del" to show that it is the
name of an internal command, not an alias.  See the 595ALIAS command for
more information about this use of the asterisk.

You may have a program on your system that has the same name as an internal
command.  Normally, if you type the command name, you will start the internal
command rather than the program you desire, unless you explicitly add its full
path on the command line.  For example, if you have a program named
LIST.COM in the C:\UTIL directory, you could run it with the command
C:\UTIL\LIST.COM.  However, if you simply type LIST, the internal
640LIST command will be invoked instead.  Aliases give you two ways to
get around this problem.

First, you could define an alias that runs the program in question, but with a
different name:

     c:\> alias l = c:\util\list.com

Another approach is to rename the internal command and use the original name
for the external program.  The following example renames the LIST command as
DISPLAY and then uses a second alias to run LIST.COM whenever you type LIST:

     c:\> alias display = *list
     c:\> alias list = c:\util\list.com

You can also assign an alias to a key, so that every time you press the key,
the command will be invoked.  You do so by naming the alias with an at sign
[@] followed by a key name.  After you enter this next example, you will
see a 2-column directory with paging whenever you press Shift-F5, then
Enter:

     c:\> alias @Shift-F5 = *dir /2/p

This alias will put the 612DIR command on the command line when you press
Shift-F5, then wait for you to enter file names or additional switches.  You
must press Enter when you are ready to execute the command.  To execute the
command immediately, without displaying it on the command line or waiting for
you to press Enter, use two at signs at the start of the alias name:

     c:\> alias @@Shift-F5 = *dir /2/p

The next example clears the screen whenever you press Alt-F1:

     c:\> alias @@Alt-F1 = cls

Aliases have many other capabilities as well.  This example creates a simple
command-line calculator using the 263@EVAL function.  Once you have
entered the example, you can type CALC 4*19, for example, and you will see
the answer:

     c:\> alias calc = `echo The answer is:  %@eval[%&]`

Our last example in this section creates an alias called IN.  It will
temporarily change directories, run an internal or external command, and then
return to the current directory when the command is finished:

     c:\> alias in = `pushd %1 ^ %2& ^ popd`

Now if you type

     c:\> in c:\letters wp letter.txt

you will change to the C:\LETTERS subdirectory, execute the command WP
LETTER.TXT and then return to the current directory.

The above example uses two parameters:  %1 means the first argument on the
command line, and %2& means the second and all subsequent
arguments.  Parameters are explained in detail under the 595ALIAS command.

See the 595ALIAS and 678UNALIAS commands for more information and
examples, and also 111Using Aliases in Batch Files.
;---------------------------------------------------------------------------
!TOPIC 102 Batch Files
!NOINDEX

A batch file is a file that contains a list of commands to execute.  4DOS
reads and interprets each line as if it had been typed at the keyboard.  Like
595aliases, batch files are handy for automating computing
tasks.  Unlike aliases, batch files can be as long as you wish.  Batch
files take up separate disk space for each file, and can't usually execute
quite as quickly as aliases, since they must be read from the disk.

The topics included in this section are:

        103.BAT and .BTM Files
        104Echoing in Batch Files
        105Parameters
        106Using Environment Variables
        107Batch File Commands
        108Interrupting a Batch File
        109Automatic Batch Files (4START and 4EXIT)
        110Detecting 4DOS and other JP Software shells
        111Using Aliases in Batch Files
        112Debugging Batch Files
        113String Processing
        114Line Continuation
        115Batch File Compression
        054Special Character Compatibility
        117Command Parsing
        118Argument Quoting
        116REXX Support
;---------------------------------------------------------------------------
!TOPIC 103 .BAT and .BTM Files
!NOINDEX

A batch file can run in two different modes.  In the first, traditional
mode, each line of the batch file is read and executed individually.  In
the second mode, the entire batch file is read into memory at once.  The
second mode can be 5 to 10 times faster, especially if most of the commands
in the batch file are internal commands.  However, only the first mode can
be used for self-modifying batch files (which are rare), or for batch files
which install memory-resident utilities.

The batch file's extension determines its mode.  Files with a .BAT
extension are run in the slower, traditional mode.  Files with a .BTM
extension are run in the faster, more efficient mode.  You can change the
execution mode inside a batch file with the 641LOADBTM command.

Under 4DOS, .BTM files must be less than 64K (65536) bytes long.
;---------------------------------------------------------------------------
!TOPIC 104 Echoing in Batch Files
!NOINDEX

By default, each line in a batch file is displayed or "echoed" as it is
executed.  You can change this behavior, if you want, in several different
ways:

!INDENT 5 5 5 5
     Any batch file line that begins with an [@] symbol will not be
     displayed.

     The display can be turned off and on within a batch file with the
     619ECHO OFF and ECHO ON commands.

     The default setting can be changed with the 664SETDOS /V command,
     on the Options 1 page of the 648OPTION dialogs, or the
     414BatchEcho directive in 4DOS.INI.
!INDENT 0

For example, the following line turns off echoing inside a batch file.  The
[@] symbol keeps the batch file from displaying the ECHO OFF command:

     @echo off

4DOS also has a command line echo that is unrelated to the batch file echo
setting.  See 619ECHO for details about both settings.
;---------------------------------------------------------------------------
!TOPIC 105 Batch File Parameters
!NOINDEX

Like aliases and application programs, batch files can examine the command
line that is used to invoke them.  The command tail (everything on the
command line after the batch file name) is separated into individual
parameters (also called arguments or batch variables) by scanning for
the spaces, tabs, and commas that separate the parameters.  A batch file can
work with the individual parameters or with the command tail as a whole.

Batch file parameters are numbered from %1 to %255.  %1 refers to the
first parameter on the command line, %2 to the second, and so on.  You
can use quotation marks to pass spaces, tabs, commas, and other special
characters in a batch file parameter; see 118Argument Quoting for
details.

Parameters that are referred to in a batch file, but which are missing on
the command line, appear as empty strings inside the batch file.  For
example, if you start a batch file and put two parameters on the command
line, any reference in the batch file to %3, or any higher-numbered
parameter, will be interpreted as an empty string.

A batch file can also work with three special parameters:  %0 contains
the name of the batch file as it was entered on the command line, %#
contains the number of command line arguments, and %n& contains the
complete command-line tail starting with argument number n (for example,
%3& means the third parameter and all those after it).  %& contains the
entire command tail.  The values of these special parameters will change if
you use the 666SHIFT command.  If you wish to use a symbol other than
the ampersand [&] to refer to multiple arguments, you can use the
439ParameterChar directive in 4DOS.INI or the 664SETDOS /P command
to define a different parameter character.

For example, if your batch file interprets the first argument as a
subdirectory name then the following line would move to the specified
directory:

     cd %1

A friendlier batch file would check to make sure the directory exists and take
some special action if it doesn't:

     iff isdir %1 then ^ cd %1
     else ^ echo Subdirectory %1 does not exist! ^ quit
     endiff

(see the 633IF and 634IFF commands).

For compatibility with CMD.EXE, you may also use %* to refer to the entire
command tail; %* is mostly equivalent to %&.  You cannot, however,
specify a number between the percent sign and the asterisk.  %4* represents
the fourth word in the command tail (%4) followed by a literal asterisk
(*), but %4& represents the fourth and all following arguments.  Unlike
%&, the %* parameter is not affected by the 666SHIFT command.

Batch files can also use 131environment variables, 161internal
variables, and 241variable functions.
;---------------------------------------------------------------------------
!TOPIC 106 Using Environment Variables
!NOINDEX

Batch files can also use 131environment variables, 161internal
variables, and 241variable functions.  You can use these variables and
functions to determine system status (e.g., the type of CPU in the system),
resource levels (e.g., the amount of free disk space), file information
(e.g., the date and time a file was last modified), and other information
(e.g., the current date and time).  You can also perform arithmetic
operations (including date and time arithmetic), manipulate strings and
substrings, extract parts of a filename, and read and write files.

To create temporary variables for use inside a batch file, just use the
663SET command to store the information you want in an environment
variable.  Pick a variable name that isn't likely to be in use by some other
program (for example, 138PATH would be a bad choice), and use the
680UNSET command to remove these variables from the environment at
the end of your batch file.  You can use 665SETLOCAL and 621ENDLOCAL
to create a "local" environment so that the original environment will be
restored when your batch file is finished.

Environment variables used in a batch file may contain either numbers or
text.  It is up to you to keep track of what's in each variable and use it
appropriately; if you don't (for example, if you use %263@EVAL to add a
number to a text string), you'll get an error message.
;---------------------------------------------------------------------------
!TOPIC 107 Batch File Commands
!NOINDEX

Several commands are particularly suited to batch file processing.  Here is
a list of some of the commands you might find most useful:

!INDENT 5 5 5 5
     597BEEP produces a sound of any pitch and duration through the
     computer's speaker.

     599CALL executes one batch file from within another.

     600CANCEL terminates all batch file processing.

     604CLS and 605COLOR set the screen display colors.

     615DO starts a loop.  The loop can be based on a counter, or on a
     conditional test like those used in IF and IFF.

     616DRAWBOX draws a box on the screen.

     617DRAWHLINE and 618DRAWVLINE draw horizontal and vertical
     lines on the screen.

     619ECHO and 620ECHOS print text on the screen (the text can
     also be redirected to a file or device).  689ECHOERR and
     690ECHOSERR print text to the standard error device.

     629GOSUB executes a subroutine inside a batch file.  The
     659RETURN command terminates the subroutine.

     630GOTO branches to a different location in the batch file.

     626FOR executes commands for each file that matches a set of
     wildcards, or each entry in a list.

     633IF and 634IFF execute commands based on a test of string
     or numeric values, program exit codes, or other conditions.

     635INKEY and 636INPUT collect keyboard input from the user
     and store it in environment variables.

     638KEYSTACK sends keystrokes to applications.

     641LOADBTM changes the batch file operating mode.

     647ON initializes error handling for Ctrl-C / Ctrl-Break, or for
     program and command errors.

     650PAUSE displays a message and waits for the user to press a key.

     654QUIT ends the current batch file and optionally returns an exit
     code.

     657REM places a remark in a batch file.

     660SCREEN positions the cursor on the screen and optionally prints a
     message at the new location.

     661SCRPUT displays a message in color.

     665SETLOCAL saves the current disk drive, default directory,
     environment, alias list, and special character settings.  621ENDLOCAL
     restores the settings that were saved.

     666SHIFT changes the numbering of the batch file parameters.

     667START starts another session or window in certain multitasking
     environments.

     669SWITCH selects a group of statements to execute based on the value
     of a variable.

     671TEXT displays a block of text.  671ENDTEXT ends the block.

     673TIMER starts or reads a stopwatch.

     684VSCRPUT displays a vertical message in color.
!INDENT 0

These commands, along with the internal variables and variable functions,
make the enhanced batch file language extremely powerful.  Your copy of 4DOS
includes a sample batch file, in the file EXAMPLES.BTM, that demonstrates some
of the things you can do with batch files.
;---------------------------------------------------------------------------
!TOPIC 108 Interrupting a Batch File
!NOINDEX

You can usually interrupt a batch file by pressing Ctrl-C or
Ctrl-Break.  Whether and when these keystrokes are recognized will depend
on whether 4DOS or an application program is running, how
the application (if any) was written, whether 598BREAK is ON or OFF, and
whether the 647ON BREAK command is in use.

If 4DOS detects a Ctrl-C or Ctrl-Break (and ON BREAK is not in use), it will
display a prompt, for example:

     Cancel batch job C:\CHARGE.BTM ? (Y/N/A) :

Enter N to continue, Y to terminate the current batch file and continue
with any batch file which called it, or A to end all batch file processing
regardless of the batch file nesting level.  Answering Y is similar to the
654QUIT command; answering A is similar to the 600CANCEL command.
;---------------------------------------------------------------------------
!TOPIC 109 Automatic Batch Files
!NOINDEX

4DOS supports "automatic" batch files, files that run without your
intervention, as long as 4DOS can find them.

Each time 4DOS starts as either a primary or a secondary shell, it looks
for an automatic batch file called 4START.BTM or 4START.BAT.  If the 4START
batch file is not in the same directory as 4DOS itself (as specified in the
134COMSPEC variable, you should use the Startup page of the 648OPTION
dialogs or the 3724StartPath directive in 4DOS.INI to specify its
location.  4START is optional, so 4DOS will not display an error message if
it cannot find the file.

4START is a convenient place to change the color or content of the prompt
for each shell, 643LOG the start of a shell, or put other special startup
or configuration commands.

With the exception of some 4DOS initialization switches, the entire startup
command line passed to 4DOS is available to 4START via
105batch file parameters (%1, %2, etc.).  This can be useful if you
want to see the command line passed to a secondary shell by an
application.  For example, to pause if any parameters are passed to a
secondary shell you could include this command in 4START (enter this on one
line):

     if "%1" != "" .and. "%_shell" gt 0 pause Starting shell %_shell
     with parameters [%&]

Whenever it is started as a primary shell, 4DOS runs AUTOEXEC.BAT
immediately after 4START.  On a DOS system, AUTOEXEC.BAT runs each time the
computer boots up.  (If COMMAND.COM cannot find AUTOEXEC.BAT, it asks you for
the time and date.  4DOS skips that step and immediately displays a prompt.)

Normally, AUTOEXEC.BAT must be in the root directory of the boot drive.  You
can store it in a different location (and even give it a different name) by
using the 4DOS.INI directive 375AutoExecPath.  You can also pass
parameters to AUTOEXEC.BAT using the 374AutoExecParms directive in
4DOS.INI.

Whenever a 4DOS shell ends, it runs an automatic batch file called
4EXIT.BTM or 4EXIT.BAT.  This file, if you use it, should be in the same
directory as your 4START batch file.  Like 4START, 4EXIT is optional.  It
is not necessary in most circumstances, but it is a convenient place to put
commands to save information such as a history list before a shell ends, or
643LOG the end of the shell.

4START and 4EXIT should not load any memory resident programs
(TSRs).  Otherwise, these files can include any commands that could be part of
any batch file or any commands which you could type from the command line.

Pipes, Transient Sessions, and 4START

When you set up the 4START file, remember that it is executed every time
4DOS starts, including when running a transient copy of 4DOS started with 
the /C 352startup option.  This could result in your 4DOS sessions
executing in the directory set by 4START, not the directory in which 4DOS
was originally started.  For example, suppose you set up a Windows shortcut
with a command line like this, which starts a transient session:

     Command:            d:\4dos\4dos.com /c list myfile.txt
     Working Directory:  c:\data

Normally this command would LIST the file C:\DATA\MYFILE.TXT.  However,
if 4START changes to a different directory, 4DOS will look for MYFILE.TXT
there -- not in C:\DATA.

Similarly, any changes to environment variables or other settings in 4START
will affect all copies of 4DOS, including those used for
pipes and transient sessions.

You can work around these potential problems with the 633IF or 634IFF
command and the internal variable 220_TRANSIENT.  For example, to skip
all 4START processing when running in a transient session, you could
use a command like this at the beginning of 4START:

     if %_transient != 0 quit
;---------------------------------------------------------------------------
!TOPIC 110 Detecting 4DOS
!NOINDEX

A batch file can test whether it is running in a JP Software shell by
attempting a numeric comparison:

     if 01 == 1.0 echo Running in 4DOS, 4NT or Take Command!

This syntax is legal in COMMAND.COM and all compatible shells, including
4DOS, 0204NT, Take Command, and CMD.EXE.  In JP Software shells,
this is a numeric comparison and true; in COMMAND.COM and CMD.EXE, it is
a string comparison and false.

Once you have established that the batch file is running in a JP Software
shell, internal variables like 225_CMDPROC, 167_4VER, 193_DOS,
194_DOSVER, and 222_WIN may be used to further determine the operating
environment.
;---------------------------------------------------------------------------
!TOPIC 111 Using Aliases in Batch Files
!NOINDEX

One way to simplify batch file programming is to use 101aliases to hide
unnecessary detail inside a batch file (see the 595ALIAS command
for more details on how to define aliases).  For example, suppose you
want a batch file to check for certain errors, and display a message
and exit if one is encountered.  This example shows one way to do so:

     setlocal
     unalias *
     alias error `echo. ^ echo ERROR: %& ^ goto dispmenu`
     alias fatalerror `echo. ^ echo FATAL ERROR: %& ^ quit`
     alias in `pushd %1 ^ %2& ^ popd`
     if not exist setup.btm fatalerror Missing setup file!
     call setup.btm
     cls
     :dispmenu
     text
               1. Word Processing
               2. Spreadsheet
               3. Communications
               4. Exit
     endtext
     echo.
     inkey Enter your choice:  %%userchoice
     switch %userchoice
     case 1
        input Enter the file name:  %%fname
        if not exist fname error File does not exist
        in d:\letters c:\wp60\wp.exe
     case 2
        in d:\finance c:\quattro\q.exe
     case 3
        in d:\comm c:\comsw\pcplus.exe
     case 4
        goto done
     default
       error Invalid choice, try again
     endswitch
     goto dispmenu
     :done
     endlocal

The first alias, ERROR, simply displays an error message and jumps to the
label DISPMENU to redisplay the menu.  The "%&" in the second 619ECHO
command displays all the text passed to ERROR as the content of the
message.  The similar FATALERROR alias displays the message, then exits the
batch file.

The last alias, IN, expects 2 or more command-line arguments.  It uses the
first as a new working directory and changes to that directory with a
653PUSHD command.  The rest of the command line is interpreted as another
command plus possible command line parameters, which the alias executes.  This
alias is used here to switch to a directory, run an application, and switch
back.  It could also be used from the command line.

The following lines print a menu on the screen and then get a keystroke from
the user and store the keystroke in an environment variable called
'userchoice'.  Then the 669SWITCH command is used to test the user's
keystroke and decide what action to take.

There's another side to aliases in batch files.  If you're going to distribute
your batch files to others, you need to remember that they may have aliases
defined for the commands you're going to use.  For example if the user has
aliased 601CD to 602CDD and you aren't expecting this, your file
may not work as you intended.  There are two ways to address this problem.

First, you can use 665SETLOCAL, 621ENDLOCAL, and 678UNALIAS to
clear out aliases before your batch file starts and restore them at the end,
as we did in the previous example.  Remember that SETLOCAL and ENDLOCAL will
save and restore not only the aliases but also the environment, the current
drive and directory, and various special characters.

If this method isn't appropriate or necessary for the batch file you're
working on, you can also use an asterisk [*] before the name of any
command.  The asterisk means the command that follows it should not be
interpreted as an alias.  For example the following command redirects a list
of file names to the file FILELIST:

     dir /b > filelist

However, if the user has redefined 612DIR with an alias this command may
not do what you want.  To get around this just use:

     *dir /b > filelist

The same can be done for any command in your batch file.  If you use the
asterisk, it will disable alias processing, and the rest of the command will
be processed normally as an internal command, external command, or batch
file.  Using an asterisk before a command will work whether or not there is
actually an alias defined with the same name as the command.  If there is no
alias with that name, the asterisk will be ignored and the command will be
processed as if the asterisk wasn't there.
;---------------------------------------------------------------------------
!TOPIC 112 Debugging Batch Files
!NOINDEX

4DOS includes a built-in batch file debugger, invoked with the 664SETDOS
/Y1 command.  The debugger allows you to "single-step" through a batch file
line by line, with the file displayed in a popup window as it executes.  You
can execute or skip the current line, continue execution with the debugger
turned off, view the fully-expanded version of the command line, or exit the
batch file.  The batch debugger can also pop up a separate window to view
current environment variables or aliases so you can check their values during
execution, and can pop up the 640LIST command to display the contents of
any file.

To start the debugger, insert a 664SETDOS /Y1 command at the beginning of
the portion of the batch file you want to debug, and a SETDOS /Y0 command at
the end.  You can also invoke SETDOS /Y1 from the prompt, but because the
debugger is automatically turned off whenever 4DOS returns
to the prompt, you must enter the SETDOS command and the batch file name on
the same line, for example:

     c:\> setdos /y1 ^ mybatch.btm

If you use the debugger regularly you may want to define a simple alias to
invoke it, for example:

     c:\> alias trace `setdos /y1 ^ %&`

This alias simply enables the debugger, then runs whatever command is passed
to it.  You can use the alias to debug a batch file with a command like this:

     c:\> trace mybatch.btm

You can also start or stop the debugger by pressing Ctrl-F5 while a
batch file is waiting for input, such as in an 636INPUT or
635INKEY statement.  You must complete the input (press Enter
during INPUT, or any other key during INKEY) before the keystroke
will be recognized and the debugger will start.

When the debugger is running you can control its behavior with
keystrokes.  Debugging continues after each keystroke unless
otherwise noted:

!INDENT 30 5 5 5
     T(race), Enter, or F8    Execute the current command.  If it
     calls a subroutine with 629GOSUB, or another batch file with
     599CALL, single-step into the called subroutine or batch file.

     S(tep) or F10            Execute the current command, but
     execute any subroutine or 599CALLed batch file without
     single-stepping.

     J(ump)                   Skip the current command and proceed to
     the next command.

     X (Expand)               Display the next command to be
     executed, after expansion of aliases and environment variables.

     L(ist)                   Prompt for a file name and then view
     the file with the 640LIST command.

     V(ariables)              Open a popup window to display the
     current environment, in alphabetical order.

     A(liases)                Open a popup window to display the
     current aliases, in alphabetical order.

     O(ff) or Esc             Turn off the debugger and continue with
     the remainder of the batch file.

     Q(uit)                   Quit the debugger and the current batch
     file, without executing the remainder of the file.
!INDENT 0

The debugger highlights each line of the batch file as it is executed.  It
executes the commands on the line one at a time, so when a line contains more
than one command, the highlight will not move as each command is
executed.  To see the individual commands, use the X key to expand each
command before it is executed.

If you use a "prefix" command like 623EXCEPT, 626FOR, 628GLOBAL, or
662SELECT, the prefix command is considered one command, and each command
it invokes is another.  For example, this command line executes four commands
-- the 626FOR and three 619ECHO commands:

     for %x in (a b c) do echo %x

You cannot use the batch debugger with 116REXX files; it can only be used
with normal 4DOS batch files.

The debugger gives you a detailed, step-by-step view of batch file execution,
and will help solve particularly difficult batch file problems.  However, in
some cases you will find it easier to diagnose these problems with techniques
that allow you to review what is happening at specific points in the batch
file without stepping through each line individually.

There are several tricks you can use for this purpose.  Probably the simplest
is to turn 619ECHO on at the beginning of the file while you're testing
it, or use 664SETDOS /V2 to force ECHO on even if an ECHO OFF command is used in the batch
file.  This will give you a picture of what is happening as the file is
executed, without stopping at each line.  It will make your output look messy
of course, so just turn it off once things are working.  You can also turn ECHO
on at the beginning of a group of commands you want to "watch", and off at the
end, just by adding ECHO commands at the appropriate spots in your file.

If an error occurs in a batch file, the error message will display the name of
the file, the number of the line that contained the error, and the error
itself.  For example:

     e:\test.bat [3] Invalid parameter "/d"

tells you that the file E:\TEST.BAT contains an error on line 3.  The first
line of the batch file is numbered 1.

Another trick, especially useful in a fast-moving batch file or one where the
screen is cleared before you can read messages, is to insert 650PAUSE
commands wherever you need them in order to be able to watch what's
happening.  You can also use an 647ON ERRORMSG command to pause if an
error occurs, then continue with the rest of the file (the first command
below), or to quit if an error occurs (the second command):

     on errormsg pause
     on errormsg quit

If you can't figure out how your aliases and variables are expanded, try
turning 643LOG on at the start of the batch file.  LOG keeps track of all
commands after alias and variable expansion are completed, and gives you a
record in a file that you can examine after the batch file is done.  You
must use a standard LOG command; LOG /H (the history log) does not work in
batch files.

You may also want to consider using 050redirection to capture your batch
file output.  Simply type the batch file name followed by the redirection
symbols, for example:

     c:\> mybatch >& testout

This records all batch file output, including error messages, in the file
TESTOUT, so you can go back and examine it.  If you have 619ECHO ON in
the batch file you'll get the batch commands intermingled with the output,
which can provide a very useful trace of what's happening.  Of course,
output from full-screen commands and programs that don't write to the
standard output devices can't be recorded, but you can still gain a lot of
useful information if your batch file produces any output.

If you're using 050redirection to see the output, remember that any
prompts for input will probably go to the output file and not to the screen,
so you need to know in advance the sequence of keystrokes required to get
through the entire batch file, and enter them by hand or with 638KEYSTACK.
;---------------------------------------------------------------------------
!TOPIC 113 Batch File String Processing
!NOINDEX

As you gain experience with batch files, you're likely to find that you need
to manipulate text strings.  You may need to prompt a user for a name or
password, process a list of files, or find a name in a phone list.  All of
these are examples of string processing -- the manipulation of lines of
readable text.

4DOS includes several features that make string processing easier.  For
example, you can use the 635INKEY and 636INPUT commands for user input;
the 619ECHO, 660SCREEN, 661SCRPUT, and 684VSCRPUT commands for
output; and the 626FOR command or the 274@FILEREAD function to scan
through the lines of a file.  In addition, 241variable functions offer a
wide range of string handling capabilities.

For example, suppose you need a batch file that will prompt a user for a name,
break the name into a first name and a last name, and then run a hypothetical
LOGIN program.  LOGIN expects the syntax /F:first /L:last with both the
first and last names in upper case and neither name longer than 8
characters.  Here is one way to write such a program:

     @echo off
     setlocal
     unalias *
     input Enter your name (no initials):  %%name

     set first=%@word[0,%name]
     set flen=%@len[%first]
     set last=%@word[1,%name]
     set llen=%@len[%last]

     iff %flen gt 8 .or. %llen gt 8 then
        echo First or last name too long
        quit
     endiff

     login /F:%@upper[%first] /L:%@upper[%last]
     endlocal

The 665SETLOCAL command at the beginning of this batch file saves the
environment and aliases.  Then the 678UNALIAS * command removes any
existing aliases so they won't interfere with the behavior of the commands
in the remainder of the batch file.  The first block of lines ends with an
636INPUT command which asks the user to enter a name.  The user's input
is stored in the environment variable NAME.

The second block of lines extracts the user's first and last names from the
NAME variable and calculates the length of each.  It stores the first and
last name, along with the length of each, in additional environment
variables.  Note that the 329@WORD function numbers the first word as 0,
not as 1.

The 634IFF command in the third block of lines tests the length of both
the first and last names.  If either is longer than 8 characters, the batch
file displays an error message and ends.  Finally, in the last block, the
batch file executes the LOGIN program with the appropriate parameters, then
uses the 621ENDLOCAL command to restore the original environment and alias
list.  At the same time, ENDLOCAL discards the temporary variables that the
batch file used (NAME, FIRST, FLEN, etc.).

When you're processing strings, you also need to avoid some common traps.  The
biggest one is handling special characters.

Suppose you have a batch file with these two commands, which simply accept a
string and display it:

     input Enter a string:  %%str
     echo %str

Those lines look safe, but what happens if the user enters the string "some >
none" (without the quotes).  After the string is placed in the variable STR,
the second line becomes:

     echo some > none

The ">" is a 050redirection symbol, so the line echoes the string "some"
and redirects it to a file called NONE - probably not what you expected.  You
could try using quotation marks to avoid this kind of problem
(see 118Argument Quoting), but that won't quite work.  If you use
back-quotes (ECHO `%STR`), the command will echo the four-character string
%STR.  Environment variable names are not expanded (replaced by their
contents) when they are inside back-quotes.

If you use double quotes (ECHO "%STR"), the string entered by the user will
be displayed properly, and so will the quotation marks.  With double quotes,
the output would look like this:

     "some > none"

As you can imagine, this kind of problem becomes much more difficult if you
try to process text from a file.  Special characters in the text can cause
all kinds of confusion in your batch files.  Text containing back-quotes,
double quotes, or 050redirection symbols can be virtually impossible to
handle correctly.

One way to overcome these potential problems is to use the 664SETDOS /X
command to temporarily disable redirection symbols and other special
characters.  The two-line batch file above would be a lot more likely to
produce the expected results if it were rewritten this way:

     setdos /x-15678
     input Enter a string:  %%str
     echo %str
     setdos /x0

The first line turns off 101alias processing and disables several special
symbols, including the command separator (see 041Multiple Commands) and
all 050redirection symbols.  Once the string has been processed, the last
line re-enables the features that were turned off in the first line.

If you need advanced string processing capabilities beyond those provided by
4DOS, you may want to consider using the 116REXX language.  Our products
support external REXX programs for this purpose.
;---------------------------------------------------------------------------
!TOPIC 114 Batch File Line Continuation
!NOINDEX

4DOS will combine multiple lines in the batch file into a single line for
processing when you include the 086escape character as the very last
character of each line to be combined (except the last).  The default escape
character is Ctrl-X (ASCII 24, which appears on screen as an up-arrow
[].)  For example:

     echo The quick brown fox jumped over the lazy
     sleeping
     dog. > alphabet

You cannot use this technique to extend a batch file line beyond the normal
line length limit of 511 characters.
;---------------------------------------------------------------------------
!TOPIC 115 Batch File Compression
!NOINDEX

You can compress your batch files with a program called BATCOMP.EXE, which
is distributed with 4DOS.  This program condenses batch files by about a
third and makes them unreadable with the 640LIST command and similar
utilities.  Compressed batch files run at approximately the same speed as
regular .BTM files.

You may want to consider compressing batch files if you need to distribute
them to others and keep your original code secret or prevent your users
from altering them.  You may also want to consider compressing batch files
to save some disk space on the systems where the compressed files are
used.  (However, you will not save space if you keep your compressed batch
files on a disk compressed with a program like DBLSPACE, Stacker, or
SuperStor.)

The syntax for the batch compression program is

     BATCOMP [/Ekkkk /K /O /Q] InputFile [OutputFile]

For example, to compress MYBATCH.BAT and save the result as MYBATCH.BTM:

     c:\> batcomp mybatch.bat mybatch.btm

You must specify the full name of the input file, including its extension,
on the BATCOMP command line.  If you do not specify the output file,
BATCOMP will use the same base name as the input file and add a .BTM
extension.  If you do specify a output file name, you must give an
extension or the output file will not have one.  See 704BATCOMP for
more information on options and usage.

Under 4DOS, compressed .BTMs must be less than 64K bytes long. You
can usually work around this limitation by breaking a very long batch file
into two or more smaller files that CALL or chain to each other, and then
compiling the shorter files separately.

JP Software does not provide a decompression utility to decompress batch
files.  If you use BATCOMP.EXE, make sure that you also keep a copy of the
original batch file for future inspection or modification.

You can adopt one of two strategies for keeping track of your original source
files and compressed batch files.  First, you may want to create the source
files with a traditional .BAT extension and reserve the .BTM extension for
compressed batch files.  The advantage of this approach is that you can
modify and test the uncompressed versions at any time, although they will run
in the slower, traditional mode unless they begin with a 641LOADBTM
command.

If you prefer, you can use a .BTM extension for both the source and
compressed files.  In this case you will have to use a different directory or
a different base name for each file.  For example, you might use
SOURCE\MYBATCH.BTM for the source file and COMP\MYBATCH.BTM for the
compressed version, or use MYBATCHS.BTM for the source file and MYBATCH.BTM
for the compressed file (however, the latter approach may make it more
difficult to keep track of the correspondence between the source file and
the compressed file).

BATCOMP and its 32-bit cousin, BATCOM32 (distributed with some versions of
0204NT and Take Command), are character-mode applications designed to
run in the environments where our command processors run.  A batch file
compressed with any copy of BATCOMP or BATCOM32 can be used with any
current JP Software command processor (subject to 4DOS's 64K .BTM file
size limit).

If you plan to distribute batch files to users of different platforms, be sure
to see 054Special Character Compatibility.
;---------------------------------------------------------------------------
!TOPIC 116 REXX Support
!NOINDEX

REXX is a file and text processing language developed by IBM, and available
on many PC and other platforms.  You can invoke REXX programs from 4DOS
using executable extensions.  REXX is an ideal extension to the 4DOS batch
language, especially if you need advanced string processing capabilities.

The REXX language is not built into 4DOS, and requires a separate REXX
processor.  REXX support is built into IBM PC DOS 7.0 and PC DOS 2000 as
well as into IBM OS/2.  You can also purchase add-on REXX software such
as Enterprise Alternatives' Enterprise REXX, or Quercus's Personal REXX.

REXX programs are stored in either .BAT or .REX files.  .REX files are used
for Quercus's Personal REXX; .BAT files are used for REXX programs under
IBM PC DOS 7.0 and above, and can also be used with Personal REXX as
described below.

To enable support for .REX files, you must define an 082executable
extension that tells 4DOS to load Personal REXX when you invoke a .REX
file.  For example:

     set .rex=c:\prexx\rexx.exe

If you store REXX programs in .BAT files, the way you enable REXX support
depends on whether you are running PC DOS 7.0 or above (which includes REXX),
or another operating system such as MS-DOS or an OS/2 DOS session, where
native REXX support is not available and a third-party product must be
used.  The differences are:

!INDENT 7 5 5 5
     * If you are using PC DOS 7.0 or above, 4DOS automatically checks
     each .BAT file to see if it contains a REXX program (see below).  If
     a REXX program is found, 4DOS searches the 138PATH for REXX.EXE, the
     REXX interpreter included with the operating system.  You can use
     the Options 2 page of the 648OPTION dialogs or the 390REXXPath
     directive in 4DOS.INI to specify the location of the REXX interpreter
     if REXX.EXE is not on your PATH, or if you wish to use a different
     REXX system whose interpreter is not named REXX.EXE.

     * If you are not using PC DOS 7.0 or above, 4DOS does not assume
     that it should check each .BAT file to see if it contains a REXX
     program.  To enable this feature you must explicitly set the
     390REXXPath directive in 4DOS.INI to define the name and path
     for your REXX interpreter.
!INDENT 0

Once you have enabled REXX execution of .BAT files by setting REXXPath or
using PC DOS 7.0 or later, 4DOS checks the first 2 characters of the first
line of each .BAT file.  If the first 2 characters are [/*], the beginning
of a REXX comment, 4DOS calls your REXX interpreter to execute the .BAT file.

All of the REXX processors described above (Enterprise REXX, Personal REXX
and PC DOS's built in REXX) extend the interface between REXX and 4DOS
by allowing you to invoke 4DOS commands from within a REXX program.

For details on communication between REXX and 4DOS, or for
more information on any aspect of REXX, see your REXX documentation.
;---------------------------------------------------------------------------
!TOPIC 117 Command Parsing
!NOINDEX
!TTY

Whenever you type something at the command line and press the Enter
key, or include a command in a batch file, you have given a command to
4DOS, which must figure out how to execute your command.  If you
understand the general process that is used, you will be able to make the
best use of the commands.  Understanding these steps can be especially
helpful when working with complex aliases or batch file commands.

To decide what activity to perform, 4DOS goes through several steps.
Before it starts, it writes the entire command line (which may contain
multiple commands) to the history log file if history logging has been
enabled with the LOG /H command (see 643LOG), and the command did
not come from a batch file.  Then, if the line contains multiple
commands, the first command is isolated for processing.

4DOS begins by dividing the command into a command name and a command
tail.  The command name is the first word in the command; the tail is
everything that follows the command name.  For example, in the command line

     dir *.txt /2/p/v

the command name is "dir", and the command tail is " *.txt /2/p/v".

Next 4DOS tries to match the command name against its list
of aliases.  If it finds a match between the command name and one of the
aliases you've defined, it replaces the command name with the contents of the
alias.  This substitution is done internally and is not normally visible to
you; however, you can view a command line with aliases expanded by pressing
Ctrl-F after entering the command at the prompt.

If the alias included parameters (%1, %2, etc.), the parameter values are
filled in from the text on the command line, and any parameters used in this
process are removed from the command line.  The process of replacing a
command name that refers to an alias with the contents of the alias, and
filling in the alias parameters, is called alias expansion.

This expansion of an alias creates a new command name:  the first word of the
alias.  This new command name is again tested against the list of aliases,
and if a match is found the contents of the new alias is expanded just like
the first alias.  This process, called nested alias expansion, continues
until the command name no longer refers to an alias.

Once it has finished with the aliases, 4DOS next tries to match the command
name with its list of internal commands.  If it is unsuccessful, 4DOS knows
that it will have to search for a batch file or external program to execute
your command.

The next step is to locate any batch file or alias parameters, environment
variables, internal variables, or variable functions in the command, and
replace each one with its value.  This process is called variable expansion.

The variable expansion process is modified for certain internal commands,
like EXCEPT, IF, and GLOBAL.  These commands are always followed by another
command, so variable expansion takes place separately for the original
command and the command that follows it.

Once all of the aliases and environment variables have been expanded, 4DOS
will echo the complete command to the screen (if command-line echo has been
enabled) and write it to the log file (if command logging has been turned on).

Before it can actually execute your command, 4DOS must scan the command tail
to see if it includes 051redirection or 052piping.  If so, the proper
internal switches are set to send output to an alternate device or to a file,
instead of to the screen.

Finally, it is time to execute the command.  If the command name matches an
internal command, 4DOS will perform the activities you have
requested.  Otherwise, 4DOS searches for an executable (.COM or .EXE) file,
a batch file, or a file with an executable extension that matches the command
name (see the detailed description of this search on page
895Executable Files and File Searches).

Once the internal command or external program has terminated, 4DOS saves the
result or exit code that the command generated, cleans up any redirection
that you specified, and then returns to the original command line to retrieve
the next command.  When all of the commands in a command line are finished,
the next line is read from the current batch file, or if no batch file is
active, the prompt is displayed.

You can disable and re-enable several parts of command parsing (for example
alias expansion, variable expansion, and redirection) with the SETDOS /X
command (see 664SETDOS).
;---------------------------------------------------------------------------
!TOPIC 118 Argument Quoting
!NOINDEX

As it parses the command line, 4DOS looks for command separators [^],
conditional commands (|| or &&), white space (spaces, tabs, and
commas), percent signs [%] which indicate variables to be expanded, and
redirection and piping characters (>, <, or |).

Normally, these special characters cannot be passed to a command as part of
an argument.  However, you can include any of the special characters in an
argument by enclosing the entire argument in back-quotes [`] or double
quotes ["].  Although both back-quotes and double quotes will let you
build arguments that include special characters, they do not work the same
way.

No alias or variable expansion is performed on an argument enclosed in
back-quotes.  Redirection symbols inside the back-quotes are ignored.  The
back-quotes are removed from the command line before the command is executed.

No alias expansion is performed on expressions enclosed in double
quotes.  Redirection symbols inside double quotes are ignored.  However,
variable expansion is performed on expressions inside double quotes.  The
double quotes themselves will be passed to the command as part of the
argument.

For example, suppose you have a batch file CHKNAME.BTM which expects a name
as its first parameter (%1).  Normally the name is a single word.  If you
need to pass a two-word name with a space in it to this batch file you
could use the command:

     c:\> chkname `MY NAME`

Inside the batch file, %1 will have the value MY NAME, including the
space.  The back-quotes caused 4DOS to pass the string to the batch file as a
single argument, rather than as the two separate parameters MY and NAME.
The quotes keep characters together and reduce the number of arguments in
the line.

When an alias is defined in a batch file or from the command line, its
argument can be enclosed in back-quotes to prevent the expansion of
replaceable parameters, variables, and multiple commands until the alias is
invoked.  See 595ALIAS for details.

You can disable and re-enable back-quotes and double quotes with the
664SETDOS /X command.
;---------------------------------------------------------------------------
!TOPIC 131 Using the Environment
!NOINDEX

The environment is a collection of information about your computer that
every program receives.  Each entry in the environment consists of a
variable name, followed by an equal sign and a string of text.  You can
automatically substitute the text for the variable name in any command.  To
create the substitution, include a percent sign [%] and a variable name
on the command line or in an alias or batch file.

The following standard environment variables have special meanings in 4DOS:

        049CDPATH / _CDPATH  Directory change path
        132CMDLINE           Current command line
        133COLORDIR          Directory colors
        134COMSPEC           Name of the command processor
        135COPYCMD           Default COPY/MOVE options (Compatibility only)
        136DIRCMD            Default DIR options (Compatibility only)
        145DOSHELP           Path to external DOS help system
        137FILECOMPLETION    Filename completion customization
        147LOGINNAME         User login name
        823NO_SEP            Removes the thousands separators from numbers
        138PATH              Executable file search path
        143PATHEXT           Extensions to search for in the PATH
        139PROMPT            Command prompt
        140TEMP              Directory for temporary files
        141TEMP4DOS          Directory for temporary files
        146TITLEPROMPT       Title bar prompt (Windows 95/98/ME and OS/2 only)
        142TMP               Directory for temporary files
        759TZ                Time zone information
;        TMPDIR
;        TEMPDIR
;        OPTKEYS
;        OPTHELP

4DOS also supports two special types of variables, which are documented
separately:

!INDENT 5 5 5 5
     161Internal Variables are similar to environment variables, but
     are stored internally within 4DOS, and are not visible in the
     environment.  They provide information about your system for use in
     batch files and aliases.  See also 239Internal Variables by Name.

     241Variable Functions are referenced like environment variables, but
     perform additional functions like file handling, string manipulation and
     arithmetic calculations.  See also 349Variable Functions by Name.
!INDENT 0

The 663SET command is used to create environment variables.  For
example, you can create a variable named BACKUP like this:

     c:\> set BACKUP=*.bak;*.bk!;*.bk

If you then type

     c:\> del %BACKUP

it is equivalent to the command

     DEL *.bak;*.bk!;*.bk

The size of the environment can be specified on the Startup page of the
648OPTION dialogs, with the 377Environment and 378EnvFree
directives in 4DOS.INI, or by the /E: 352startup switch.

Environment variable names may contain any alphabetic or numeric
characters, the underscore character [_], and the dollar sign [$].
You can force acceptance of other characters by including the full
variable name in square brackets, like this:  %[AB##2].  You can also
"nest" environment variables using square brackets.  For example
%[%var1] means "the contents of the variable whose name is stored in
VAR1."  A variable referenced with this technique cannot contain more
than 511 characters of information.  Nested variable expansion can be
disabled with the 664SETDOS /X command.

Environment variables may contain alias names.  4DOS will substitute
the variable value for the name, then check for any
alias name which may have been included within the variable's value.  For
example, the following commands would generate a 2-column directory of the
.TXT files:

     c:\> alias d2 dir /2
     c:\> set cmd=d2
     c:\> %cmd *.txt

The trailing percent sign that was traditionally required for
environment variable names is not usually required in 4DOS, which accept
any character that cannot be part of a variable name (including a space)
as the terminator.  However, the trailing percent can be used to maintain
compatibility.

The trailing percent sign is needed if you want to join two variable
values.  The following examples show the possible interactions between
variables and literal strings.  First, create two environment variables
called ONE and TWO this way:

     c:\> set ONE=abcd
     c:\> set TWO=efgh

Now the following combinations produce the output text shown:

     %ONE%TWO            abcdTWO   ("%ONE%" + "TWO")
     %ONE%TWO%           abcdTWO   ("%ONE%" + "TWO%")
     %ONE%%TWO           abcdefgh  ("%ONE%" + "%TWO")
     %ONE%%TWO%          abcdefgh  ("%ONE%" + "%TWO%")
     %ONE%[TWO]          abcd[TWO] ("%ONE%" + "[TWO]")
     %ONE%[TWO]%         abcd[TWO] ("%ONE%" + "[TWO]%")
     %[ONE]%TWO          abcdefgh  ("%[ONE]" + "%TWO")
     %[ONE]%TWO%         abcdefgh  ("%[ONE]" + "%TWO%")

If you want to pass a percent sign to a command, or a string which
includes a percent sign, you must use two percent signs in a row.  Otherwise,
the single percent sign will be seen as the beginning of a
variable name and will not be passed on to the command.  For example, to
display the string "We're with you 100%" you would use the command:

     echo We're with you 100%%

You can also use back-quotes around the text, rather than a double percent
sign.  See 118Argument Quoting for details.

Each copy of 4DOS maintains its own copy of the environment.  The copy of
the environment maintained by the primary shell is called the master
environment.  When using a secondary shell, 4DOS will allow you to access
the master environment in the primary shell with the commands 663SET
/M, 680UNSET /M, and 622ESET /M, and with the 304%@MASTER
variable function.
;---------------------------------------------------------------------------
!TOPIC 132 CMDLINE
!NOINDEX
!TTY

CMDLINE is the fully expanded text of the currently executing command
line.  CMDLINE is set just before invoking any .COM, .EXE, .BTM or .BAT
file.  If a command line is prefaced with an "@" to prevent echoing,
it will not be put in CMDLINE, and any previous CMDLINE variable will be
removed from the environment.  This allows you to squeeze out the last few
bytes of environment space before loading TSRs by prefacing each TSR
command with an "@".
;---------------------------------------------------------------------------
!TOPIC 133 COLORDIR
!NOINDEX

COLORDIR controls directory display colors used by 612DIR and
662SELECT.  See the discussion of color-coded directories under DIR
for a complete description.
;---------------------------------------------------------------------------
!TOPIC 134 COMSPEC
!NOINDEX
!TTY

COMSPEC contains the full path and name of 4DOS.  For example, if 4DOS
is stored in the directory C:\4DOS, the COMSPEC variable should be set to
C:\4DOS\4DOS.COM.  COMSPEC is used by applications which need to find the
command processor to implement a "shell to DOS" feature.
!TTY

You can set the COMSPEC variable by specifying the COMSPEC path when your
system starts (see 352Startup), or by using a 663SET command
as you would for any environment variable.

If you include a COMSPEC path on the SHELL= line in 352CONFIG.SYS, or
in the DOS_SHELL setting for an OS/2 DOS session, 4DOS will set the
COMSPEC variable automatically to the path you specify, and append the
filename 4DOS.COM.  This method also allows 4DOS to use the COMSPEC path to
find other files during the startup process, such as 3514DOS.INI and
1094START.

If you don't include the COMSPEC path on the primary shell's startup
command line, 4DOS will set the COMSPEC variable to the root directory of
the boot drive (x:\4DOS.COM where "x" is the boot drive), and will also
look in the root directory of the boot drive for 4DOS.INI and 4START.

You can also set the COMSPEC variable manually with a 663SET command
in AUTOEXEC.BAT.  This method will override any setting made with a COMSPEC
path on the primary shell's startup command line as described above.  We do
not recommend this approach, because it will allow applications to shell to
DOS, but will not provide the information the primary 4DOS shell needs to
find its files during the startup process.

You may need to use the SET command to change the COMSPEC variable when
dynamically 797relocating 4DOS to another drive.
;---------------------------------------------------------------------------
!TOPIC 135 COPYCMD
!NOINDEX
!TTY

COPYCMD is used by MS-DOS 6.20 and PC DOS 6.3 COMMAND.COM and above
to hold default options for the 606COPY, 646MOVE, and XCOPY
commands.  4DOS does not support this variable, but you can achieve
the same effect with an 101alias.  For example, if you want the COPY and
MOVE commands to default to prompting you before overwriting an existing
file (see also the 4DOS.INI 450CopyPrompt directive), you could use
these aliases:

     c:\> alias copy = `*copy /r`
     c:\> alias move = `*move /r`

If you wish to use COPYCMD for compatibility with systems that do
not use 4DOS, you can define the aliases this way:

     c:\> alias copy = `*copy %copycmd`
     c:\> alias move = `*move %copycmd`

However, please note that there are a number of subtle differences
in regard to the available options and their usage between the DOS COPY
and MOVE commands and 4DOS' own implementation thereof, so that the above
recommendation may not always be applicable.
;---------------------------------------------------------------------------
!TOPIC 136 DIRCMD
!NOINDEX
!TTY

DIRCMD is used by MS-DOS / PC DOS 5.0 COMMAND.COM and above, and some
versions of CMD.EXE to hold default options for the 612DIR command.  4DOS
does not support this variable, but you can achieve the same effect with
an 101alias.  For example, if you want the DIR command to default to wide
column display with a vertical sort and a pause at the end of each page,
you could use this alias:

     c:\> alias dir = `*dir /w/p/v`

If you wish to continue to use DIRCMD for compatibility with systems that
do not use 4DOS, you can define the alias this way:

     c:\> alias dir = `*dir %dircmd`
;---------------------------------------------------------------------------
!TOPIC 137 FILECOMPLETION
!NOINDEX
!TTY

FILECOMPLETION sets the files made available during filename completion for
selected commands.  See 037Customizing Filename Completion for a complete
description of the format of this variable.
;---------------------------------------------------------------------------
!TOPIC 823 NO_SEP
!NOINDEX
!TTY

NO_SEP removes the thousands separators from numbers shown or returned by
the 4DOS commands and functions.  The exact value to which NO_SEP is set
does not matter (e.g. "SET NO_SEP=1").  Type "SET NO_SEP=" or "UNSET NO_SEP"
to turn thousands separators back on.

NO_SEP affects also the following external commands of PC DOS 6.3 or newer
versions (see your 65535PC DOS documentation for more information on them):

     CHKDSK
     FORMAT
     MEM

NO_SEP also affects the FDISK utility of DR-DOS 8.0, which however uses
its value as the thousands separator.  For example, to set the thousands
separator to a dot (.) there, type

     c:\> set no_sep=.
;---------------------------------------------------------------------------
!TOPIC 138 PATH
!NOINDEX

PATH is a list of directories that 4DOS will search for executable
files that aren't in the current directory.  PATH may also be used by some
application programs to find their own files.  See the 649PATH
command for a full description of this variable.
;---------------------------------------------------------------------------
!TOPIC 143 PATHEXT
!NOINDEX

PATHEXT can be used to select the extensions to look for when searching
the 138PATH for an executable file.  It consists of a list of
extensions, separated by semicolons.  For example, to replicate the
default extension list used by 4DOS:

     set pathext=.com;.exe;.btm;.bat

PATHEXT is ignored unless the 477PathExt setting is set to Yes in
4DOS.INI.  Once PATHEXT is enabled the standard path search for .COM,
.EXE, .BTM, and .BAT, files is replaced by a search for files with the
extensions listed in PATHEXT, in the order listed there.

Enabling PATHEXT affects only the standard path search, it does not
affect the subsequent searches for files with 082executable
extensions.  PATHEXT is supported for compatibility reasons but should
not generally be used as a substitute for executable extensions, which
are much more flexible.  For more details on path searches, see the
649PATH command.

CAUTION:  If you set PathExt = Yes in 4DOS.INI and then fail to set the
PATHEXT variable, path searches will fail as there will be no extensions
for which to search!
;---------------------------------------------------------------------------
!TOPIC 139 PROMPT
!NOINDEX

PROMPT defines the command-line prompt.  It can be set or changed with
the 652PROMPT command.
;---------------------------------------------------------------------------
!TOPIC 140 TEMP
!NOINDEX
!TTY

TEMP specifies the directory where 4DOS should store temporary
050pipe and clipboard files if the 141TEMP4DOS variable doesn't
exist.  Some other programs also use TEMP to define where they should
place their temporary files.  See also 141TEMP4DOS and 142TMP.
;---------------------------------------------------------------------------
!TOPIC 141 TEMP4DOS
!NOINDEX
!TTY

TEMP4DOS specifies where 4DOS should store temporary 050pipe
and clipboard files.  Also see 140TEMP and 142TMP.
;---------------------------------------------------------------------------
!TOPIC 142 TMP
!NOINDEX
!TTY

TMP specifies the directory where 4DOS should store temporary 050pipe
and clipboard files if the 140TEMP and 141TEMP4DOS variables
don't exist.
;---------------------------------------------------------------------------
!TOPIC 145 DOSHELP
!NOINDEX
!TTY

DOSHELP specifies the full path to an external DOS help system, if
the executable file is not called HELP.COM or is not accessible via
the 138PATH on your system.  See 16External Help for more details.
;---------------------------------------------------------------------------
!TOPIC 146 TITLEPROMPT
!NOINDEX
!TTY

TITLEPROMPT specifies a string which 652PROMPT will use to build a prompt
in the title bar, if 4DOS is running in Windows 95/98/ME or under OS/2.  It
can be set ot changed using the 768TITLE command.
;---------------------------------------------------------------------------
!TOPIC 147 LOGINNAME
!NOINDEX
!TTY

LOGINNAME specifies the name, the 4DOS 652PROMPT $U will display
as the current user.  The same happens under some COMMAND.COM issues of
DR DOS 6.0 and PalmDOS 1.0, as well as under Novell DOS 7, OpenDOS 7.01,
and DR-DOS 7.02 and above, and is convenient to use in conjunction with
network software, in particular Novell NetWare.
;---------------------------------------------------------------------------
!TOPIC 759 TZ
!NOINDEX
!TTY

TZ is used to establish the local time zone.  The value of this variable
affects the following internal variables: 738_DST, 739_MJD, 740_STZN,
741_STZO, 742_TZN, 743_TZO, 744_UNIXTIME, 745_UTCDATE,
746_UTCDATETIME, 747_UTCHOUR, 748_UTCISODATE, 749_UTCMINUTE,
750_UTCSECOND and 760_UTCTIME whose values are relative to the
Coordinated Universal Time (UTC), formerly known as Greenwich Mean Time
(GMT).  Note that it will also affect all other programs that rely on it, so
it is important to set it to a proper value for your local time zone.

The time on the computer should be set to the local time.  Use the 672TIME
command and the 608DATE command if the time is not automatically maintained
by the computer hardware.

The TZ environment variable can be set by using the 663SET command.  The
existing value of the variable can be edited by using the 622ESET command.

The value of the TZ environment variable is defined by ISO/IEC 9945 (a.k.a.
POSIX or IEEE Std 1003.1).  It should be set as follows (spaces are for
clarity only):

std offset dst offset , rule

The expanded format is as follows:

stdoffset[dst[offset][,start[/time],end[/time]]]

std, dst
    three or more letters that are the designation for the standard (std) or
    summer (dst) time zone.  Only std is required.  If dst is omitted, then
    summer time does not apply in this locale.  Upper- and lowercase letters
    are allowed.  Any characters except for a leading colon (:), digits,
    comma (,), minus (-), plus (+), and ASCII NUL (\0) are allowed.

offset
    indicates the value one must add to the local time to arrive at
    Coordinated Universal Time (UTC).  The offset has the form:

    hh[:mm[:ss]]

    The minutes (mm) and seconds (ss) are optional.  The hour (hh) is
    required and may be a single digit.  The offset following std is
    required.  If no offset follows dst, summer time is assumed to be one
    hour ahead of standard time.  One or more digits may be used; the value
    is always interpreted as a decimal number.  The hour may be between 0
    and 24, and the minutes (and seconds) - if present - between 0 and 59.
    If preceded by a "-", the time zone will be east of the Prime Meridian;
    otherwise it will be west (which may be indicated by an optional
    preceding "+").

rule
    indicates when to change to and back from summer time.  The rule has the
    form:

    date/time,date/time

    where the first date describes when the change from standard to summer
    time occurs and the second date describes when the change back happens.
    Each time field describes when, in current local time, the change to
    the other time is made.

    The format of date may be one of the following:

    Jn
        The Julian day n (1 <= n <= 365).  Leap days are not counted.  That
        is, in all years - including leap years - February 28 is day 59 and
        March 1 is day 60.  It is impossible to explicitly refer to the
        occasional February 29.

    n
        The zero-based Julian day (0 <= n <= 365).  Leap years are counted,
        and it is possible to refer to February 29.

    Mm.n.d
        The d'th day (0 <= d <= 6) of week n of month m of the year (1 <= n
        <= 5, 1 <= m <= 12, where week 5 means "the last d day in month m"
        which may occur in the fourth or fifth week).  Week 1 is the first
        week in which the d'th day occurs.  Day zero is Sunday.

    The time has the same format as offset except that no leading sign ("+"
    or "-") is allowed.  The default, if time is omitted, is 02:00:00.

Some examples are:

TZ=EST5EDT
    Eastern Standard Time is 5 hours earlier than Coordinated Universal Time
    (UTC).  Standard time and daylight saving time both apply to this
    locale.  By default, Eastern Daylight Time (EDT) is one hour ahead of
    standard time (i.e., EDT4).  Since it is not specified, daylight saving
    time starts on the first Sunday of April at 2:00 A.M.  and ends on the
    last Sunday of October at 2:00 A.M.  This is the default when the TZ
    variable is not set.

TZ=EST5EDT4,M4.1.0/02:00:00,M10.5.0/02:00:00
    This is the full specification for the default when the TZ variable is
    not set.  Eastern Standard Time is 5 hours earlier than Coordinated
    Universal Time (UTC).  Standard time and daylight saving time both apply
    to this locale.  Eastern Daylight Time (EDT) is one hour ahead of
    standard time.  Daylight saving time starts on the first (1) Sunday (0)
    of April (4) at 2:00 A.M.  and ends on the last (5) Sunday (0) of
    October (10) at 2:00 A.M.

TZ=PST8PDT
    Pacific Standard Time is 8 hours earlier than Coordinated Universal Time
    (UTC).  Standard time and daylight saving time both apply to this
    locale.  By default, Pacific Daylight Time is one hour ahead of standard
    time (i.e., PDT7).  Since it is not specified, daylight saving time
    starts on the first Sunday of April at 2:00 A.M.  and ends on the last
    Sunday of October at 2:00 A.M.

TZ=NST3:30NDT1:30
    Newfoundland Standard Time is 3 and 1/2 hours earlier than Coordinated
    Universal Time (UTC).  Standard time and daylight saving time both apply
    to this locale.  Newfoundland Daylight Time is 1 and 1/2 hours earlier
    than Coordinated Universal Time (UTC).

TZ=Central Europe Time-2:00
    Central European Time is 2 hours later than Coordinated Universal Time
    (UTC).  Daylight saving time does not apply in this locale.
;---------------------------------------------------------------------------
!TOPIC 161 Internal Variables
!NOINDEX

Internal Variables are special environment variables built into 4DOS
to provide information about your system.  They are not actually stored in
the environment and therefore are invisible to applications scanning the
environment, but they can be used in internal commands, aliases, and batch
files just like any other environment variable.  The values of these
variables are stored internally in 4DOS, and cannot be changed with
the 663SET, 680UNSET, or 622ESET command.  However, you can
override any of the internal variables by defining a new variable with
the same name.

The list below gives a one-line description of each variable, and a
cross-reference which selects a full screen help topic on that
variable.  Most of the variables are simple enough that the one-line
description is sufficient.  However, for those variables marked with an
asterisk [*], the cross-reference topic contains some additional
information you may wish to review.  You can also obtain help on
any variable with a HELP _variablename command at the prompt.

See the discussion after the variable list for some additional
information, and examples of how these variables can be used.  For a
more comprehensive set of examples see the EXAMPLES.BTM file which came
with 4DOS.

Note: The variables marked with an exclamation mark [!] are 4DOS-specific;
they are either not present in 0204NT, or their equivalents there have
different names.  Take this into account when writing portable batch files.

The variables are grouped by category (or see 239Internal
Variables by Name):

Hardware status

        231_ALT            Alt key depressed (0 or 1)
        170_APMAC       !* APM AC line status (on, off, or unknown)
        171_APMBATT     !* APM battery status
        172_APMLIFE     !* APM battery life (0 - 100% or unknown)
        232_CAPSLOCK       CapsLock on (0 or 1)
        184_CPU          * CPU brand and model
        479_CPUSPEED     ! CPU speed in MHz (586 or newer)
        233_CTRL           Ctrl key depressed (0 or 1)
        204_KBHIT          Keystroke waiting in buffer (0 or 1)
        361_LALT           Left Alt key depressed (0 or 1)
        362_LCTRL          Left Ctrl key depressed (0 or 1)
        234_LSHIFT         Left Shift key depressed (0 or 1)
        209_MONITOR      ! Monitor type (mono or color)
        212_NDP          ! Coprocessor brand and model
        235_NUMLOCK        NumLock on (0 or 1)
        363_RALT           Right Alt key depressed (0 or 1)
        364_RCTRL          Right Ctrl key depressed (0 or 1)
        236_RSHIFT         Right Shift key depressed (0 or 1)
        825_SBDSP       !* Sound Blaster DSP version number
        237_SCROLLLOCK     ScrollLock on (0 or 1)
        238_SHIFT          Shift key depressed (0 or 1)
        453_SYSREQ       ! SysReq key depressed (0 or 1)
        480_TSC         !* Time Stamp Counter (586 or newer)
        505_V86          ! CPU is in V86 mode (386 or newer, 0 or 1)
        221_VIDEO        ! Video board type (mono, cga, ega, vga or svga)

Operating system and software status

        169_ANSI         * ANSI driver flag (0 or 1)
        787_APPEND       ! APPEND loaded flag (0 or 1)
        788_ASSIGN       ! ASSIGN loaded flag (0, 1 or -1)
        177_BOOT           Boot drive letter, without a colon
        180_CODEPAGE       Current code page number
        183_COUNTRY        Current country code
        807_DISPLAY      ! DISPLAY.SYS loaded flag (0 or 1)
        193_DOS          * Operating system (DOS, OS/2, etc.)
        194_DOSVER       * Operating system version (5.00, 6.00, 7.00, etc.)
        198_DPMI         ! DPMI version number
        789_DRIVER       ! DRIVER.SYS present flag (0, 1 or -1)
        199_DV           ! DESQview loaded flag (0 or 1)
        790_EGA          ! EGA.SYS loaded flag (0, 1 or -1)
        780_FONTPAGE     ! Current font page number (Arabic/Hebrew only)
        800_GRAFTABL     ! GRAFTABL loaded flag (0, 1 or -1)
        806_GRAPHICS     ! GRAPHICS loaded flag (0 or 1)
        782_MACHINE      ! Machine name in network
        211_MOUSE        ! Mouse driver loaded flag (0 or 1)
        801_MSCDEX       ! MSCDEX/SHSUCDX loaded flag (0, 1 or -1)
        783_NETWORK     !* Installed network components flag byte
        784_NLSFUNC      ! NLSFUNC loaded flag (0, 1 or -1)
        820_POWER        ! POWER.EXE loaded flag (0 or 1)
        802_PRINT        ! PRINT loaded flag (0, 1 or -1)
        785_SHARE        ! SHARE loaded flag (0, 1 or -1)
        803_SMARTDRV     ! SMARTDRV loaded flag (0 or 1)
        804_TASKMAX      ! TASKMAX/TASKMGR loaded flag (0 or 1)
        805_TASKSWITCHER ! DOSSHELL Task Switcher loaded flag (0 or 1)
        778_VCPI         ! VCPI version number
        824_VDS          ! VDS version number
        222_WIN         !* Microsoft Windows mode

4DOS status

        167_4VER           4DOS version (7.50, 7.51, etc.)
        168_ALIAS        ! Free alias space in bytes
        173_BATCH          Batch nesting level
        174_BATCHLINE      Current line number in current batch file
        175_BATCHNAME      Name of current batch file
        500_BATCHTYPE      Type of current batch file
        501_BDEBUGGER      Batch debugger active (0 or 1)
        227_BUILD          4DOS build number
        228_CMDLINE        Contents of the command line
        225_CMDPROC        Command processor name
        502_CMDSPEC        Full pathname of command processor
        192_DNAME          Name of file used to store file descriptions
        229_ECHO           Echo state (0 or 1)
        404_EDITMODE       Current line editing mode (0 or 1)
        200_ENV          ! Free environment space in bytes
        405_EXPANSION      Current expansion mode (SETDOS /X)
        202_HLOGFILE       Current history log file name
        506_ININAME        Full pathname of the current INI file
        779_KEYSTACKED   ! Number of keystrokes in the KSTACK.COM buffer
        205_KSTACK       ! KSTACK.COM load status (0 or 1)
        207_LOGFILE        Current log file name
        216_SHELL          Shell level (0, 1, 2, ...)
        737_STARTPATH      Startup directory of current shell
        366_STDERR         Standard error not redirected flag (0 or 1)
        367_STDIN          Standard input not redirected flag (0 or 1)
        368_STDOUT         Standard output not redirected flag (0 or 1)
        217_SWAPPING    !* Swapping state (XMS, EMS, Disk, None, or off)
        220_TRANSIENT    * Transient shell flag (0 or 1)
        831_VERMAJOR       4DOS major version
        832_VERMINOR       4DOS minor version
        833_VERSION        4DOS version in major.minor format
        223_WINTITLE     * OS/2 or Windows 95/98/ME DOS session window title

Screen, color, and cursor

        176_BG             Background color at cursor position
        178_CI             Current cursor shape in insert mode
        179_CO             Current cursor shape in overstrike mode
        181_COLUMN         Current cursor column
        182_COLUMNS        Screen width
        201_FG             Foreground color at cursor position
        213_ROW            Current cursor row
        214_ROWS           Screen height

Drives and directories

        589_CDROMS         List of CD and DVD drives
        185_CWD            Current drive and directory (d:\path)
        186_CWDS           Current drive and directory with \ (d:\path\)
        187_CWP            Current directory (\path)
        188_CWPS           Current directory with \ (\path\)
        191_DISK           Current drive (C, D, etc.)
        590_DRIVES         List of all available drives
        724_HDRIVES        List of all hard (fixed) drives
        830_LASTDIR        Previous directory (from directory history)
        206_LASTDISK       Last possible drive (E, F, etc.)
        716_READY          List of ready (accessible) drives

Dates and times

        189_DATE         * Current date (mm-dd-yy)
        370_DATETIME     * Current date and time (yyyyMMddhhmmss)
        190_DAY            Day of the month (1 - 31)
        195_DOW            Day of the week (Mon, Tue, Wed, etc.)
        226_DOWF           Day of the week (Monday, Tuesday, etc.)
        196_DOWI           Numeric day of the week (Sun = 1, etc.)
        197_DOY            Day of the year (1 - 366)
        738_DST            Daylight saving time (0 or 1)
        203_HOUR           Hour (0 - 23)
        230_ISODATE        Current date (yyyy-mm-dd)
        454_ISODOWI      ! Numeric day of the week (Mon = 1, etc.)
        736_ISORDATE     ! Current ISO 8601 ordinal date (yyyy-ddd)
        460_ISOWDATE     ! Current ISO 8601 week date (yyyy-Www-d)
        455_ISOWEEK      ! Week of the year pursuant to ISO 8601
        591_ISOWYEAR     ! Current ISO 8601 week date year
        208_MINUTE         Minute (0 - 59)
        739_MJD          ! Modified Julian Day
        210_MONTH          Month of the year (1 - 12)
        240_MONTHF         Month of the year (January, February, etc.)
        215_SECOND         Second (0 - 59)
        740_STZN           Name of time zone for standard time
        741_STZO           Offset in minutes from UTC for standard time
        588_TICK         ! BIOS clock tick since midnight
        219_TIME         * Current time (hh:mm:ss)
        742_TZN            Name of current time zone
        743_TZO            Offset in minutes from UTC for current time zone
        744_UNIXTIME     ! Curent Unix time
        745_UTCDATE        Current UTC date
        746_UTCDATETIME    Current UTC date and time
        747_UTCHOUR        Current UTC hour
        748_UTCISODATE     Current UTC date in ISO format
        749_UTCMINUTE      Current UTC minute
        750_UTCSECOND      Current UTC second
        760_UTCTIME        Current UTC time
        735_WINTICKS       Milliseconds since midnight or since Windows started
        224_YEAR           Year (1980 - 2099)

Error codes

        162?             * Exit code, last external program
        163??           !* Reason for external program termination
        164_?            * Exit code, last internal command
        365_EXECSTR      * Last @EXECSTR return code
        218_SYSERR       * Last DOS error

Compatibility

        166+             * Substitutes command separator
        165=             * Substitutes escape character


Additional Notes

These internal variables are often used in batch files and aliases to examine
system resources and adjust to the current computer settings.  You can examine
the contents of any internal variable (except %= and %+) from the command
line with a command like this:

     c:\> echo %variablename

Some variables return values based on information provided by your operating
system.  These variables will only return correct information if the operating
system provides it.  For example, _APMBATT will not return accurate results
if your operating system and Advanced Power Management drivers do not provide
correct information on battery status to 4DOS.

On disk volumes which do not support long filenames, variables which return a
path or file name will return their result in upper or lower case depending
on the value of the 664SETDOS /U switch or the 446UpperCase directive
in the .INI file.  On volumes which do support long filenames, these variables
will return names as they are stored on the disk and no case shifting will be
performed.  Returned filename values which include long filenames are
not quoted automatically; you must add quotes yourself if they are required
for your use of the variable value (see 118Argument Quoting).

Examples

You can use these variables in a wide variety of ways depending on your
needs.  Here are just a few examples.  For a more comprehensive set of
examples see the EXAMPLES.BTM file which came with 4DOS.

Some of these examples rely on the 633IF and 634IFF commands to
test the value of a variable and perform different actions based on that
value.

In a batch file, set the color based on the video card type:

     iff "%_video"=="mono" then
       color bright white on black
     else
       color bright white on blue
     endiff

Call another batch file if 4DOS is running under DESQview:

     if "%_dv" == "1" call dvstart

Store the current date and time in a file, then save the output of a 612DIR
command in the same file:

     echo Directory as of %_date %_time > dirsave
     dir >> dirsave

Set up a prompt for the primary shell which displays the time and current
directory, and a different one for secondary shells which includes the
shell level rather than the time (see 652PROMPT for details about
setting the prompt).  Also set different background colors for the two
shells, without changing the foreground color.  You might use a sequence
like this in your 4START file (see 109Automatic Batch Files):

     iff %_shell==0 then
       prompt $t $p$g
       color %_fg on blue
     else
       prompt [$z] $p$g
       color %_fg on cyan
     endiff
;---------------------------------------------------------------------------
!TOPIC 162 ?
!NOINDEX
!TTY

? contains the exit code of the last external command.  Many programs
return a "0" to indicate success and a non-zero value to signal an error.
However, not all programs return an exit code.  If no explicit exit code is
returned, the value of %? is undefined.
;---------------------------------------------------------------------------
!TOPIC 163 ??
!NOINDEX
!TTY

?? returns a code which explains how the last program terminated:

     0 -- program terminated normally.
     1 -- program terminated by Ctrl-C or Ctrl-Break.
     2 -- program terminated due to a critical error.
     3 -- program terminated and stayed resident in memory (TSR).
;---------------------------------------------------------------------------
!TOPIC 164 _?
!NOINDEX
!TTY

_? contains the exit code of the last internal command.  It is set to
"0" if the command was successful, "1" if a usage error occurred, "2" if
another command processor error or an operating system error occurred, or
"3" if the command was interrupted by Ctrl-C or Ctrl-Break.  You
must use or save this value immediately, because it is set by every
internal command.
;---------------------------------------------------------------------------
!TOPIC 165 =
!NOINDEX
!TTY

= returns the current 086escape character.  Use this variable, instead
of the actual escape character, if you want your batch files and aliases to
work regardless of how the escape character is defined.  For example, if
the escape character is a Ctrl-X [], both of the commands below
will send a form feed to the printer.  However, if the escape character has
been changed, the first command will send the string "^f" to the printer,
while the second command will continue to work as intended.

     echos f > prn
     echos %=f > prn

See 054Special Character Compatibility for further information.
;---------------------------------------------------------------------------
!TOPIC 166 +
!NOINDEX
!TTY

+ returns the current 041command separator.  Use this variable, instead
of the actual command separator, if you want your batch files and aliases to
work regardless of how the command separator is defined.  For example, if
the command separator is a caret [^], both of the commands below will
display "Hello" on one line and "World" on the next.  However, if the
command separator has been changed the first command will display
"Hello ^ echo World", while the second command will continue to work as
intended.

     echo Hello ^ echo World
     echo Hello %+ echo World

See 054Special Character Compatibility for further information.
;---------------------------------------------------------------------------
!TOPIC 167 _4VER
!NOINDEX
!TTY

_4VER is the current 4DOS version (for example, "7.51").
The current decimal character is used to separate the major and minor
verison numbers (see 421DecimalChar for details).

Note that other JP Software shells, including 0204NT and Take Command,
also use _4VER to report their own version information.  Version numbers of
different shells may be returned in a different format, and will not
correspond to 4DOS version numbers.  For example, at this writing the latest
release of 4NT returns a version number of "6.01U".  To determine which
shell you are running use 225_CMDPROC.
;---------------------------------------------------------------------------
!TOPIC 168 _ALIAS
!NOINDEX
!TTY

_ALIAS contains the free space in the alias list, in bytes.
;---------------------------------------------------------------------------
!TOPIC 231 _ALT
!NOINDEX
!TTY

_ALT is "1" if either Alt key is depressed, otherwise it is "0".
;---------------------------------------------------------------------------
!TOPIC 169 _ANSI
!NOINDEX
!TTY

_ANSI contains "1" if internal flags indicate that ANSI.SYS or a
compatible driver is installed; "0" if not.
!TTY

The internal flags which determine the value of _ANSI depend on the
664SETDOS /A option and the 412ANSI directive in 4DOS.INI, as
shown in the table below.  If SETDOS /A is 0 or ANSI is set to Auto, 4DOS
tests for the presence of an ANSI driver.  In this case you may need to
experiment to see if this variable works properly with your particular
driver, because there is no standard and 100% reliable way to detect an
ANSI driver.  See 842ANSI drivers for more information on ANSI drivers,
and 915ANSI Commands for a list of ANSI X3.64 standard escape sequences.

     SETDOS /A          ANSI Directive       _ANSI Value

     0 (default)        Auto (default)       Result of test
     1                  Yes                  1
     2                  No                   0
;---------------------------------------------------------------------------
!TOPIC 170 _APMAC
!NOINDEX
!TTY

_APMAC is the Advanced Power Management AC line status ("on-line",
"off-line", or "unknown").  An empty string is returned if APM is not
installed on your system.
;---------------------------------------------------------------------------
!TOPIC 171 _APMBATT
!NOINDEX
!TTY

_APMBATT is the Advanced Power Management battery status ("high",
"low", "critical", "charging", or "unknown").  An empty string is returned
if APM is not installed.
;---------------------------------------------------------------------------
!TOPIC 172 _APMLIFE
!NOINDEX
!TTY

_APMLIFE is the Advanced Power Management remaining battery life
(0 - 100 or "unknown").  An empty string is returned if APM is not
installed.
;---------------------------------------------------------------------------
!TOPIC 787 _APPEND
!NOINDEX
!TTY

_APPEND is "1" if APPEND is installed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 788 _ASSIGN
!NOINDEX
!TTY

_ASSIGN is "1" if ASSIGN is installed, "0" if not installed and OK to
install, and "-1" if not installed and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 173 _BATCH
!NOINDEX
!TTY

_BATCH is the current batch nesting level.  It is "0" if no batch file
is currently being processed.
;---------------------------------------------------------------------------
!TOPIC 174 _BATCHLINE
!NOINDEX
!TTY

_BATCHLINE is the current line number in the current batch file.  It is
"-1" if no batch file is currently being processed.
;---------------------------------------------------------------------------
!TOPIC 175 _BATCHNAME
!NOINDEX
!TTY

_BATCHNAME is the full path and file name of the current batch file.  It
is an empty string if no batch file is currently being processed.
;---------------------------------------------------------------------------
!TOPIC 500 _BATCHTYPE
!NOINDEX
!TTY

_BATCHTYPE is the file type of the current batch file, as follows:

!NOWRAP
     Value   Meaning
     -1      not in a batch file
      0      normal
      1      compressed
      2      encrypted
!WRAP
;---------------------------------------------------------------------------
!TOPIC 501 _BDEBUGGER
!NOINDEX
!TTY

_BDEBUGGER is "1" if the batch debugger is actively debugging a file, or
"0" if it is not.
;---------------------------------------------------------------------------
!TOPIC 176 _BG
!NOINDEX
!TTY

_BG is a string containing the first three characters of the screen
background color at the current cursor location (for example, "Bla").
;---------------------------------------------------------------------------
!TOPIC 177 _BOOT
!NOINDEX
!TTY

_BOOT is the boot drive letter (for example, "C"), without a colon.
;---------------------------------------------------------------------------
!TOPIC 227 _BUILD
!NOINDEX
!TTY

_BUILD is the current 4DOS build number (for example, "93").
;---------------------------------------------------------------------------
!TOPIC 589 _CDROMS
!NOINDEX
!TTY

_CDROMS returns a space-delimited list of the CD and DVD drives on the
system (for example, "D: E:").
;---------------------------------------------------------------------------
!TOPIC 232 _CAPSLOCK
!NOINDEX
!TTY

_CAPSLOCK is "1" if the CapsLock key is toggled ON, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 178 _CI
!NOINDEX
!TTY

_CI returns the current shape of the cursor in insert mode, as a percentage
(see 664SETDOS /S and the 419CursorIns directive).
;---------------------------------------------------------------------------
!TOPIC 228 _CMDLINE
!NOINDEX
!TTY

_CMDLINE is the current command line.  (This is most useful inside key
aliases.)  If specified on the command line, returns the contents of the
command line with the %_CMDLINE name removed.
;---------------------------------------------------------------------------
!TOPIC 225 _CMDPROC
!NOINDEX
!TTY

_CMDPROC is the name of the current command processor.  Each JP Software
command processor returns a different value, as follows:

!NOWRAP
     Product                         Returns

     4DOS                            "4DOS"
     4OS2                            "4OS2"
     4NT                             "4NT"
     Take Command                    "TCMD32"
!WRAP

This variable is useful if you have batch files running in more than one
environment, and need to take different actions depending on the underlying
command processor.  If you also need to determine the operating system, see
193_DOS.
;---------------------------------------------------------------------------
!TOPIC 502 _CMDSPEC
!NOINDEX
!TTY

_CMDSPEC is the full pathname of the command processor.
;---------------------------------------------------------------------------
!TOPIC 179 _CO
!NOINDEX
!TTY

_CO returns the current shape of the cursor in overstrike mode, as a
percentage (see 664SETDOS /S and the 420CursorOver directive).
;---------------------------------------------------------------------------
!TOPIC 180 _CODEPAGE
!NOINDEX
!TTY

_CODEPAGE is the current code page number (see 603CHCP).
;---------------------------------------------------------------------------
!TOPIC 181 _COLUMN
!NOINDEX
!TTY

_COLUMN is the current cursor column (for example, "0" for the left
side of the screen).
;---------------------------------------------------------------------------
!TOPIC 182 _COLUMNS
!NOINDEX
!TTY

_COLUMNS is the current number of screen columns (for example, "80").
;---------------------------------------------------------------------------
!TOPIC 183 _COUNTRY
!NOINDEX
!TTY

_COUNTRY is the current country code (see 776COUNTRY).
;---------------------------------------------------------------------------
!TOPIC 184 _CPU
!NOINDEX
!TTY

_CPU is the CPU brand and model, or its brand string if it supports this
feature (later Pentium IIIs and compatible or newer CPUs), for example

!NOWRAP
Mobile Intel(R) Celeron(TM) CPU          800MHz
Intel(R) Celeron(TM) CPU                1200MHz
Intel(R) Pentium(R) III CPU family      1400MHz
Genuine Intel(R) CPU           T2300  @ 1.66GHz
AMD Sempron(tm) 2200+
!WRAP
;---------------------------------------------------------------------------
!TOPIC 479 _CPUSPEED
!NOINDEX
!TTY

_CPUSPEED is the current CPU speed in MHz (may be inaccurate under OS/2).
;---------------------------------------------------------------------------
!TOPIC 233 _CTRL
!NOINDEX
!TTY

_CTRL is "1" if either Ctrl key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 185 _CWD
!NOINDEX
!TTY

_CWD is the current working directory in the format d:\pathname.
;---------------------------------------------------------------------------
!TOPIC 186 _CWDS
!NOINDEX
!TTY

_CWDS has the same value as CWD, except it ends the pathname with a
backslash [\].
;---------------------------------------------------------------------------
!TOPIC 187 _CWP
!NOINDEX
!TTY

_CWP is the current working directory in the format \pathname.
;---------------------------------------------------------------------------
!TOPIC 188 _CWPS
!NOINDEX
!TTY

_CWPS has the same value as CWP, except it ends the pathname with a
backslash [\].
;---------------------------------------------------------------------------
!TOPIC 189 _DATE
!NOINDEX
!TTY

_DATE contains the current system date, in the format mm-dd-yy (U.S.),
dd-mm-yy (Europe), or yy-mm-dd (Japan).  The separator character may vary
depending upon your country information.
;---------------------------------------------------------------------------
!TOPIC 370 _DATETIME
!NOINDEX
!TTY

_DATETIME contains the current system date and time as 14-characters in
the format yyyyMMddhhmmss.  The date part is the same as 230_ISODATE
without separators.
;---------------------------------------------------------------------------
!TOPIC 190 _DAY
!NOINDEX
!TTY

_DAY is the current day of the month (1 to 31).
;---------------------------------------------------------------------------
!TOPIC 191 _DISK
!NOINDEX
!TTY

_DISK is the current disk drive, without a colon (for example, "C").
;---------------------------------------------------------------------------
!TOPIC 807 _DISPLAY
!NOINDEX
!TTY

_DISPLAY is "1" if DISPLAY.SYS is installed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 192 _DNAME
!NOINDEX
!TTY

_DNAME returns the name of the file used to store file descriptions.  It
can be changed with the 423DescriptionName directive in 4DOS.INI or
the 664SETDOS /D command.
;---------------------------------------------------------------------------
!TOPIC 193 _DOS
!NOINDEX
!TTY

_DOS is the operating system and command processor type.  Each JP Software
command processor returns a different value depending on the operating
system, as follows:

!NOWRAP
                     Ŀ
                                            Take     
                      4DOS        4NT       Command  
     Ĵ
      DOS            <DOS name>                     
     Ĵ
      OS/2           OS/2                           
     Ĵ
      OS/2 Warp      OS/2 Warp                      
     Ĵ
      Windows 95    (Win95) DOS  WIN95C    WIN95    
     Ĵ
      Windows 98    (Win98) DOS  WIN98C    WIN98    
     Ĵ
      Windows ME    (WinME) DOS  WINMEC    WINME    
     Ĵ
      Windows NT                 NT        WIN32    
     Ĵ
      Windows 2000               WIN2K     WIN2K    
     Ĵ
      Windows XP                 WINXP     WINXP    
     Ĵ
      Windows 2003               WIN2003   WIN2003  
     Ĵ
      Windows Vista              WINVISTA  WINVISTA 
     Ĵ
      Windows 2008               WIN2008   WIN2008  
     

!WRAP

This variable is useful if you have batch files running in more than one
environment, and need to take different actions depending on the underlying
operating environment or command processor.  If you want the current command
processor name, use 225_CMDPROC.

If the DOS variant can be detected by 4DOS, the _DOS variable will be set to
its brand name. Otherwise, it will be set to "DOS".

Note that 4DOS is intended for use under DOS and the DOS-based versions of
Windows only.  In 4DOS, the _DOS variable will return the string "MS-DOS" in
the non-DOS-based environment of the 025Windows NT line.
;---------------------------------------------------------------------------
!TOPIC 194 _DOSVER
!NOINDEX
!TTY

_DOSVER is the current operating system version (for example, "6.22").

When running 4DOS in an OS/2 DOS session the version number will be 20.3
for OS/2 Warp 3, 20.4 for OS/2 Warp 4, and so on.  When running 4DOS
under the original Windows 95 issue, the version number will be that of
the underlying DOS portion, 7.00.  Under Windows 95 OEMSR2, Windows 98
and 98SE it will be 7.10, and under Windows ME it will be 8.00.  For
various reasons, some DOS versions do not report their actual version.  The
returned version under MS-DOS 6.21 is 6.20, under PC DOS 6.1 it is 6.00,
and under PC DOS 2000 it is 7.00.  DR DOS 3.31 - DR DOS 6.0 as well as
PalmDOS 1.0 will all report a version of 3.31, while Novell DOS 7, Caldera
OpenDOS 7.01 and DR-DOS 7.02 - 7.03 will usually report 6.00 (subject to
SETVER /G).  If 4DOS is running under any version of 025Windows NT,
_DOSVER will report version 5.50.

Since there can be significant differences between some (usually older)
DOS OEM issues, and generally still between DOS versions of different
DOS vendors today, _DOSVER alone may not be sufficient to distinguish
between all of them in multi-platform batch files.  (For example, although
these systems all report a value of 7.00 or 7.10, there are some major
differences between MS-DOS 7.00 and above (as found in the Windows 95/98
bundle), PC DOS 7.0 and above, and DR-DOS 7.04 and above.)

The current decimal character is used to separate the major and minor
version numbers (see 421DecimalChar).
;---------------------------------------------------------------------------
!TOPIC 195 _DOW
!NOINDEX
!TTY

_DOW is the first three characters of the current day of the week
("Mon", "Tue", "Wed", etc.).
;---------------------------------------------------------------------------
!TOPIC 226 _DOWF
!NOINDEX
!TTY

_DOWF is the full day of the week for the current date ("Monday",
"Tuesday", etc.).
;---------------------------------------------------------------------------
!TOPIC 196 _DOWI
!NOINDEX
!TTY

_DOWI is the current day of the week as an integer (1 = Sunday, 2 = Monday,
etc.).
;---------------------------------------------------------------------------
!TOPIC 197 _DOY
!NOINDEX
!TTY

_DOY is the day of the year (1 to 366).
;---------------------------------------------------------------------------
!TOPIC 198 _DPMI
!NOINDEX
!TTY

_DPMI returns the DPMI version level (e.g. 0.90 or 1.00), or "0" if
DPMI isn't present.
;---------------------------------------------------------------------------
!TOPIC 789 _DRIVER
!NOINDEX
!TTY

_DRIVER is "1" if DRIVER.SYS is present, "0" if not present and OK to
install, and "-1" if not present and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 590 _DRIVES
!NOINDEX
!TTY

_DRIVES returns a space-delimited list of the existing drives on the system
(for example, "A: C: D: E:").
;---------------------------------------------------------------------------
!TOPIC 738 _DST
!NOINDEX
!TTY

_DST is "1" if daylight saving time (a.k.a. "summer time") is in effect,
or "0" otherwise.  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 199 _DV
!NOINDEX
!TTY

_DV is "1" if DESQview is loaded or "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 229 _ECHO
!NOINDEX
!TTY

_ECHO is the current echo state.  There are two echo states, one for
the command line and one for batch files.
;---------------------------------------------------------------------------
!TOPIC 404 _EDITMODE
!NOINDEX
!TTY

_EDITMODE is "0" if the line editor is in overstrike mode, or "1" if it is
in insert mode.
;---------------------------------------------------------------------------
!TOPIC 790 _EGA
!NOINDEX
!TTY

_EGA is "1" if EGA.SYS is installed, "0" if not installed and OK to install,
and "-1" if not installed and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 200 _ENV
!NOINDEX
!TTY

_ENV is the free space in the environment, in bytes.
;---------------------------------------------------------------------------
!TOPIC 365 _EXECSTR
!NOINDEX
!TTY

_EXECSTR is the integer return code of the last 265@EXECSTR function.
;---------------------------------------------------------------------------
!TOPIC 405 _EXPANSION
!NOINDEX
!TTY

_EXPANSION is the current expansion mode (i.e. 664SETDOS /X). It is "0"
if everything is enabled, or a string of up to 9 digits for the disabled
modes, e.g. "46" if nested variable expansion and redirection are disabled.
;---------------------------------------------------------------------------
!TOPIC 201 _FG
!NOINDEX
!TTY

_FG is a string containing the first three letters of the screen
foreground color at the current cursor position (for example, "Whi").
;---------------------------------------------------------------------------
!TOPIC 780 _FONTPAGE
!NOINDEX
!TTY

_FONTPAGE is the current font page number.  Nonzero is returned only if
Arabic or Hebrew DOS support is loaded.
;---------------------------------------------------------------------------
!TOPIC 800 _GRAFTABL
!NOINDEX
!TTY

_GRAFTABL is "1" if GRAFTABL is installed, "0" if not installed and OK to
install, and "-1" if not installed and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 806 _GRAPHICS
!NOINDEX
!TTY

_GRAPHICS is "1" if GRAPHICS is installed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 724 _HDRIVES
!NOINDEX
!TTY

_HDRIVES returns a space-delimited list of the hard (fixed) drives on the
system (for example, "C: D:").
;---------------------------------------------------------------------------
!TOPIC 202 _HLOGFILE
!NOINDEX
!TTY

_HLOGFILE returns the name of the current history log file (or an
empty string if 643LOG /H is OFF).
;---------------------------------------------------------------------------
!TOPIC 203 _HOUR
!NOINDEX
!TTY

_HOUR is the current hour (0 - 23).
;---------------------------------------------------------------------------
!TOPIC 506 _ININAME
!NOINDEX
!TTY

_ININAME returns the full pathname of the INI file used by the current
shell.
;---------------------------------------------------------------------------
!TOPIC 230 _ISODATE
!NOINDEX
!TTY

_ISODATE returns the current date in ISO 8601 international format
(yyyy-mm-dd).
;---------------------------------------------------------------------------
!TOPIC 454 _ISODOWI
!NOINDEX
!TTY

_ISODOWI is the current day of the week as an integer (1 = Monday,
2 = Tuesday, ... , 6 = Saturday, 7 = Sunday), pursuant to ISO 8601.
;---------------------------------------------------------------------------
!TOPIC 736 _ISORDATE
!NOINDEX
!TTY

_ISORDATE returns the current ordinal date in ISO 8601 international format
(yyyy-ddd where ddd is the day of the year, 1 to 366).
;---------------------------------------------------------------------------
!TOPIC 460 _ISOWDATE
!NOINDEX
!TTY

_ISOWDATE returns the current week date in ISO 8601 international format
(yyyy-Www-d where ww is the week and d is the week day).  It is possible
that the year is one less or more than the current year because some partial
weeks at the beginning or the end of the year may belong to the last or next
year, according to ISO 8601.
;---------------------------------------------------------------------------
!TOPIC 455 _ISOWEEK
!NOINDEX
!TTY

_ISOWEEK is the week of the year (1 to 53), pursuant to ISO 8601.  Week 1
is the one that includes the first Thursday of the year, or equivalently,
the week which includes 4th of January.  It is possible that a January week
is 52 or 53, or a December week is 1.  This means that, according to
ISO 8601, it belongs to the last or the next calendar year, respectively.
;---------------------------------------------------------------------------
!TOPIC 591 _ISOWYEAR
!NOINDEX
!TTY

_ISOWYEAR is the ISO 8601 week date year.  It may not be the calendar
year but the last or next year.  This means that, according to ISO 8601, the
week belongs to the last or the next calendar year, respectively.
;---------------------------------------------------------------------------
!TOPIC 204 _KBHIT
!NOINDEX
!TTY

_KBHIT returns "1" if one or more keystrokes are waiting in the keyboard
buffer, or "0" if the keyboard buffer is empty.
;---------------------------------------------------------------------------
!TOPIC 779 _KEYSTACKED
!NOINDEX
!TTY

_KEYSTACKED returns the number of the keystrokes left in the KSTACK.COM
buffer.  If KSTACK.COM is not loaded, it returns "0".
;---------------------------------------------------------------------------
!TOPIC 205 _KSTACK
!NOINDEX
!TTY

_KSTACK returns "1" if KSTACK.COM is loaded or "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 361 _LALT
!NOINDEX
!TTY

_LALT is "1" if the Left Alt key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 830 _LASTDIR
!NOINDEX
!TTY

_LASTDIR is the previous directory (from the directory history).
;---------------------------------------------------------------------------
!TOPIC 206 _LASTDISK
!NOINDEX
!TTY

_LASTDISK is the last valid drive letter, without a colon.
;---------------------------------------------------------------------------
!TOPIC 362 _LCTRL
!NOINDEX
!TTY

_LCTRL is "1" if the Left Ctrl key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 207 _LOGFILE
!NOINDEX
!TTY

_LOGFILE returns the name of the current log file (or an empty string
if 643LOG is OFF).
;---------------------------------------------------------------------------
!TOPIC 234 _LSHIFT
!NOINDEX
!TTY

_LSHIFT is "1" if the Left Shift key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 782 _MACHINE
!NOINDEX
!TTY

_MACHINE is the machine name in network (up to 16 bytes in length).
;---------------------------------------------------------------------------
!TOPIC 208 _MINUTE
!NOINDEX
!TTY

_MINUTE is the current minute (0 - 59).
;---------------------------------------------------------------------------
!TOPIC 739 _MJD
!NOINDEX
!TTY

_MJD is the Modified Julian Day or the fractional number of days elapsed
since 17 November 1858, 00:00 UTC.  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 209 _MONITOR
!NOINDEX
!TTY

_MONITOR is the monitor type ("mono" or "color").
;---------------------------------------------------------------------------
!TOPIC 210 _MONTH
!NOINDEX
!TTY

_MONTH is the current month of the year (1 to 12).
;---------------------------------------------------------------------------
!TOPIC 240 _MONTHF
!NOINDEX
!TTY

_MONTHF is the full name of the current month ("January", "February",
etc.).
;---------------------------------------------------------------------------
!TOPIC 211 _MOUSE
!NOINDEX
!TTY

_MOUSE is "1" if a mouse driver is loaded, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 801 _MSCDEX
!NOINDEX
!TTY

_MSCDEX is "1" if MSCDEX or SHSUCDX is installed, "0" if not installed and
OK to install, and "-1" if not installed and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 212 _NDP
!NOINDEX
!TTY

_NDP is the numeric coprocessor brand and model ("None" if not installed,
or "Internal" if it's contained in the CPU).
;---------------------------------------------------------------------------
!TOPIC 783 _NETWORK
!NOINDEX
!TTY

_NETWORK is a byte of flags reflecting the installed network
components.  The order of decreasing network functionality in which the
bits must be tested is:

     bit 6    (64)   Server
     bit 2     (4)   Messenger
     bit 7   (128)   Receiver
     bit 3     (8)   Redirector
     bit 1     (2)   LANPUP (LANtastic 4.0)

For example, if a network server is installed, "64" (2^6) is returned, and
if a network redirector is installed, "8" (2^3) is returned.  Combinations
of these bits are possible.  If "0" is returned, no network components are
installed.
;---------------------------------------------------------------------------
!TOPIC 784 _NLSFUNC
!NOINDEX
!TTY

_NLSFUNC is "1" if NLSFUNC is installed, "0" if not installed and OK to
install, and "-1" if not installed and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 235 _NUMLOCK
!NOINDEX
!TTY

_NUMLOCK is "1" if the NumLock key is toggled ON, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 820 _POWER
!NOINDEX
!TTY

_POWER is "1" if POWER.EXE or a compatible power manager is installed, and
"0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 802 _PRINT
!NOINDEX
!TTY

_PRINT is "1" if PRINT is installed, "0" if not installed and OK to
install, and "-1" if not installed and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 363 _RALT
!NOINDEX
!TTY

_RALT is "1" if the Right Alt key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 364 _RCTRL
!NOINDEX
!TTY

_RCTRL is "1" if the Right Ctrl key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 716 _READY
!NOINDEX
!TTY

_READY returns a space-delimited list of the the currently ready
(accessible) drives on the system (for example, "C: D: E:").
;---------------------------------------------------------------------------
!TOPIC 213 _ROW
!NOINDEX

_ROW is the current cursor row (for example, "0" for the top of the
screen).
;---------------------------------------------------------------------------
!TOPIC 214 _ROWS
!NOINDEX
!TTY

_ROWS is the current number of screen rows (for example, "25").
;---------------------------------------------------------------------------
!TOPIC 236 _RSHIFT
!NOINDEX
!TTY

_RSHIFT is "1" if the Right Shift key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 825 _SBDSP
!NOINDEX
!TTY

_SBDSP returns the Sound Blaster DSP (Digital Signal Processor) version
level (e.g. 4.00), or "0" if no Sound Blaster or compatible sound card is
present.  The correspondence of the DSP version number to the Sound Blaster
card model is as follows:

     1.xx to 2.00       Sound Blaster Version 1.5 or earlier
     2.01+              Sound Blaster Version 2.0
     3.xx               Sound Blaster Pro
     4.xx               Sound Blaster 16 [with Advanced Signal Processing]
;---------------------------------------------------------------------------
!TOPIC 237 _SCROLLLOCK
!NOINDEX
!TTY

_SCROLLLOCK is "1" if the ScrollLock key is toggled ON, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 215 _SECOND
!NOINDEX
!TTY

_SECOND is the current second (0 - 59).
;---------------------------------------------------------------------------
!TOPIC 785 _SHARE
!NOINDEX
!TTY

_SHARE is "1" if SHARE is installed, "0" if not installed and OK to
install, and "-1" if not installed and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 216 _SHELL
!NOINDEX
!TTY

_SHELL is the current shell nesting level.  The primary shell is level
"0", and each subsequent secondary shell increments the level by 1.
;---------------------------------------------------------------------------
!TOPIC 238 _SHIFT
!NOINDEX
!TTY

_SHIFT is "1" if the either Shift key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 803 _SMARTDRV
!NOINDEX
!TTY

_SMARTDRV is "1" if SMARTDRV or a compatible disk cache is installed, and
"0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 737 _STARTPATH
!NOINDEX
!TTY

_STARTPATH is the startup directory for the current shell (not necessarily
the same as the location of the executable!).
;---------------------------------------------------------------------------
!TOPIC 366 _STDERR
!NOINDEX
!TTY

_STDERR is "1" if the standard error points to the console, and "0" if it
has been redirected.
;---------------------------------------------------------------------------
!TOPIC 367 _STDIN
!NOINDEX
!TTY

_STDIN is "1" if the standard input points to the console, and "0" if it
has been redirected.
;---------------------------------------------------------------------------
!TOPIC 368 _STDOUT
!NOINDEX
!TTY

_STDOUT is "1" if the standard output points to the console, and "0" if it
has been redirected.
;---------------------------------------------------------------------------
!TOPIC 740 _STZN
!NOINDEX
!TTY

_STZN is the name of standard time in the current time zone.  See 759TZ
for more information.
;---------------------------------------------------------------------------
!TOPIC 741 _STZO
!NOINDEX
!TTY

_STZO is the offset in minutes of UTC from standard time in the current
time zone.  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 217 _SWAPPING
!NOINDEX
!TTY

_SWAPPING returns the current swapping state.  The return value is
"OFF" if swapping has been disabled with the 668SWAPPING command,
"EMS" if expanded memory is being used, "XMS" if extended memory is being
used, or "Disk" if 4DOS is using disk swapping.  The return value is "None"
if swapping has been disabled with the 4DOS.INI 391Swapping directive
or if 4DOS failed to initiate memory or disk swapping during initialization.
;---------------------------------------------------------------------------
!TOPIC 218 _SYSERR
!NOINDEX
!TTY

_SYSERR is the error code of the last operating system error.

Some of the error codes are listed below.  You will need a technical
or programmer's manual to understand these error values in detail, and
to check the meaning of codes not listed.  The specific codes used and
the meaning of each may vary between operating systems or operating
system versions; the list below is based on DOS 6.xx and 7.xx.

!NOWRAP
Code Meaning                            Code Meaning
---- ---------------------------------- ---- ------------------------------
  1  Bad function                        40  Device not ready
  2  File not found                      41  File allocation table bad
  3  Invalid path
  4  Too many open files                 50  Invalid net request
  5  Access denied                       51  Remote computer not listening
  6  Invalid handle                      52  Duplicate name on net
  7  Memory destroyed                    53  Net name not found
  8  Out of memory                       54  Net busy
  9  Bad memory block                    55  Net device no longer exists
 10  Bad environment                     56  NetBIOS command limit exceeded
 11  Bad format                          57  Net adapter hardware error
 12  Invalid access code                 58  Bad response from net
 13  Invalid data                        59  Unexpected net error
 14  Internal DOS error / Fixup overflow 60  Incompatible remote adapter
 15  Invalid drive                       61  Print queue full
 16  Can't remove current directory      62  No room for print file
 17  Not same device                     63  Print file was cancelled
 18  No more files                       64  Net name was deleted
                                         65  Access denied
 19  Write protect error                 66  Net device type incorrect
 20  Invalid unit                        67  Network name not found
 21  Not ready                           68  Net name limit exceeded
 22  Invalid device request              69  NetBIOS session limit exceeded
 23  Data error                          70  Sharing temporarily paused
 24  Invalid device request parameters   71  Net request not accepted
 25  Seek error                          72  Print or disk redirection paused
 26  Invalid media type                  73  Invalid network version
 27  Sector not found                    74  Adapter close / Account expired
 28  Printer out of paper error          75  Password expired
 29  Write fault error                   76  Login currently not allowed
 30  Read fault error                    77  Disk limit exceeded on node
 31  General failure                     78  Not logged in to a net node
 32  Sharing violation
 33  Lock violation                      80  File exists
 34  Invalid disk change                 81  Duplicated FCB
 35  FCB unavailable                     82  Can't make directory entry
 36  Sharing buffer overflow             83  Fail on INT 24
 37  Code page mismatch
 38  Out of input before end
 39  Out of disk space

Some of the less common error codes are listed below.  Most of them
belong to redirector software (such as MSCDEX, NWCDEX, DRFAT32, etc.),
and networking software such as Novell NetWare, or LANtastic, but there are
also some codes related to JOIN/SUBST or DOS 7.xx volume locking problems.

Code Meaning
---- -----------------------------------------------------------------------
 84  Too many redirections
 85  Duplicate redirection
 86  Invalid password
 87  Invalid parameter
 88  Net device fault
 89  Net function not supported / No process slots
 90  Required component not installed
 91  Timer server table overflow
 92  Duplicate in timer service table
 93  No items to work on

 95  Interrupted / Invalid system call

100  Open net semaphore limit exceeded / CD-ROM unknown error
101  Exclusive net semaphore is already owned / CD-ROM not ready
102  Semaphore was set when close attempted / CD-ROM EMS memory bad
103  Too many exclusive semaphore requests / CD not High Sierra or ISO-9660
104  Operation invalid from interrupt handler / CD-ROM door open

105  Semaphore owner died
106  Semaphore limit exceeded
107  Insert drive B: disk into A: / Disk changed
108  Drive locked by another process
109  Broken pipe
110  Pipe open/create failed
111  Pipe buffer overflowed
112  Disk full
113  No more search handles
114  Invalid target handle for dup2
115  Bad user virtual address / Protection violation
116  VIOKBD request / Error on console I/O
117  Unknown category code for IOCTL
118  Invalid value for verify flag
119  Level four driver not found by DOS IOCTL
120  Invalid function number
121  Semaphore timeout
122  Buffer too small to hold return data
123  Invalid character or bad file-system name
124  Unimplemented information level
125  No volume label found
126  Module handle not found
127  Procedure address not found
128  CWait found no children
129  CWait children still running
130  Invalid operation for direct disk-access handle
131  Attempted seek to negative offset
132  Attempted to seek on device or pipe

133  Drive already has JOINed drives
134  Drive is already JOINed
135  Drive is already SUBSTed
136  Can not delete drive which is not JOINed
137  Can not delete drive which is not SUBSTed
138  Can not JOIN to a JOINed drive
139  Can not SUBST to a SUBSTed drive
140  Can not JOIN to a SUBSTed drive
141  Can not SUBST to a JOINed drive
142  Drive is busy
143  Can not JOIN/SUBST to same drive
144  Directory must not be root directory
145  Can only JOIN to empty directory
146  Path is already in use for SUBST
147  Path is already in use for JOIN
148  Path is in use by another process
149  Directory previously SUBSTituted

150  System trace error
151  Invalid event count for DosMuxSemWait
152  Too many waiting on mutex
153  Invalid list format
154  Volume label too large
155  Unable to create another TCB
156  Signal refused
157  Segment discarded
158  Segment not locked
159  Invalid thread-ID address

160  Bad arguments / Bad environment pointer
161  Invalid pathname passed to EXEC
162  Signal already pending
163  Uncertain media / ERROR_124 mapping
164  Maximum number of threads reached / No more process slots
165  ERROR_124 mapping

176  Volume is not locked
177  Volume is locked in drive
178  Volume is not removable

180  Lock count has been exceeded / Invalid segment number
181  A valid eject request failed / Invalid call gate
182  Invalid ordinal
183  Shared segment already exists
184  No child process to wait for
185  NoWait specified and child still running
186  Invalid flag number
187  Semaphore does not exist
188  Invalid starting code segment
189  Invalid stack segment
190  Invalid module type (DLL can not be used as application)
191  Invalid EXE signature
192  EXE marked invalid
193  Bad EXE format (e.g. DOS-mode program)
194  Iterated data exceeds 64K
195  Invalid minimum allocation size
196  Dynamic link from invalid Ring
197  IOPL not enabled
198  Invalid segment descriptor privilege level
199  Automatic data segment exceeds 64K
200  Ring2 segment must be moveable
201  Relocation chain exceeds segment limit
202  Infinite loop in relocation chain
203  Environment variable not found
204  Not current country
205  No signal sent
206  File name not 8.3
207  Ring2 stack in use
208  Meta expansion is too long
209  Invalid signal number
210  Inactive thread
211  File system information not available
212  Locked error
213  Attempted to execute non-family API call in DOS mode
214  Too many modules
215  Nesting not allowed

230  Non-existent pipe, or bad operation
231  Pipe is busy
232  No data available for nonblocking read
233  Pipe disconnected by server
234  More data available

255  Invalid drive
!WRAP
;---------------------------------------------------------------------------
!TOPIC 453 _SYSREQ
!NOINDEX
!TTY

_SYSREQ is "1" if the SysReq (SysRq) key is depressed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 804 _TASKMAX
!NOINDEX
!TTY

_TASKMAX is "1" if the DR DOS TASKMAX or TASKMGR is installed, and "0"
otherwise.
;---------------------------------------------------------------------------
!TOPIC 805 _TASKSWITCHER
!NOINDEX
!TTY

_TASKSWITCHER is "1" if the MS-DOS or PC DOS DOSSHELL Task Switcher is
installed, and "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 588 _TICK
!NOINDEX
!TTY

_TICK contains the current BIOS clock tick since midnight.  There are
approximately 18.2 ticks per second.  The possible values are from 0 to
1,573,039.
;---------------------------------------------------------------------------
!TOPIC 219 _TIME
!NOINDEX
!TTY

_TIME contains the current system time in the format hh:mm:ss.  The
separator character may vary depending upon your country information.
;---------------------------------------------------------------------------
!TOPIC 220 _TRANSIENT
!NOINDEX
!TTY

_TRANSIENT is "1" if the current shell is transient (started with
a /C, see 352Startup), or "0" otherwise.

See also 109Automatic Batch Files and 817OS/2 Temporary VDMs for
further uses of the _TRANSIENT internal variable.
;---------------------------------------------------------------------------
!TOPIC 480 _TSC
!NOINDEX
!TTY

_TSC is the current value of the Time Stamp Counter (TSC) in the CPU.  For
486 and older CPUs, a question mark (?) is returned.

Some 586 CPUs crash _TSC in V86 mode, if the RDTSC instruction is not
emulated by the memory manager like some EMM386 variants; then use one that
does.
;---------------------------------------------------------------------------
!TOPIC 742 _TZN
!NOINDEX
!TTY

_TZN is the name of the current time zone.  See 759TZ for more
information.
;---------------------------------------------------------------------------
!TOPIC 743 _TZO
!NOINDEX
!TTY

_TZO is the offset in minutes of UTC from the current time zone.  See
759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 744 _UNIXTIME
!NOINDEX
!TTY

_UNIXTIME is the number of seconds elapsed since 1 January 1970, 00:00 UTC
(the Epoch) as defined by ISO/IEC 9945 (a.k.a. POSIX or IEEE Std 1003.1).
See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 745 _UTCDATE
!NOINDEX
!TTY

_UTCDATE is the current UTC date in format mm-dd-yy (U.S.), dd-mm-yy
(Europe), or yy-mm-dd (Japan).  The separator character may vary depending
upon your country information.  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 746 _UTCDATETIME
!NOINDEX
!TTY

_UTCDATETIME is the current UTC date and time as 14-characters in the
format yyyyMMddhhmmss.  The date part is the same as 748_UTCISODATE
without separators.  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 747 _UTCHOUR
!NOINDEX
!TTY

_UTCHOUR is the current UTC hour.  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 748 _UTCISODATE
!NOINDEX
!TTY

_UTCISODATE is the current UTC date in ISO 8601 international format
(yyyy-mm-dd).  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 749 _UTCMINUTE
!NOINDEX
!TTY

_UTCMINUTE is the current UTC minute.  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 750 _UTCSECOND
!NOINDEX
!TTY

_UTCSECOND is the current UTC second.  See 759TZ for more information.
;---------------------------------------------------------------------------
!TOPIC 760 _UTCTIME
!NOINDEX
!TTY

_UTCTIME is the current UTC time in the format hh:mm:ss.  The separator
character may vary depending upon your country information.  See 759TZ
for more information.
;---------------------------------------------------------------------------
!TOPIC 505 _V86
!NOINDEX
!TTY

_V86 is "1" if the CPU is a 386 or later and is in V86 mode, or "0"
otherwise.
;---------------------------------------------------------------------------
!TOPIC 778 _VCPI
!NOINDEX
!TTY

_VCPI returns the VCPI version level (e.g. 1.00), or "0" if VCPI isn't
present.
;---------------------------------------------------------------------------
!TOPIC 824 _VDS
!NOINDEX
!TTY

_VDS returns the VDS version level (e.g. 1.00), or "0" if VDS isn't
present.
;---------------------------------------------------------------------------
!TOPIC 831 _VERMAJOR
!NOINDEX
!TTY

_VERMAJOR is the current 4DOS major version (for example, "8").
;---------------------------------------------------------------------------
!TOPIC 832 _VERMINOR
!NOINDEX
!TTY

_VERMINOR is the current 4DOS minor version (for example, "0").
;---------------------------------------------------------------------------
!TOPIC 833 _VERSION
!NOINDEX
!TTY

_VERSION is the current 4DOS version in major.minor format (for example,
"8.00").  Unlike _4VER, the dot character (.) and not the current decimal
character is used to separate the major and minor verison numbers.
;---------------------------------------------------------------------------
!TOPIC 221 _VIDEO
!NOINDEX
!TTY

_VIDEO is the video card type ("mono", "cga", "ega", "vga" or "svga").
;---------------------------------------------------------------------------
!TOPIC 222 _WIN
!NOINDEX
!TTY

_WIN is the current Microsoft Windows mode.  The possible values are:

     0       Windows is not running
     2       Windows 3.xx in 386 Enhanced mode
     3       Windows 3.xx in Real or Standard mode
    40       Windows 95
    41       Windows 98
    42       Windows ME


Note that 4DOS is not intended for use in the 025Windows NT line.  4DOS
does not check for these versions of Windows and does not report them in the
_WIN variable.  _WIN will return 0 under all versions of Windows NT.  If for
some reason you must check for the Windows NT line in 4DOS, test the
194_DOSVER variable for an emulated DOS version of 5.50.
;---------------------------------------------------------------------------
!TOPIC 735 _WINTICKS
!NOINDEX
!TTY

_WINTICKS contains the number of milliseconds since midnight (in DOS), or
since Windows was started (in Windows).  Note: _WINTICKS is 0 under OS/2.
;---------------------------------------------------------------------------
!TOPIC 223 _WINTITLE
!NOINDEX
!TTY

_WINTITLE returns the title of the current window.  This variable is only
valid when 4DOS is running in a DOS session under OS/2 or Windows 95/98/ME.
If you are using 4DOS under DOS, the return value is an empty string.

Under OS/2, _WINTITLE only returns the title when it has been changed from
the default (starting) value.  If the title has not been changed, _WINTITLE
will return an empty string.  This is a limitation of OS/2, not a bug in
4DOS.

Also see the 551ChangeTitle 4DOS.INI directive.
;---------------------------------------------------------------------------
!TOPIC 224 _YEAR
!NOINDEX
!TTY

_YEAR is the current year (1980 to 2099).
;---------------------------------------------------------------------------
!TOPIC 349 Variable Functions by Name
!NOINDEX

    333@ABS[n]                          Absolute value of a number
    401@AGEDATE[n[,format]]             Converts an age into date and time
    242@ALIAS[name]                     Value of an alias
    334@ALTNAME[filename]               FAT filename
    243@ASCII[c]                        Numeric ASCII value(s) for string
    244@ATTRIB[filename,[nrhsad]]       File attribute test (0 or 1)
    452@AVERAGE[a,b,...]                Average of a list of integers

    345@CAPS["sep",c]                   Capitalize first letter of words
    245@CDROM[d:]                       CD or DVD drive detection (0 or 1)
    725@CEILING[n]                      Smallest integer not less than n
    246@CHAR[n]                         Character(s) for numeric ASCII
    247@CLIP[n]                         Line from the clipboard
    335@CLIPW[n]                        Write line to clipboard
    809@CLUSTSIZE[d:]                 ! Cluster size
    810@CODEPAGE[name]                ! Selected code page for a device
    826@COM[n]                        ! Serial port ready status (0 or 1)
    248@COMMA[n]                        Inserts commas in a number
    728@COMPARE[filename1,filename2]    Compare two files
    249@CONVERT[in,out,value]           Base conversion
    507@COUNT[c,string]                 Occurrences of a character in a string
    346@CRC32[filename]                 CRC32 of a file
    359@CWD[d:]                         Current directory of specified drive
    360@CWDS[d:]                        Current directory with trailing \

    250@DATE[date]                      Convert date to number of days
    717@DATECONV[date[,format]]       ! Convert date from one format to another
    251@DAY[date]                       Day of the month
    786@DDCSTR[type]                  ! Display Data Channel (DDC) string
    252@DEC[expression]                 Decrements an expression
    336@DECIMAL[n]                      Decimal portion of a number
    253@DESCRIPT[filename]              File description
    254@DEVICE[name]                    Character device detection
    337@DIGITS[string]                  Test if a string is only digits
    734@DIRSTACK[n]                     Display directory stack entry
    255@DISKFREE[d:,b|k|m|g]            Free disk space
    256@DISKTOTAL[d:,b|k|m|g]           Total disk space
    257@DISKUSED[d:,b|k|m|g]            Used disk space
    258@DOSMEM[b|k|m]                 ! Free DOS memory
    259@DOW[date]                       Day of the week
    338@DOWF[date]                      Day of the week (full name)
    260@DOWI[date]                      Numeric day of the week (Sun = 1, etc.)
    261@DOY[date]                       Numeric day of the year
    727@DRIVETYPE[d:]                   Type of drive (hard drive, CD/DVD etc.)

    262@EMS[b|k|m]                    ! Free EMS memory
    339@ERRTEXT[n]                      DOS error text for specified code
    263@EVAL[expression]                Arithmetic calculations
    264@EXEC[command]                   Execute a command
    265@EXECSTR[command]                Execute, return string
    266@EXPAND[filename,[nrhsad]]       Wildcard expansion
    267@EXT[filename]                   File extension
    268@EXTENDED[b|k|m]               ! Free extended memory

    347@FIELD[["sep",]n,string]         Returns a field from a string
    449@FIELDS[["sep",]string]          Counts number of fields in a string
    269@FILEAGE[filename[,acw]]         File age (date and time)
    270@FILECLOSE[n]                    Close a file
    271@FILEDATE[filename[,[acw][,n]]]  File date
    272@FILENAME[filename]              File name and extension
    273@FILEOPEN[filename,mode]         Open a file
    274@FILEREAD[n[,length]]            Read line or bytes from a file
    478@FILEREADB[n,length]             Read bytes from a file
    275@FILES[filename[,-nrhsad]]       Count files matching a wildcard
    276@FILESEEK[n,offset,start]        Move file pointer to an offset
    277@FILESEEKL[n,line]               Move file pointer to a line number
    278@FILESIZE[filename,b|k|m|g]      Size of files matching a wildcard
    279@FILETIME[filename[,[acw][,s]]]  File time
    280@FILEWRITE[n,text]               Write next line to a file
    281@FILEWRITEB[n,length,string]     Write bytes to a file
    282@FINDCLOSE[filename]             Close search handle
    283@FINDFIRST[filename[,-nrhsad]]   Find first matching file
    284@FINDNEXT[filename[,-nrhsad]]    Find next matching file
    726@FLOOR[n]                        Largest integer not larger than n
    285@FORMAT[[-][x][.y],string]       Formats (justifies) a string
    777@FSTYPE[d:]                      File system type (FAT, FAT32, etc.)
    286@FULL[filename]                  Full file name with path
    348@FUNCTION[name]                  Value of a user-defined function

    808@HDDSIZE[d:,b|k|m|g]           ! Physical hard disk drive size
    718@HISTORY[x[,y]]                  A line or word from the command history

    287@IF[condition,true,false]        Evaluates a test condition
    288@INC[expression]                 Increments an expression
    289@INDEX[string1,string2[,n]]      Position of one string in another
    340@INIREAD[file,sect,key]          Read from .INI file
    341@INIWRITE[file,sect,key,val]     Write to .INI file
    290@INSERT[n,string1,string2]       Insert one string into another
    291@INSTR[start,length,string]      Extract a substring
    292@INT[n]                          Integer part of a number
    508@ISALNUM[string]                 Test for alphanumeric characters
    509@ISALPHA[string]                 Test for alphabetic characters
    510@ISASCII[string]                 Test for ASCII characters
    528@ISCNTRL[string]                 Test for control characters
    529@ISDIGIT[string]                 Test for decimal digits
    828@ISLOWER[string]                 Test for lower-case letters
    458@ISODOWI[date]                 ! Numeric day of the week (Mon = 1, etc.)
    459@ISOWEEK[date]                 ! Week of the year pursuant to ISO 8601
    721@ISOWYEAR[date]                ! ISO 8601 week date year
    530@ISPRINT[string]                 Test for printable characters
    558@ISPUNCT[string]                 Test for punctuation characters
    559@ISSPACE[string]                 Test for white space characters
    829@ISUPPER[string]                 Test for upper-case letters
    560@ISXDIGIT[string]                Test for hexadecimal digits

    293@LABEL[d:]                       Volume label
    730@LCS[str1,str2]                  Longest Common Subsequence in strings
    294@LEFT[n,string]                  Leftmost characters of a string
    295@LEN[string]                     Length of a string
    296@LFN[filename]                   Long path and filename
    297@LINE[filename,n]                Read the specified line from a file
    298@LINES[filename]                 Count lines in a file
    299@LOWER[string]                   Convert string to lower case
    300@LPT[n]                        ! Printer port ready status (0 or 1)
    406@LTRIM[chars,string]             Trims specified leading characters

    301@MAKEAGE[date[,time]]            Convert date/time to file date/time
    302@MAKEDATE[n[,format]]            Convert number of days to date
    303@MAKETIME[n]                     Convert number of seconds to time
    304@MASTER[varname]                 Value from master environment
    342@MAX[a,b,...]                    Largest integer in list
    402@MD5[filename]                   MD5 hash of a file
    343@MIN[a,b,...]                    Smallest integer in list
    305@MONTH[date]                     Month of the year
    369@MONTHF[date]                  ! Month of the year (full name)

    306@NAME[filename]                  File name without path or extension
    307@NUMERIC[string]                 Test if a string is numeric

    308@PATH[filename]                  File path without name

    503@QUOTE[filename]                 Double quote a filename

    309@RANDOM[min,max]                 Generate a random integer
    310@READSCR[row,col,len]            Character from the screen
    311@READY[d:]                       Drive ready status (0 or 1)
    312@REMOTE[d:]                      Remote drive detection (0 or 1)
    313@REMOVABLE[d:]                   Removable drive detection (0 or 1)
    314@REPEAT[c,n]                     Repeat a character
    315@REPLACE[str1,str2,str3]         Replace within a string
    729@REVERSE[string]                 Reverse a string
    316@RIGHT[n,string]                 Rightmost characters of a string
    407@RTRIM[chars,string]             Trims specified trailing characters

    317@SEARCH[filename]                Path search
    318@SELECT[file,t,l,b,r,title]      Menu selection
    358@SERIAL[d:]                      Volume serial number
    319@SFN[filename]                   Short path and filename
    403@SHA1[filename]                  SHA1 hash of a file
    733@SIMILAR[str1,str2]              Similarity (0 - 100%) between 2 strings
    409@SMBSTR[type,n]                ! SMBIOS string n of a given type
    320@STRIP[chars,string]             Strip characters from a string
    722@SUBST[n,str1,str2]              Substitute a string in another string
    321@SUBSTR[string,start,length]     Extract a substring

    322@TIME[time]                      Convert time to number of seconds
    323@TIMER[n]                        Elapsed time of specified timer
    324@TRIM[string]                    Remove blanks from a string
    325@TRUENAME[filename]              True name of a file
    408@TRUNCATE[n]                     Truncate file at current position

    326@UNIQUE[d:\path]                 Create file with unique name
    504@UNQUOTE[filename]               Remove double quotes from a filename
    723@UNQUOTES[string]                Remove leading & trailing double quotes
    327@UPPER[string]                   Convert string to upper case

    328@WILD[str1,str2]                 Wildcard comparison
    329@WORD[["sep",]n,string]          Extract a word from a string
    330@WORDS[["sep",]string]           Counts number of words in a string

    331@XMS[b|k|m]                    ! Free XMS memory

    332@YEAR[date]                      Year number
;---------------------------------------------------------------------------
!TOPIC 350 Examples of Variable Functions
!NOINDEX

You can use variable functions in a wide variety of ways depending on your
needs.  We've included a few examples below to give you an idea of what's
possible.  For a more comprehensive set of examples see the EXAMPLES.BTM
file which came with 4DOS.  For information on how to set up user-defined
variable functions, see the 696FUNCTION and 699UNFUNCTION commands.

To set the prompt to show the amount of free memory (see 652PROMPT
for details on including variable functions in your prompt):

     c:\> prompt (%%@dosmem[K]K) $p$g

Set up a simple command-line calculator.  The calculator is used with a
command like CALC 3 * (4 + 5):

     c:\> alias calc `echo The answer is:  %@eval[%&]`

The following batch file uses variable functions to implement "once a day"
execution of a group of commands.  It works by constructing a 6-digit
number "yymmdd" from today's date, and comparing that to a number of the
same type stored in the file C:\ONCEADAY.DAT.  If today's date is
numerically larger than the saved date, and the time is after 6:00 AM, then
the "once a day" commands are run, and today's date is saved in the file as
the new date for comparison.  Otherwise, no action is taken.  You can make
this file simpler using the %250@DATE and %322@TIME functions instead
of using %291@INSTR to extract substrings of the %189_DATE and
%219_TIME variables; we used the approach shown to demonstrate the use
of %@INSTR.

     rem  Temporary variables used to shorten example lines:
     rem    DD is _date, DY is yymmdd date, TM is _time
     set dd=%_date
     set dy=%@instr[6,2,%dd]%@instr[0,2,%dd]%@instr[3,2,%dd]
     set lastdate=0
     iff exist c:\onceaday.dat then
       set lastdate=%@line[onceaday.dat,0]
     endiff
     iff %dy gt %lastdate then
       set tm=%_time
       iff "%@instr[0,2,%tm]%@instr[3,2,%tm]" gt "0600" then
         rem  Commands to be executed once a day go here
         echo %dy > c:\onceaday.dat
       endiff
     endiff
;---------------------------------------------------------------------------
!TOPIC 239 Internal Variables by Name
!NOINDEX

        166+             * Substitutes command separator
        165=             * Substitutes escape character
        162?             * Exit code, last external program
        163??           !* Reason for external program termination

        167_4VER           4DOS version (7.50, 7.51, etc.)
        164_?            * Exit code, last internal command

        168_ALIAS        ! Free alias space in bytes
        231_ALT            Alt key depressed (0 or 1)
        169_ANSI         * ANSI driver flag (0 or 1)
        170_APMAC       !* APM AC line status (on, off, or unknown)
        171_APMBATT     !* APM battery status
        172_APMLIFE     !* APM battery life (0 - 100% or unknown)
        787_APPEND       ! APPEND loaded flag (0 or 1)
        788_ASSIGN       ! ASSIGN loaded flag (0, 1 or -1)

        173_BATCH          Batch nesting level
        174_BATCHLINE      Current line number in current batch file
        175_BATCHNAME      Name of current batch file
        500_BATCHTYPE      Type of current batch file
        501_BDEBUGGER      Batch debugger active (0 or 1)
        176_BG             Background color at cursor position
        177_BOOT           Boot drive letter, without a colon
        227_BUILD          4DOS build number

        232_CAPSLOCK       CapsLock on (0 or 1)
        589_CDROMS         List of CD and DVD drives
        178_CI             Current cursor shape in insert mode
        228_CMDLINE        Contents of the command line
        225_CMDPROC        Command processor name
        502_CMDSPEC        Full pathname of command processor
        179_CO             Current cursor shape in overstrike mode
        180_CODEPAGE       Current code page number
        181_COLUMN         Current cursor column
        182_COLUMNS        Screen width
        183_COUNTRY        Current country code
        184_CPU          * CPU brand and model
        479_CPUSPEED     ! CPU speed in MHz (586 or newer)
        233_CTRL           Ctrl key depressed (0 or 1)
        185_CWD            Current drive and directory (d:\path)
        186_CWDS           Current drive and directory with \ (d:\path\)
        187_CWP            Current directory (\path)
        188_CWPS           Current directory with \ (\path\)

        189_DATE         * Current date (mm-dd-yy)
        370_DATETIME     * Current date and time (yyyyMMddhhmmss)
        190_DAY            Day of the month (1 - 31)
        807_DISPLAY      ! DISPLAY.SYS loaded flag (0 or 1)
        191_DISK           Current drive (C, D, etc.)
        192_DNAME          Name of file used to store file descriptions
        193_DOS          * Operating system (DOS, OS/2, etc.)
        194_DOSVER       * Operating system version (5.00, 6.00, 7.00, etc.)
        195_DOW            Day of the week (Mon, Tue, Wed, etc.)
        226_DOWF           Day of the week (Monday, Tuesday, etc.)
        196_DOWI           Numeric day of the week (Sun = 1, etc.)
        197_DOY            Day of the year (1 - 366)
        198_DPMI         ! DPMI version number
        789_DRIVER       ! DRIVER.SYS present flag (0, 1 or -1)
        590_DRIVES         List of all available drives
        738_DST            Daylight saving time (0 or 1)
        199_DV           ! DESQview loaded flag (0 or 1)

        229_ECHO           Echo state (0 or 1)
        404_EDITMODE       Current line editing mode (0 or 1)
        790_EGA          ! EGA.SYS loaded flag (0, 1 or -1)
        200_ENV          ! Free environment space in bytes
        365_EXECSTR        Last @EXECSTR return code
        405_EXPANSION      Current expansion mode (SETDOS /X)

        201_FG             Foreground color at cursor position
        780_FONTPAGE     ! Current font page number (Arabic/Hebrew only)

        800_GRAFTABL     ! GRAFTABL loaded flag (0, 1 or -1)
        806_GRAPHICS     ! GRAPHICS loaded flag (0 or 1)

        724_HDRIVES        List of all hard (fixed) drives
        202_HLOGFILE       Current history log file name
        203_HOUR           Hour (0 - 23)

        506_ININAME        Full pathname of the current INI file
        230_ISODATE        Current date (yyyy-mm-dd)
        454_ISODOWI      ! Numeric day of the week (Mon = 1, etc.)
        736_ISORDATE     ! Current ISO 8601 ordinal date (yyyy-ddd)
        460_ISOWDATE     ! Current ISO 8601 week date (yyyy-Www-d)
        455_ISOWEEK      ! Week of the year pursuant to ISO 8601
        591_ISOWYEAR       Current ISO 8601 week date year

        204_KBHIT          Keystroke waiting in buffer (0 or 1)
        779_KEYSTACKED   ! Number of keystrokes in the KSTACK.COM buffer
        205_KSTACK       ! KSTACK.COM load status (0 or 1)

        361_LALT           Left Alt key depressed (0 or 1)
        830_LASTDIR        Previous directory (from directory history)
        206_LASTDISK       Last possible drive (E, F, etc.)
        362_LCTRL          Left Ctrl key depressed (0 or 1)
        207_LOGFILE        Current log file name
        234_LSHIFT         Left Shift key depressed (0 or 1)

        782_MACHINE      ! Machine name in network
        208_MINUTE         Minute (0 - 59)
        739_MJD          ! Modified Julian Day
        209_MONITOR      ! Monitor type (mono or color)
        210_MONTH          Month of the year (1 - 12)
        240_MONTHF         Month of the year (January, February, etc.)
        211_MOUSE        ! Mouse driver loaded flag (0 or 1)
        801_MSCDEX       ! MSCDEX/SHSUCDX loaded flag (0, 1 or -1)

        212_NDP          ! Coprocessor brand and model
        783_NETWORK     !* Installed network components flag byte
        784_NLSFUNC      ! NLSFUNC loaded flag (0, 1 or -1)
        235_NUMLOCK        NumLock on (0 or 1)

        820_POWER        ! POWER.EXE loaded flag (0 or 1)
        802_PRINT        ! PRINT loaded flag (0, 1 or -1)

        363_RALT           Right Alt key depressed (0 or 1)
        364_RCTRL          Right Ctrl key depressed (0 or 1)
        716_READY          List of ready (accessible) drives
        213_ROW            Current cursor row
        214_ROWS           Screen height
        236_RSHIFT         Right Shift key depressed (0 or 1)

        825_SBDSP       !* Sound Blaster DSP version number
        237_SCROLLLOCK     ScrollLock on (0 or 1)
        215_SECOND         Second (0 - 59)
        785_SHARE        ! SHARE loaded flag (0, 1 or -1)
        216_SHELL          Shell level (0, 1, 2, ...)
        238_SHIFT          Shift key depressed (0 or 1)
        803_SMARTDRV     ! SMARTDRV loaded flag (0 or 1)
        737_STARTPATH      Startup directory of current shell
        366_STDERR         Standard error not redirected flag (0 or 1)
        367_STDIN          Standard input not redirected flag (0 or 1)
        368_STDOUT         Standard output not redirected flag (0 or 1)
        740_STZN           Name of time zone for standard time
        741_STZO           Offset in minutes from UTC for standard time
        217_SWAPPING    !* Swapping state (XMS, EMS, Disk, None, or off)
        218_SYSERR       * Last DOS error
        453_SYSREQ       ! SysReq key depressed (0 or 1)

        804_TASKMAX      ! TASKMAX/TASKMGR loaded flag (0 or 1)
        805_TASKSWITCHER ! DOSSHELL Task Switcher loaded flag (0 or 1)
        588_TICK         ! BIOS clock tick since midnight
        219_TIME         * Current time (hh:mm:ss)
        220_TRANSIENT    * Transient shell flag (0 or 1)
        480_TSC         !* Time Stamp Counter (586 or newer)
        742_TZN            Name of current time zone
        743_TZO            Offset in minutes from UTC for current time zone

        744_UNIXTIME     ! Curent Unix time
        745_UTCDATE        Current UTC date
        746_UTCDATETIME    Current UTC date and time
        747_UTCHOUR        Current UTC hour
        748_UTCISODATE     Current UTC date in ISO format
        749_UTCMINUTE      Current UTC minute
        750_UTCSECOND      Current UTC second
        760_UTCTIME        Current UTC time

        505_V86          ! CPU is in V86 mode (386 or newer, 0 or 1)
        778_VCPI         ! VCPI version number
        824_VDS          ! VDS version number
        831_VERMAJOR       4DOS major version
        832_VERMINOR       4DOS minor version
        833_VERSION        4DOS version in major.minor format
        221_VIDEO        ! Video board type (mono, cga, ega, vga or svga)

        222_WIN         !* Microsoft Windows mode
        735_WINTICKS       Milliseconds since midnight or since Windows started
        223_WINTITLE     * OS/2 or Windows 95/98/ME DOS session window title

        224_YEAR           Year (1980 - 2099)
;---------------------------------------------------------------------------
!TOPIC 241 Variable Functions
!NOINDEX

Variable functions are like 161internal variables, but they take one or
more arguments (which can be environment variables or even other variable
functions) and they return a value.

There are two general types of variable functions, pre-defined variable
functions and user-defined ones.

The list below gives a one-line description of each pre-defined function,
and a cross-reference which selects a full screen help topic on that
function.  A few of the variables are simple enough that the one-line
description is sufficient, but in most cases you should check for any
additional information in the cross-reference topic if you are not
already familiar with a function.  You can also obtain help on any
function with a HELP @functionname command at the prompt.

See the discussion after the function list for some additional
information, and examples of how these functions can be used.  For
a more comprehensive set of examples see the EXAMPLES.BTM file which
came with 4DOS.

For information on how to set up user-defined variable functions, refer
to the description of the 696FUNCTION and 699UNFUNCTION commands.

Note: The functions marked with an exclamation mark [!] are 4DOS-specific;
they are not present in 0204NT.  Take this into account when writing
portable batch files.

The pre-defined variable functions are grouped by category (or
see 349Variable Functions by Name):

System status

    786@DDCSTR[type]                  ! Display Data Channel (DDC) string
    258@DOSMEM[b|k|m]                 ! Free DOS memory
    262@EMS[b|k|m]                    ! Free EMS memory
    268@EXTENDED[b|k|m]               ! Free extended memory
    304@MASTER[varname]                 Value from master environment
    310@READSCR[row,col,len]            Character from the screen
    409@SMBSTR[type,n]                ! SMBIOS string n of a given type
    331@XMS[b|k|m]                    ! Free XMS memory

Drives and devices

    245@CDROM[d:]                       CD or DVD drive detection (0 or 1)
    809@CLUSTSIZE[d:]                 ! Cluster size
    810@CODEPAGE[name]                ! Selected code page for a device
    826@COM[n]                        ! Serial port ready status (0 or 1)
    359@CWD[d:]                         Current directory of specified drive
    360@CWDS[d:]                        Current directory with trailing \
    254@DEVICE[name]                    Character device detection
    255@DISKFREE[d:,b|k|m|g]            Free disk space
    256@DISKTOTAL[d:,b|k|m|g]           Total disk space
    257@DISKUSED[d:,b|k|m|g]            Used disk space
    727@DRIVETYPE[d:]                   Type of drive (hard drive, CD/DVD etc.)
    777@FSTYPE[d:]                      File system type (FAT, FAT32, etc.)
    808@HDDSIZE[d:,b|k|m|g]           ! Physical hard disk drive size
    293@LABEL[d:]                       Volume label
    300@LPT[n]                        ! Printer port ready status (0 or 1)
    311@READY[d:]                       Drive ready status (0 or 1)
    312@REMOTE[d:]                      Remote drive detection (0 or 1)
    313@REMOVABLE[d:]                   Removable drive detection (0 or 1)
    358@SERIAL[d:]                      Volume serial number

Files

    244@ATTRIB[filename,[nrhsad]]       File attribute test (0 or 1)
    728@COMPARE[filename1,filename2]    Compare two files
    346@CRC32[filename]                 CRC32 of a file
    253@DESCRIPT[filename]              File description
    269@FILEAGE[filename[,acw]]         File age (date and time)
    270@FILECLOSE[n]                    Close a file
    271@FILEDATE[filename[,[acw][,n]]]  File date
    273@FILEOPEN[filename,mode]         Open a file
    274@FILEREAD[n[,length]]            Read line or bytes from a file
    478@FILEREADB[n,length]             Read bytes from a file
    275@FILES[filename[,-nrhsad]]       Count files matching a wildcard
    276@FILESEEK[n,offset,start]        Move file pointer to an offset
    277@FILESEEKL[n,line]               Move file pointer to a line number
    278@FILESIZE[filename,b|k|m|g]      Size of files matching a wildcard
    279@FILETIME[filename[,[acw][,s]]]  File time
    280@FILEWRITE[n,text]               Write next line to a file
    281@FILEWRITEB[n,length,string]     Write bytes to a file
    282@FINDCLOSE[filename]             Close search handle
    283@FINDFIRST[filename[,-nrhsad]]   Find first matching file
    284@FINDNEXT[filename[,-nrhsad]]    Find next matching file
    297@LINE[filename,n]                Read the specified line from a file
    298@LINES[filename]                 Count lines in a file
    402@MD5[filename]                   MD5 hash of a file
    317@SEARCH[filename]                Path search
    403@SHA1[filename]                  SHA1 hash of a file
    325@TRUENAME[filename]              True name of a file
    408@TRUNCATE[n]                     Truncate file at current position
    326@UNIQUE[d:\path]                 Create file with unique name

File names

    334@ALTNAME[filename]               FAT filename
    266@EXPAND[filename,[nrhsad]]       Wildcard expansion
    267@EXT[filename]                   File extension
    272@FILENAME[filename]              File name and extension
    286@FULL[filename]                  Full file name with path
    296@LFN[filename]                   Long path and filename
    306@NAME[filename]                  File name without path or extension
    308@PATH[filename]                  File path without name
    503@QUOTE[filename]                 Double quote a filename
    319@SFN[filename]                   Short path and filename
    504@UNQUOTE[filename]               Remove double quotes from a filename
    723@UNQUOTES[string]                Remove leading & trailing double quotes

Strings and characters

    243@ASCII[c]                        Numeric ASCII value(s) for string
    345@CAPS["sep",c]                   Capitalize first letter of words
    246@CHAR[n]                         Character(s) for numeric ASCII
    507@COUNT[c,string]                 Occurrences of a character in a string
    347@FIELD[["sep",]n,string]         Returns a field from a string
    449@FIELDS[["sep",]string]          Counts number of fields in a string
    285@FORMAT[[-][x][.y],string]       Formats (justifies) a string
    289@INDEX[string1,string2[,n]]      Position of one string in another
    290@INSERT[n,string1,string2]       Insert one string into another
    291@INSTR[start,length,string]      Extract a substring
    508@ISALNUM[string]                 Test for alphanumeric characters
    509@ISALPHA[string]                 Test for alphabetic characters
    510@ISASCII[string]                 Test for ASCII characters
    528@ISCNTRL[string]                 Test for control characters
    529@ISDIGIT[string]                 Test for decimal digits
    828@ISLOWER[string]                 Test for lower-case letters
    530@ISPRINT[string]                 Test for printable characters
    558@ISPUNCT[string]                 Test for punctuation characters
    559@ISSPACE[string]                 Test for white space characters
    829@ISUPPER[string]                 Test for upper-case letters
    560@ISXDIGIT[string]                Test for hexadecimal digits
    730@LCS[str1,str2]                  Longest Common Subsequence in strings
    294@LEFT[n,string]                  Leftmost characters of a string
    295@LEN[string]                     Length of a string
    299@LOWER[string]                   Convert string to lower case
    406@LTRIM[chars,string]             Trims specified leading characters
    314@REPEAT[c,n]                     Repeat a character
    315@REPLACE[str1,str2,str3]         Replace within a string
    729@REVERSE[string]                 Reverse a string
    316@RIGHT[n,string]                 Rightmost characters of a string
    407@RTRIM[chars,string]             Trims specified trailing characters
    733@SIMILAR[str1,str2]              Similarity (0 - 100%) between 2 strings
    320@STRIP[chars,string]             Strip characters from a string
    722@SUBST[n,str1,str2]              Substitute a string in another string
    321@SUBSTR[string,start,length]     Extract a substring
    324@TRIM[string]                    Remove blanks from a string
    327@UPPER[string]                   Convert string to upper case
    328@WILD[str1,str2]                 Wildcard comparison
    329@WORD[["sep",]n,string]          Extract a word from a string
    330@WORDS[["sep",]string]           Counts number of words in a string

Numbers and arithmetic

    333@ABS[n]                          Absolute value of a number
    452@AVERAGE[a,b,...]                Average of a list of integers
    725@CEILING[n]                      Smallest integer not less than n
    248@COMMA[n]                        Inserts commas in a number
    249@CONVERT[in,out,value]           Base conversion
    252@DEC[expression]                 Decrements an expression
    336@DECIMAL[n]                      Decimal portion of a number
    337@DIGITS[string]                  Test if a string is only digits
    263@EVAL[expression]                Arithmetic calculations
    726@FLOOR[n]                        Largest integer not larger than n
    288@INC[expression]                 Increments an expression
    292@INT[n]                          Integer part of a number
    342@MAX[a,b,...]                    Largest integer in list
    343@MIN[a,b,...]                    Smallest integer in list
    307@NUMERIC[string]                 Test if a string is numeric
    309@RANDOM[min,max]                 Generate a random integer

Dates and times

    401@AGEDATE[n[,format]]             Converts an age into date and time
    250@DATE[date]                      Convert date to number of days
    717@DATECONV[date[,format]]         Convert date from one format to another
    251@DAY[date]                       Day of the month
    259@DOW[date]                       Day of the week
    338@DOWF[date]                      Day of the week (full name)
    260@DOWI[date]                      Numeric day of the week (Sun = 1, etc.)
    261@DOY[date]                       Numeric day of the year
    458@ISODOWI[date]                 ! Numeric day of the week (Mon = 1, etc.)
    459@ISOWEEK[date]                 ! Week of the year pursuant to ISO 8601
    721@ISOWYEAR[date]                ! ISO 8601 week date year
    301@MAKEAGE[date[,time]]            Convert date/time to file date/time
    302@MAKEDATE[n[,format]]            Convert number of days to date
    303@MAKETIME[n]                     Convert number of seconds to time
    305@MONTH[date]                     Month of the year
    369@MONTHF[date]                  ! Month of the year (full name)
    322@TIME[time]                      Convert time to number of seconds
    332@YEAR[date]                      Year number

Utility

    242@ALIAS[name]                     Value of an alias
    247@CLIP[n]                         Line from the clipboard
    335@CLIPW[n]                        Write line to clipboard
    734@DIRSTACK[n]                     Display directory stack entry
    339@ERRTEXT[n]                      DOS error text for specified code
    264@EXEC[command]                   Execute a command
    265@EXECSTR[command]                Execute, return string
    348@FUNCTION[name]                  Value of a user-defined function
    718@HISTORY[x[,y]]                  A line or word from the command history
    287@IF[condition,true,false]        Evaluates a test condition
    340@INIREAD[file,sect,key]          Read from .INI file
    341@INIWRITE[file,sect,key,val]     Write to .INI file
    318@SELECT[file,t,l,b,r,title]      Menu selection
    323@TIMER[n]                        Elapsed time of specified timer


Additional Notes

Like all environment variables, these variable functions must be preceded
by a percent sign in normal use (%@EVAL, %@LEN, etc.).  All variable
functions must have square brackets enclosing their argument(s).  The
argument(s) to a variable function cannot exceed 255 characters in length
for all arguments taken as a group.


Specific Functions and Arguments

Some variable functions, like 255@DISKFREE, are shown with "b|k|m|g" as
one of their arguments.  Those functions return a number of bytes, kilobytes,
megabytes or gigabytes based on the "b|k|m|g" argument:

     b   return the number of bytes
     K   return the number of kilobytes (bytes / 1,024)
     k   return the number of thousands of bytes (bytes / 1,000)
     M   return the number of megabytes (bytes / 1,048,576)
     m   return the number of millions of bytes (bytes / 1,000,000)
     G   return the number of gigabytes (bytes / 1,073,741,824)
     g   return the number of billions of bytes (bytes / 1,000,000,000)

You can include commas (or the "thousands separator" character for your
system) in the results from a "b|k|m|g" function by appending a "c" to
the argument.  For example, to add commas to a "b" or number of bytes
result, enter "bc" as the argument.  To set the thousands separator, see
the 445ThousandsChar directive.

Several functions return filenames or parts of filenames.  It is possible,
and on LFN drives very likely, that the strings returned by these functions
may contain whitespace or other special characters.  To avoid problems which
could be caused by these characters, quote the returned name before you pass
it to other commands, for example (either of these methods would work):

     set fname="%@findfirst[pro*.*]"
     echo First PRO file contains:
     type %fname
     .....

     set fname=%@findfirst[pro*.*]
     echo First PRO file contains:
     type "%fname"
     .....

If you don't use the quotes in the 663SET or 677TYPE command in this
example, TYPE will not interpret any whitespace or special characters in
the name properly.

In variable functions which take a drive letter as an argument, like
255@DISKFREE or 311@READY, the drive letter must be followed by a
colon.  The function will not work properly if you use the drive letter
without the colon.

The 274@FILEREAD, 478@FILEREADB, 280@FILEWRITE, 281@FILEWRITEB,
276@FILESEEK, 277@FILESEEKL, 408@TRUNCATE and 270@FILECLOSE
functions allow you to access files based on their file handle.  These
functions should only be used with file handles returned by 273@FILEOPEN!
If you use them with any other file handle you may damage other files opened
by 4DOS (or, in a secondary shell, the program which started 4DOS), or hang
your system.

Many functions return values based on information provided by your operating
system.  Such functions will only return correct information if the operating
system provides it.  For example, 311@READY will not return accurate
results if your operating system does not provide correct disk drive status
information to 4DOS.

See also some 350examples of functions used at the prompt, in aliases
and batch files.
;---------------------------------------------------------------------------
!TOPIC 344 Date Formats
!NOINDEX
Variable function date arguments use the date format and separators
mandated by your country code (for example dd.mm.yy in Germany, or
yy-mm-dd in Japan).  The year can be entered as a 4-digit or 2-digit
value.  Two-digit years between 80 and 99 are interpreted as 1980 -
1999; values between 00 and 79 are interpreted as 2000 - 2079.
If the date begins with a four digit year greater than 1900, it is
assumed to be in the ISO 8601 international format yyyy-mm-dd.  If the
date contains the letter "W", it is assumed to be in the ISO 8601 week date
format yyyy-Www-d, where yyyy = year, ww = week, d = week day.  If the
date is entered as two numbers in the format yyyy-ddd, it is assumed to be
in the ISO 8601 ordinal date format, where yyyy = year, ddd = day of the
year.
;---------------------------------------------------------------------------
!TOPIC 242 @ALIAS
!NOINDEX
!TTY

@ALIAS[name]:  Returns the contents of the specified alias as a string,
or a null string if the alias doesn't exist.  When manipulating strings
returned by @ALIAS you may need to disable certain special characters with
the 664SETDOS /X command.  Otherwise, command separators, redirection
characters, and other similar "punctuation" in the alias may be interpreted
as part of the current command, rather than part of a simple text string.
;---------------------------------------------------------------------------
!TOPIC 333 @ABS
!NOINDEX
!TTY

@ABS[n]:  Returns the absolute value of the number.
;---------------------------------------------------------------------------
!TOPIC 401 @AGEDATE
!NOINDEX
!TTY

@AGEDATE[n[,format]]:  Converts n (an age) into a date and time pair
(formatted according to the current country settings).  Time is separated
from date by a comma, and is always in 24-hour format.  n is the file date
and time (age), as returned by 269@FILEAGE and 301@MAKEAGE.  @AGEDATE
takes an optional second argument for the date format:

    0 - system default format
    1 - U.S. format (mm-dd-yy)
    2 - European format (dd-mm-yy)
    3 - Japanese format (yy-mm-dd)
    4 - ISO 8601 international format (yyyy-mm-dd)
    5 - ISO 8601 international format (yyyy-Www-d) week date
    6 - ISO 8601 international format (yyyy-ddd) ordinal date

The separator used in the return string depends on the current country
settings of the system, except for in the ISO 8601 international format,
where it will always by a hyphen ('-') as per spec.
;---------------------------------------------------------------------------
!TOPIC 334 @ALTNAME
!NOINDEX
!TTY

@ALTNAME[filename]:  Returns the alternate (short, "8.3" FAT-format) name
for the specified file.  If the filename is already in 8.3 format, or if it
does not exist, returns the filename as entered. @ALTNAME will also return
the shortened pathname if you provide a path in place of the filename.  The
filename must be in quotes if it contains whitespace or special characters.
;---------------------------------------------------------------------------
!TOPIC 243 @ASCII
!NOINDEX
!TTY

@ASCII[c]:  Returns the numeric value of the specified ASCII character or
string as a string.  For example %@ASCII[A] returns 65.  You can put an
escape character [] before the actual character to process.  This
allows quotes and other special characters as the argument (e.g.,
%@ASCII[`]).  If the argument is a string, @ASCII returns a space
delimited string with the ASCII values of each character.
;---------------------------------------------------------------------------
!TOPIC 244 @ATTRIB
!NOINDEX
!TTY

@ATTRIB[filename[,-nrhsad[,p]]]:  Returns a "1" if the specified file has
the matching attribute(s); otherwise returns a "0".  The attributes are:

    N   Normal (no attributes set)      S    System
    R   Read-only                       A    Archive
    H   Hidden                          D    subDirectory

The attributes (other than N) can be combined (for example
%@ATTRIB[MYFILE,HS]).  You can prefix an attribute with - to mean
"everything except files with this attribute."

Without the optional p as a third argument, ATTRIB will only return a 1
if all of the attributes match.  With the p, ATTRIB will return a 1 if
there is a partial match.  For example, if MYFILE.DAT has R, H, and A
attributes set:

    %@attrib[myfile.dat,r]    returns 0 because there is not an exact match

    %@attrib[myfile.dat,r,p]  returns 1 because there is a partial match

If you do not specify any attributes, @ATTRIB will return the attributes of
the specified file in the format RHSAD, rather than a "0" or
"1".  Attributes which are not set will be replaced with an underscore.  For
example, if SECURE.DAT has the read-only, hidden, and archive attributes
set, %@ATTRIB[SECURE.DAT] would return "RH_A_" (without the quotes).
;---------------------------------------------------------------------------
!TOPIC 452 @AVERAGE
!NOINDEX
!TTY

@AVERAGE[a,b,c,...]:  Returns the average of a list of integer numbers.
;---------------------------------------------------------------------------
!TOPIC 345 @CAPS
!NOINDEX
!TTY

@CAPS["sep",string]:  Capitalizes the first letter of each word in the
string.  Word delimiters are defined by the first argument, which must
be enclosed in double quotes.
;---------------------------------------------------------------------------
!TOPIC 245 @CDROM
!NOINDEX
!TTY

@CDROM[d:]:  Returns "1" if the drive is a CD or DVD drive, or "0"
otherwise.
;---------------------------------------------------------------------------
!TOPIC 725 @CEILING
!NOINDEX
!TTY

@CEILING[n]:  Returns the value of the smallest integer that is not less
than n.
;---------------------------------------------------------------------------
!TOPIC 246 @CHAR
!NOINDEX
!TTY

@CHAR[n]:  Returns the character(s) corresponding to an ASCII numeric
value.  For example %@CHAR[65] returns A.  %@CHAR[65 66 67] returns ABC.

The ASCII code of each byte may be entered in either decimal (1 to 3 decimal
digits 0-9), or hexadecimal format ("0x" followed by 1 or 2 hex digits 0-F).
;---------------------------------------------------------------------------
!TOPIC 507 @COUNT
!NOINDEX
!TTY

@COUNT[c,string]:  Returns the number of times the character c appears in
string.
;---------------------------------------------------------------------------
!TOPIC 247 @CLIP
!NOINDEX
!TTY

@CLIP[n]:  Returns line n from the clipboard.  The first line is
numbered 0.  "**EOC**" is returned for all line numbers beyond the end of
the clipboard.  This function will only work in a DOS session in
Windows.  It will not work in a DOS session under OS/2 or the 025Windows
NT line.
;---------------------------------------------------------------------------
!TOPIC 335 @CLIPW
!NOINDEX
!TTY

@CLIPW[string]:  Writes a string to the clipboard.  This function will only
work in a DOS session in Windows; it will not work in a DOS session
under OS/2 or the 025Windows NT line.
;---------------------------------------------------------------------------
!TOPIC 809 @CLUSTSIZE
!NOINDEX
!TTY

@CLUSTSIZE[d:]:  Returns the size in bytes of a cluster of the specified
drive.
;---------------------------------------------------------------------------
!TOPIC 810 @CODEPAGE
!NOINDEX
!TTY

@CODEPAGE[name]:  Returns the selected codepage for the specified device,
or "0" if no codepage has been selected. name can be CON, PRN, LPT1, LPT2
or LPT3.  Codepages can be selected with MODE.  See your 65535DOS or OS/2
documentation for more information on MODE.
;---------------------------------------------------------------------------
!TOPIC 826 @COM
!NOINDEX
!TTY

@COM[n]:  Returns a "1" if the specified serial port is ready; otherwise,
returns "0".  n=1 checks COM1, n=2 checks COM2, n=3 checks COM3, and
n=4 checks COM4.

The value returned from @COM reflects the status of the Data Set Ready (DSR)
line, which depends also on the cable and the device connected to its other
end.  You may need to check both for troubleshooting eventual problems.
;---------------------------------------------------------------------------
!TOPIC 248 @COMMA
!NOINDEX
!TTY

@COMMA[n]:  Inserts commas, or the "thousands separator" character for
your system, into a numeric string.  To set the thousands separator see the
445ThousandsChar directive.

See also the 285@FORMAT function, which can be useful for aligning or
zero-padding numbers.

NOTE: If the 823NO_SEP environment variable is set, @COMMA has no
effect.
;---------------------------------------------------------------------------
!TOPIC 728 @COMPARE
!NOINDEX
!TTY

@COMPARE[filename1,filename2]:  Returns 1 if the two files are identical,
or 0 if they differ.
;---------------------------------------------------------------------------
!TOPIC 249 @CONVERT
!NOINDEX
!TTY

@CONVERT[input, output, value]:  Converts a numeric string (value) from
one number base (input) to another (output).  Valid bases range from 2
to 36.  The value must be a positive number between 0 and 2**32-1
(4,294,967,295).  No error is returned if value is outside that range.
For example, to convert "1010101" from binary to decimal, use this syntax:

    %@convert[2,10,1010101]
;---------------------------------------------------------------------------
!TOPIC 346 @CRC32
!NOINDEX
!TTY

@CRC32[filename]:  Returns the CRC32 for the specified file, or "-1" if the
file doesn't exist.
;---------------------------------------------------------------------------
!TOPIC 359 @CWD
!NOINDEX
!TTY

@CWD[d:]:  Returns the Current Working Directory of the specified drive,
in the format "d:\pathname".
;---------------------------------------------------------------------------
!TOPIC 360 @CWDS
!NOINDEX
!TTY

@CWDS[d:]:  Returns the Current Working Directory of the specified drive,
in the format "d:\pathname\".
;---------------------------------------------------------------------------
!TOPIC 250 @DATE
!NOINDEX
!TTY

@DATE[date]:  Returns the number of days since January 1, 1980 for
the specified date.  The date may be in either the local date format, or
in ISO format with a four-digit year; see 344date formats for more
information.
;---------------------------------------------------------------------------
!TOPIC 717 @DATECONV
!NOINDEX
!TTY

@DATECONV[date[,format]]:  Converts a date from one format to another.  The
input date may be in either the local date format, or in ISO format with a
four-digit year; see 344date formats for more information.  By default, the
output date is formatted according to the current country settings, but
@DATECONV takes an optional second argument for the output date format:

    0 - system default format
    1 - U.S. format (mm-dd-yy)
    2 - European format (dd-mm-yy)
    3 - Japanese format (yy-mm-dd)
    4 - ISO 8601 international format (yyyy-mm-dd)
    5 - ISO 8601 international format (yyyy-Www-d) week date
    6 - ISO 8601 international format (yyyy-ddd) ordinal date

The separator used in the return string depends on the current country
settings of the system, except for in the ISO 8601 international format,
where it will always by a hyphen ('-') as per spec.
;---------------------------------------------------------------------------
!TOPIC 251 @DAY
!NOINDEX
!TTY

@DAY[date]:  Returns the numeric day of the month for the specified
date.  The date may be in either the local date format, or in ISO format
with a four-digit year; see 344date formats for more information.
;---------------------------------------------------------------------------
!TOPIC 786 @DDCSTR
!NOINDEX
!TTY

@DDCSTR[type]:  Returns a string of a given type from the Display Data
Channel (DDC) Enhanced Display Identification Data (EDID).  If a VESA BIOS
is not present or the monitor does not support DDC, an empty string is
returned.  Type must be from 1 to 3, inclusively.  Here are its meanings:

     Type  Meaning of the string
     
      1    3-letter manufacturer name
      2    model name
      3    serial number

NOTE: If the current video mode is not supported by the VESA BIOS, it may
      switch the display to a supported mode (usually a text mode) before it
      executes this function.
;---------------------------------------------------------------------------
!TOPIC 252 @DEC
!NOINDEX
!TTY

@DEC[expression]:  Returns the same value as
263@EVAL[(expression) - 1].  That is, it subtracts one from the value of
the expression.  Note that the function returns a value that has been
decremented; any variable used in the expression will not be changed.  To
decrement the value of a variable, use a command like this:

    set var=%@dec[%var]

See also 288@INC.
;---------------------------------------------------------------------------
!TOPIC 336 @DECIMAL
!NOINDEX
!TTY

@DECIMAL[n]:  Returns the decimal portion of the number.
;---------------------------------------------------------------------------
!TOPIC 253 @DESCRIPT
!NOINDEX
!TTY

@DESCRIPT[filename]:  Returns the file description for the specified
filename (see 611DESCRIBE).
;---------------------------------------------------------------------------
!TOPIC 254 @DEVICE
!NOINDEX
!TTY

@DEVICE[name]:  Returns "1" if the name is a character device
(such as a printer or serial port), or "0" if not.
;---------------------------------------------------------------------------
!TOPIC 337 @DIGITS
!NOINDEX
!TTY

@DIGITS[n]:  Returns 1 if the string is digits only (no decimal
point, sign character, or thousands separator).
;---------------------------------------------------------------------------
!TOPIC 734 @DIRSTACK
!NOINDEX
!TTY

@DIRSTACK[n]:  Returns the name of the nth entry in the directory stack.
The oldest is number 0.  If no n parameter is specified, returns the total
number of entries in the stack.  The directory stack is set by calls to
653PUSHD / 651POPD.
;---------------------------------------------------------------------------
!TOPIC 255 @DISKFREE
!NOINDEX
!TTY

@DISKFREE[d:,b|k|m|g]: Returns the amount of free disk space on the
specified drive.  DOS networks with large server disk drives (over 2 GB) may
report disk space values that are too small when @DISKFREE is used.  If this
occurs, it is because the network software does not report the proper values
to 4DOS.
;---------------------------------------------------------------------------
!TOPIC 256 @DISKTOTAL
!NOINDEX
!TTY

@DISKTOTAL[d:,b|k|m|g]:  Returns the total disk space on the specified
drive.  DOS networks with large server disk drives (over 2 GB) may
report disk space values that are too small when @DISKTOTAL is used.  If this
occurs, it is because the network software does not report the proper values
to 4DOS.
;---------------------------------------------------------------------------
!TOPIC 257 @DISKUSED
!NOINDEX
!TTY

@DISKUSED[d:,b|k|m|g]:  Returns the amount of disk space in use by files
and directories on the specified drive.  DOS networks with large server disk
drives (over 2 GB) may report disk space values that are too small when
@DISKUSED is used.  If this occurs, it is because the network software does
not report the proper values to 4DOS.
;---------------------------------------------------------------------------
!TOPIC 258 @DOSMEM
!NOINDEX
!TTY

@DOSMEM[b|k|m]:  Returns the amount of free base memory.
;---------------------------------------------------------------------------
!TOPIC 259 @DOW
!NOINDEX
!TTY

@DOW[date]:  Returns the first three characters of the day of the week
for the specified date ("Mon", "Tue", "Wed", etc.)  The date may be in either
the local date format, or in ISO format with a four-digit year; see
344date formats for more information.
;---------------------------------------------------------------------------
!TOPIC 338 @DOWF
!NOINDEX
!TTY

@DOWF[date]:  Returns the day of the week for the specified date ("Monday",
"Tuesday", "Wednesday", etc.)  The date may be in either the local date
format, or in ISO format with a four-digit year; see 344date formats for
more information.
;---------------------------------------------------------------------------
!TOPIC 260 @DOWI
!NOINDEX
!TTY

@DOWI[date]:  Returns the day of the week for the specified date as an
integer (1 = Sunday, 2 = Monday, etc).  The date may be in either the local
date format, or in ISO format with a four-digit year; see 344date formats
for more information.
;---------------------------------------------------------------------------
!TOPIC 261 @DOY
!NOINDEX
!TTY

@DOY[date]:  Returns the day of the year for the specified date
(1-366).  The date may be in either the local date format, or in ISO format
with a four-digit year; see 344date formats for more information.
;---------------------------------------------------------------------------
!TOPIC 727 @DRIVETYPE
!NOINDEX
!TTY

@DRIVETYPE[d:]:  Returns the type for the specified drive:

    0 - The drive type cannot be determined
    1 - The drive does not exist
    2 - Removable disk
    3 - Fixed disk
    4 - Remote (network) drive
    5 - CD or DVD drive
    6 - RAM disk
;---------------------------------------------------------------------------
!TOPIC 262 @EMS
!NOINDEX
!TTY

@EMS[b|k|m]:  Returns the amount of free EMS memory.
;---------------------------------------------------------------------------
!TOPIC 339 @ERRTEXT
!NOINDEX
!TTY

@ERRTEXT[n]:  Returns the DOS error text for the specified code.
;---------------------------------------------------------------------------
!TOPIC 263 @EVAL
!NOINDEX
!TTY

@EVAL[expression]:  Evaluates an arithmetic expression.  The expression
can contain environment variables and other variable functions, and may
use any of the operators listed below.  @EVAL also supports parentheses,
commas, and decimals.  Parentheses can be nested.  @EVAL will strip
leading and trailing zeros from the result.  The valid operators are:

     +/-  (with one value) numeric sign (e.g. -1, +3)

     +    (with two values) addition
     -    (with two values) subtraction

     *    multiplication
     /    division
     \    integer division (the integer part of the quotient)
     MOD  modulo (the remainder when the first value is divided
          by the second)
     %%   same as MOD
     **   exponentiation (the exponent must be a non-negative
          decimal integer)
     AND  bitwise and (returns a 1 for each bit where the
          corresponding bits in both values are 1)
     &    same as AND
     
     OR   bitwise or (returns a 1 for each bit where the
          corresponding bit in either value is 1)
     |    same as OR

     XOR  bitwise exclusive or (returns a 1 for each bit where
          the corresponding bit in one value is 1, and in the other
          value is 0)
     ^    same as XOR

The order of precedence from highest to lowest is:

     Parentheses
     Unary + and -
     **
     *, /, \, MOD
     +, -
     AND, OR, XOR

For example, 3 + 4 * 2 will be interpreted as 3 + 8, not as 7 * 2.  To
change this order of evaluation, use parentheses to specify the order you
want.

To ensure that your @EVAL expressions are interpreted correctly, spaces
should be placed on both sides of each operator, for example:

     %@eval[(20 %% 3) + 4]

You can enter hexadecimal numbers up to 8 digits long by preceding
the number with 0x.  For example:

    c:\> echo %@eval[0x10 + 0x10]
    32

    c:\> echo %@convert[10, 16, %@eval[0x10 + 0x10]]
    20

You can specify hexadecimal output with the special syntax

    @eval[...=H], in which case a leading 0x is not included in the output,
 or @eval[...=X], in which case a leading 0x is included in the output.

For example:

    c:\> echo %@eval[3*6=H]
    12

The default is decimal output.  To convert between decimal and hexadecimal
formats, see the 249@CONVERT function.

The maximum precision is 20 digits to the left of the decimal point and
10 digits to the right of the decimal point.  You can alter the default
precision on the Options 2 page of the 648OPTION dialogs, or with the
427EvalMax and 428EvalMin directives in 4DOS.INI, and with the
664SETDOS /F command.  You can alter the decimal character from the
Options 1 page of the OPTION dialogs, with the 421DecimalChar directive,
or the SETDOS /G command.

You can alter the precision for a single evaluation with the construct
@EVAL[expression=x.y].  The x value specifies the minimum decimal precision
(i.e., the minimum number of decimal places displayed); the y value sets the
maximum decimal precision.  You can use =x,y instead of =x.y if the comma
is your decimal separator.  You can specify either or both values.
If x is greater than y, it is ignored; if only x is specified, y is
set to the same value (e.g. =2 is equivalent to =2.2).  For
example:

    @eval[3 / 6=2.4]  returns 0.50
    @eval[3 / 6=4.4]  returns 0.5000
    @eval[3 / 7]      returns 0.4285714286
    @eval[3 / 7=.4]   returns 0.4286
    @eval[3 / 7=2.2]  returns 0.43
    @eval[3 / 7=2]    also returns 0.43

Also see 252@DEC and 288@INC.
;---------------------------------------------------------------------------
!TOPIC 264 @EXEC
!NOINDEX
!TTY

@EXEC[[@]command]:  Execute the command.  The command can be an alias,
internal command, external command, .BTM file, .BAT file, .CMD file.

@EXEC is primarily intended for running a program from within the
PROMPT.  It is a "back-door" entry into command processing and should
be used with extreme caution.  Incorrect or recursive use of @EXEC may
cause stack overflows or hang your system.  While you may be able to use
complex commands involving pipes, command groups, etc. as its argument, you
should test carefully first as the results may not be what you expect.  We
recommend that you only use a single command as the argument to @EXEC.

By default, @EXEC returns the result code from the command; if you
preface the command name with an '@' then @EXEC will return an empty
string.
;---------------------------------------------------------------------------
!TOPIC 265 @EXECSTR
!NOINDEX
!TTY

@EXECSTR[command]:  Runs the specified command and returns the first line
written to stdout by that command.  @EXECSTR is useful for retrieving a
result from an external utility.  For example, if you have a program called
NETTIME.EXE which retrieves the time of day from your network server and
writes it to standard output, you could save it in an environment variable
using a command like this:

    c:\> set server_time=%@execstr[d:\path\nettime.exe]

If the same utility returned a result properly formatted for the 672TIME
command you could also use it to set the time on your system:

    c:\> time %@execstr[d:\path\nettime.exe]

@EXECSTR is a "back-door" entry into command processing and should
be used with extreme caution.  Incorrect or recursive use of @EXECSTR may
cause stack overflows or hang your system.  While you may be able to use
complex commands involving pipes, command groups, etc. as its argument, you
should test carefully first as the results may not be what you expect.  We
recommend that you only use a single command as the argument to @EXECSTR.
;---------------------------------------------------------------------------
!TOPIC 266 @EXPAND
!NOINDEX
!TTY

@EXPAND[filename[,-nrhsad]]:  Returns, on a single line, the names of all
files and directories that match the filename specification, which may
contain wildcards and include lists.  Returns an empty string if no files
match.  If the file list is longer than the allowed command line length, it
will be truncated without an error message.

The second argument, if included, defines the attributes of the files that
will be included in the search.  The attributes are:

    N   Normal (no attributes set)      S    System
    R   Read-only                       A    Archive
    H   Hidden                          D    subDirectory

The attributes (other than N) can be combined (for example
%@EXPAND[MYFILE,HS]).  You can prefix an attribute with - to mean
"everything except files with this attribute."

If the attribute argument is not used, all matching files and directories 
will be returned.
;---------------------------------------------------------------------------
!TOPIC 267 @EXT
!NOINDEX
!TTY

@EXT[filename]:  Returns the extension from a filename, without a
leading period.  On LFN drives, the extension can be up to 64 characters
long.  On traditional FAT drives, it can be up to 3 characters long.
;---------------------------------------------------------------------------
!TOPIC 268 @EXTENDED
!NOINDEX
!TTY

@EXTENDED[b|k|m]:  Returns the amount of extended memory.   Most memory
managers convert extended memory to XMS and / or EMS memory, and make it
unavailable as extended memory.  Even if so, this function will return the
correct amount of extended memory for informational purposes.
;---------------------------------------------------------------------------
!TOPIC 347 @FIELD
!NOINDEX
!TTY

@FIELD[["xxx",]n,string]:  Returns the nth field in the string.  Like
329@WORD, except it will not scan past multiple delimiters.  The first
field is numbered 0.  If n is negative, fields are returned from the end of
the string.  The first argument is a list of field separators you want to
use; if you don't specify it, only spaces, tabs, and commas are considered
to be field separators.

If you want to use a double quote as a separator, prefix it with an
086escape character.  If the string argument is enclosed in quotation
marks, you must enter a list of separators.
;---------------------------------------------------------------------------
!TOPIC 449 @FIELDS
!NOINDEX
!TTY

@FIELDS[["xxx",]string]:  Returns the number of fields in the string.
Like 330@WORDS, except it will not scan past multiple delimiters (it
counts each occurrence of a separator individually to allow processing empty
fields in a string).  The first argument is a list of field separators you
want to use; if you don't specify it, only spaces, tabs, and commas are
considered to be field separators.  See also 330@WORDS.

If you want to use a double quote as a separator, prefix it with an
086escape character.  If the string argument is enclosed in quotation
marks, you must enter a list of separators.
;---------------------------------------------------------------------------
!TOPIC 269 @FILEAGE
!NOINDEX
!TTY

@FILEAGE[filename[,acw]]:  Returns the date and time of the file as a single
numeric value.  The number can be used to compare the relative ages of two
or more files, but can not be used for date and time calculations as it is
not returned in identifiable units.

The optional second argument selects which date field is returned for files
on an LFN drive:  a means the last access date, c means the creation
date, and w means the last modification (write) date, which is the default.

Also see 301@MAKEAGE.
;---------------------------------------------------------------------------
!TOPIC 270 @FILECLOSE
!NOINDEX
!TTY

@FILECLOSE[n]:  Closes the file whose handle is n.  You cannot
close handles 0, 1 or 2.  Returns "0" if the file closed OK or "-1" if an
error occurs.  Be sure to read the cautionary note about file functions
under 241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 271 @FILEDATE
!NOINDEX
!TTY

@FILEDATE[filename[,[acw][,n]]]:  Returns the date a file was last
modified, in the default country format (mm-dd-yy for the US).  The optional
second argument selects which date field is returned for files on an LFN
drive: a means the last access date, c means the creation date, and w
means the last modification (write) date, which is the default.  @FILEDATE
also takes an optional third argument for the date format:

    0 - System default format
    1 - U.S. format (mm-dd-yy)
    2 - European format (dd-mm-yy)
    3 - Japanese format (yy-mm-dd)
    4 - ISO 8601 international format (yyyy-mm-dd)
    5 - ISO 8601 international format (yyyy-Www-d) week date
    6 - ISO 8601 international format (yyyy-ddd) ordinal date

The separator used in the returned string depends on the current country
settings of the system, except for in the ISO 8601 international format,
where it will always by a hyphen ('-') as per spec.
;---------------------------------------------------------------------------
!TOPIC 272 @FILENAME
!NOINDEX
!TTY

@FILENAME[filename]:  Returns the name and extension of a file, without
a path.
;---------------------------------------------------------------------------
!TOPIC 273 @FILEOPEN
!NOINDEX
!TTY

@FILEOPEN[filename, r | w | a, [b|t]]:  Opens the file in the
specified mode: r(ead), w(rite) or a(ppend), and returns the file handle
as an integer.  Returns "-1" if the file cannot be opened.

The optional third parameter controls whether the file is opened in binary
mode (b) or text mode (t).  Text mode (the default) should be used to
read text using 274@FILEREAD without a length parameter, and to
write text using 280@FILEWRITE.  Binary mode should be used to read
binary data with 478@FILEREADB or @FILEREAD with a length parameter,
and to write binary data with 281@FILEWRITEB.

To open a file for both reading and writing, open it in append mode,
then use 276@FILESEEK to seek to the start of the file (or any
other desired location) before performing additional operations.

Be sure to read the cautionary note about file functions under
241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 274 @FILEREAD
!NOINDEX
!TTY

@FILEREAD[n[,length]]:  Reads data from the file whose handle is n.
Returns "**EOF**" if you attempt to read past the end of the file.  If
length is not specified @FILEREAD will read until the next CR or LF (end of
line) character.  If length is specified, @FILEREAD will read length
bytes regardless of any end of line characters.

If you plan to read text a line at a time, without using length, you
should open the file in text mode.  If you plan to read binary data using
length, you should open the file in binary mode.  See
273@FILEOPEN for details on opening the file in the proper mode.

Be sure to read the cautionary note about file functions under
241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 478 @FILEREADB
!NOINDEX
!TTY

@FILEREADB[n,length]:  Reads length bytes from the file whose handle is
n.  Returns "**EOF**" if you attempt to read past the end of the file.
The data will be returned as a string of space-separated numeric digits
representing the ASCII value of each character.

If you plan to read binary data with @FILEREADB you should open the file
in binary mode (see 273@FILEOPEN).  If you want to read text a line at a
time you may want to use the 274@FILEREAD function instead, and open the
file in text mode.

Be sure to read the cautionary note about file functions under
241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 275 @FILES
!NOINDEX
!TTY

@FILES[filename,[-nrhsad]]:  Returns the number of files that
match the filename, which may contain wildcards and include lists.
Returns "0" if no files match.  The filename must consist of a
single file or directory name (with wildcards if desired); to check
several directories or filenames use @FILES once for each, and add
the results together with 263@EVAL.
!TTY

The second argument is a list of file attributes.  If it is included, only
those files matching all the specified attributes are counted.  The
attributes are:

    N   Normal (no attributes set)      S    System
    R   Read-only                       A    Archive
    H   Hidden                          D    subDirectory

The attributes (other than N) can be combined (for example
%@FILES[MYFILE,HS]).  You can prefix an attribute with - to mean
"everything except files with this attribute."
;---------------------------------------------------------------------------
!TOPIC 276 @FILESEEK
!NOINDEX
!TTY

@FILESEEK[n,offset,start]:  Moves the file pointer offset bytes in
the file whose handle is n.  Returns the new position of the pointer, in
bytes from the start of the file.  Set start to 0 to seek relative to the
beginning of the file, 1 to seek relative to the current file pointer, or 2
to seek relative to the end of the file.  The offset value may be negative
(seek backward), positive (seek forward), or zero (return current position,
but do not change it).  Be sure to read the cautionary note about file
functions under 241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 277 @FILESEEKL
!NOINDEX
!TTY

@FILESEEKL[n,line]:  Moves the file pointer to the specified line in the
file whose handle is n.  The first line in the file is numbered 0.
Returns the new position of the pointer, in bytes from the start of the
file.

@FILESEEKL must read each line of the file up to the target line in order
to position the pointer, and will therefore cause significant delays if
used in a long loop or on a large file.

Be sure to read the cautionary note about file functions under
241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 278 @FILESIZE
!NOINDEX
!TTY

@FILESIZE[filename,b|k|m|g[,a]]:  Returns the size of a file, or "-1" if
the file does not exist.  If the filename includes wildcards or an include
list, returns the combined size of all matching files.

The optional third argument a (allocated), if used, instructs @FILESIZE
to return the amount of space allocated for the file(s) on the disk, rather
than the amount of data in the file.  Network drives and compressed drives
may not always report allocated sizes accurately, depending on the way the
network or disk compression software is implemented.
;---------------------------------------------------------------------------
!TOPIC 279 @FILETIME
!NOINDEX
!TTY

@FILETIME[filename[,[acw][,s]]]:  Returns the time a file was last
modified, in hh:mm format.  The optional second argument selects
which time field is returned for files on an LFN drive:  a means
the last access time, c means the creation time, and w means the
last modification (write) time, which is the default.  Times are
normally returned with hours and minutes only; to retrieve seconds
as well, add an s as the third argument.  The last access time is
always returned as 00:00, and without a seconds field, on LFN
drives.
;---------------------------------------------------------------------------
!TOPIC 280 @FILEWRITE
!NOINDEX
!TTY

@FILEWRITE[n,text]:  Writes a line to the file whose handle is n.  Returns
the number of bytes written, or "-1" if an error occurred.  n must be a
handle returned by 273FILEOPEN; or 1 (for standard output) or 2 (for
standard error).

If you plan to write text a line at a time with @FILEWRITE, you should
open the file in text mode (see 273@FILEOPEN).  If you want to write
binary data you should use 281@FILEWRITEB instead, and open the file
in binary mode.

Be sure to read the cautionary note about file functions under
241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 281 @FILEWRITEB
!NOINDEX
!TTY

@FILEWRITEB[n,length,string]:  Writes the specified number of bytes from
the string to the file whose handle is n.  Returns the number of bytes
written, or "-1" if an error occurred.

If the length argument is -1, @FILEWRITEB will read the string argument as
a series of ASCII values to write to the file.  For example:

    echo %@filewriteb[%file,-1,224 242 169]

The ASCII code of each byte may be entered in either decimal (1 to 3 decimal
digits 0-9), or hexadecimal format ("0x" followed by 1 or 2 hex digits 0-F).

If you plan to write binary data with @FILEWRITEB you should open the file
in binary mode (see 273@FILEOPEN).  If you want to write text a line at a
time you may want to use the 280@FILEWRITE function instead, and open the
file in text mode.

Be sure to read the cautionary note about file functions under
241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 282 @FINDCLOSE
!NOINDEX
!TTY

@FINDCLOSE[filename]:  Signals the end of a 283@FINDFIRST /
284@FINDNEXT sequence.  When running 4DOS under Windows 95/98/ME, you
must use this function to release the directory search handle used for
@FINDFIRST / @FINDNEXT.
;---------------------------------------------------------------------------
!TOPIC 283 @FINDFIRST
!NOINDEX
!TTY

@FINDFIRST[filename [,-nrhsad]]:  Returns the name of the first file that
matches the filename, which may contain wildcards and "include lists."  The
second argument, if included, defines the attributes of the files that will
be included in the search.  Returns an empty string if no files match.  The
attributes are:

    N   Normal (no attributes set)      S    System
    R   Read-only                       A    Archive
    H   Hidden                          D    subDirectory

The attributes (other than N) can be combined (for example
%@FINDFIRST[MYFILE,HS]).  @FINDFIRST will only find a file if all of the
attributes match.  You can prefix an attribute with - to mean "everything
except files with this attribute."

@FINDFIRST always skips the "." and ".." entries when processing directory
names.

To search for additional files after the first which match a wildcard or
include list see 284@FINDNEXT.

When running 4DOS under Windows 95/98/ME you must use @FINDCLOSE after
@FINDFIRST or the last @FINDNEXT to avoid running out of directory search
handles.
;---------------------------------------------------------------------------
!TOPIC 284 @FINDNEXT
!NOINDEX
!TTY

@FINDNEXT[[filename [,-nrhsad]]]:  Returns the name of the next file that
matches the filename passed to 283@FINDFIRST.  Returns an empty string
when no more files match.  @FINDNEXT should only be used after a successful
call to @FINDFIRST.  The first argument is included for compatibility with
previous versions, but is ignored; it can be omitted if the second argument
is not used (e.g. %@FINDNEXT[]).  The second argument, if included,
defines the attributes of the files that will be included in the search.

    N   Normal (no attributes set)      S    System
    R   Read-only                       A    Archive
    H   Hidden                          D    subDirectory

The attributes (other than N) can be combined (for example
%@FINDNEXT[MYFILE,HS]).  @FINDNEXT will only find a file if all of the
attributes match. You can prefix an attribute with - to mean "everything
except files with this attribute."

@FINDNEXT always skips the "." and ".." entries when processing directory
names.

When running 4DOS under Windows 95/98/ME you must use @FINDCLOSE after
283@FINDFIRST or the last @FINDNEXT to avoid running out of directory
search handles.

See the notes under 241Variable Functions about quoting returned
long filenames.
;---------------------------------------------------------------------------
!TOPIC 726 @FLOOR
!NOINDEX
!TTY

@FLOOR[n]:  Returns the value of the smallest integer that is not less than
n.
;---------------------------------------------------------------------------
!TOPIC 285 @FORMAT
!NOINDEX
!TTY

@FORMAT[[-][[0]x][.y],string]:  Reformats a string, truncating it or padding
it with spaces as necessary.  If you use the minus [-], the string is
left-justified; otherwise, it is right-justified.  The x value is the
minimum number of characters in the result.  The y value is the maximum
number of characters in the result.  You can combine the options as
necessary.  For example:

    "%@format[12,JPSoftware]"   returns "  JPSoftware"
    "%@format[.3,JPSoftware]"   returns "JPS"

@FORMAT will add leading or trailing spaces if necessary to pad the
result to the minimum width specified by x.  If a leading zero is
used before x, the padding will be with 0's instead, for example:

    "%@format[4,5]"     returns "   5"
    "%@format[04,5]"    returns "0005"
    "%@format[-04,5]"   returns "5000"

See also the 248@COMMA function, which can make numeric values easier
to read by inserting thousands separators.
;---------------------------------------------------------------------------
!TOPIC 777 @FSTYPE
!NOINDEX
!TTY

@FSTYPE[d:]:  Returns the file system type for the specified disk drive --
"FAT" for FAT12, FAT16 and VFAT drives, or "FAT32", "NTFS", "EXT2", "CDFS"
or other value depending on the file system and the installed driver for it.
An empty string means that DOS has no long file name support for that drive.
;---------------------------------------------------------------------------
!TOPIC 286 @FULL
!NOINDEX
!TTY

@FULL[filename]:  Returns the fully qualified path and filename of a file.

See the notes under 241Variable Functions about quoting returned long
filenames.
;---------------------------------------------------------------------------
!TOPIC 348 @FUNCTION
!NOINDEX
!TTY

@FUNCTION[name]:  Returns the contents of the specified user-defined function
as a string, or a null string if the function doesn't exist.  When manipulating
strings returned by @FUNCTION you may need to disable certain special characters
with the 664SETDOS /X command.  Otherwise, command separators, redirection
characters, and other similar "punctuation" in the function may be interpreted
as part of the current command, rather than part of a simple text string.
;---------------------------------------------------------------------------
!TOPIC 808 @HDDSIZE
!NOINDEX
!TTY

@HDDSIZE[d:,b|k|m|g]:  Returns the size of the entire physical hard disk
drive to which the specified logical drive belongs, or zero if the specified
logical drive does not belong to a hard disk drive supported by BIOS Int 13h
or if the BIOS does not support the Microsoft/IBM/Phoenix Int 13h BIOS
Extensions for Logical Block Addressing (LBA).
;---------------------------------------------------------------------------
!TOPIC 718 @HISTORY
!NOINDEX
!TTY

@HISTORY[x[,y]]:  Returns a line or word from the command history. (This
function will prove most useful in keystroke aliases).  x is the line to
retrieve (current line = 0), and y is the specific word (first word = 0)
desired within that line.  If y is omitted, @HISTORY returns the entire
line.

See 033Command History and Recall for more information about the command
history.
;---------------------------------------------------------------------------
!TOPIC 287 @IF
!NOINDEX
!TTY

@IF[condition,true-value,false-value]:  Evaluates the condition and
returns a string based on the result.  The condition can include any of
the tests allowed in the 633IF command.  If the condition is true, @IF
returns the first result string; if it is false, @IF returns the second
string.  For example, echo %@if[2 == 2,Correct!,Oops!] displays "Correct!"


Be aware that both true-value and false-value will be evaluated even though
only one is to be returned!  Whether the condition is true or false, both
arguments are expanded.  For this reason, you should avoid using "action"
functions like 335@CLIPW, 264@EXEC, 265@EXECSTR, 273@FILEOPEN,
270@FILECLOSE, 274@FILEREAD, 280@FILEWRITE, 283@FINDFIRST,
340@INIREAD, 341@INIWRITE, 326@UNIQUE, and so on in either the
true-value or the false-value.
;---------------------------------------------------------------------------
!TOPIC 288 @INC
!NOINDEX
!TTY

@INC[expression]:  Returns the same value as
263@EVAL[(expression) + 1].  That is, it adds one to the value of the
expression.  Note that the function returns a value that has been
incremented; any variable used in the expression will not be changed.  To
increment the value of a variable, use a command like this:

    set var=%@inc[%var]

See also 252@DEC.
;---------------------------------------------------------------------------
!TOPIC 289 @INDEX
!NOINDEX
!TTY

@INDEX[string1,string2[,n]]:  Returns the position of string2 within
string1, or "-1" if string2 is not found.  The first position in
string1 is numbered 0.  The optional third parameter n specifies the
offset of additional matches.  For example, to return the offset of the
second match:

    %@index[abcdeabcde,cd,2]

An offset of 0 will return the total number of matches.  A negative offset
will search from right to left.
;---------------------------------------------------------------------------
!TOPIC 340 @INIREAD
!NOINDEX
!TTY

@INIREAD[filename,section,key]:  Returns an entry from the specified .INI
file or an empty string if the entry does not exist.  For example,

    %@iniread[c:\4DOS\4DOS.ini,PRIMARY,history]

returns the size of the command history if it is specified in the [PRIMARY]
section of 4DOS.INI.  The filename must be in quotes if it contains
whitespace or special characters.  The section name and key name are
each limited to 255 characters.
;---------------------------------------------------------------------------
!TOPIC 341 @INIWRITE
!NOINDEX
!TTY

@INIWRITE[filename,section,key,value]:  Creates or updates an entry in
the specified .INI file.  For example,

    %@iniwrite[c:\4dos\4dos.ini,4dos,history,2048]

will set the size of the command history to 2,048 bytes the next time 4DOS
is started.  @INIWRITE returns "0" for success or "-1" for failure.  The
filename must be in quotes if it contains whitespace or special
characters.   The section name and key name are each limited to 255
characters
;---------------------------------------------------------------------------
!TOPIC 290 @INSERT
!NOINDEX
!TTY

@INSERT[n,string1,string2]:  Inserts string1 into string2 starting at
position n.  The first position in the string is postion 0.  For example,
%@insert[1,arm,wing] returns the string "warming".
;---------------------------------------------------------------------------
!TOPIC 291 @INSTR
!NOINDEX
!TTY

@INSTR[start,length,string]:  Returns a substring, starting at the
position start and continuing for length characters.  If the length
is omitted, it will default to the remainder of the string.  If the
length is negative, the start is relative to the right side of the
string.  The first character in the string is numbered 0; if the
length is negative, the last character is numbered 0.

For example, %@INSTR[0,2,%_TIME] gets the current time and extracts the
hour; %@INSTR[1,-2,%_TIME] extracts the seconds.

321@SUBSTR is an older version of the same function.
;---------------------------------------------------------------------------
!TOPIC 292 @INT
!NOINDEX
!TTY

@INT[n]:  Returns the integer part of the number n.
;---------------------------------------------------------------------------
!TOPIC 508 @ISALNUM
!NOINDEX
!TTY

@ISALNUM[string]:  Returns "1" if string is entirely composed of alphabetic
(a-z, A-Z) and/or numeric (0-9) characters; "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 509 @ISALPHA
!NOINDEX
!TTY

@ISALPHA[string]:  Returns "1" if string is entirely composed of alphabetic
(a-z, A-Z) characters; "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 510 @ISASCII
!NOINDEX
!TTY

@ISASCII[string]:  Returns "1" if string is entirely composed of 7-bit ASCII
characters (0-7Fh); "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 528 @ISCNTRL
!NOINDEX
!TTY

@ISCNTRL[string]:  Returns "1" if string is entirely composed of ASCII
control characters (0-1Fh or 7Fh); "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 529 @ISDIGIT
!NOINDEX
!TTY

@ISDIGIT[string]:  Returns "1" if string is entirely composed of decimal
digits (0-9); "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 828 @ISLOWER
!NOINDEX
!TTY

@ISLOWER[string]:  Returns "1" if string is entirely composed of
lower-case letters (a-z); "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 458 @ISODOWI
!NOINDEX
!TTY

@ISODOWI[date]:  Returns the day of the week for the specified date as an
integer (1 = Monday, 2 = Tuesday, ... , 6 = Saturday, 7 = Sunday), pursuant
to ISO 8601.  The date may be in either the local date format, or in ISO
format with a four-digit year; see 344date formats for more information.
;---------------------------------------------------------------------------
!TOPIC 459 @ISOWEEK
!NOINDEX
!TTY

@ISOWEEK[date] is the week of the year (1 to 53), pursuant to ISO 8601.
Week 1 is the one that includes the first Thursday of the year, or
equivalently, the week which includes 4th of January.  It is possible that
a January week is 52 or 53, or a December week is 1.  This means that,
according to ISO 8601, it belongs to the previous or the following calendar
year, respectively.  The date may be in either the local date format, or in
ISO format with a four-digit year; see 344date formats for more
information.
;---------------------------------------------------------------------------
!TOPIC 721 @ISOWYEAR
!NOINDEX
!TTY

@ISOWYEAR[date] is the year of the ISO 8601 week date.  It may not be
the calendar year of the entered date but the previous or the following one.
This means that, according to ISO 8601, the week of the entered date belongs
to the previous or the following calendar year, respectively.  The date may
be in either the local date format, or in ISO format with a four-digit year;
see 344date formats for more information.
;---------------------------------------------------------------------------
!TOPIC 530 @ISPRINT
!NOINDEX
!TTY

@ISPRINT[string]:  Returns "1" if string is entirely composed of printable
characters; "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 558 @ISPUNCT
!NOINDEX
!TTY

@ISPUNCT[string]:  Returns "1" if string is entirely composed of punctuation
characters, i.e. printable characters which are not alphanumeric or space;
"0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 559 @ISSPACE
!NOINDEX
!TTY

@ISSPACE[string]:  Returns "1" if string is entirely composed of white space
characters (9-0Dh or 20h); "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 829 @ISUPPER
!NOINDEX
!TTY

@ISUPPER[string]:  Returns "1" if string is entirely composed of
upper-case letters (A-Z); "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 560 @ISXDIGIT
!NOINDEX
!TTY

@ISXDIGIT[string]:  Returns "1" if string is entirely composed of hexadecimal
digits (0-9, A-F, a-f); "0" otherwise.
;---------------------------------------------------------------------------
!TOPIC 293 @LABEL
!NOINDEX
!TTY

@LABEL[d:]:  Returns the volume label of the specified disk drive.
;---------------------------------------------------------------------------
!TOPIC 730 @LCS
!NOINDEX
!TTY

@LCS[string1,string2]:  Returns the Longest Common Subsequence in string1
and string2.  For example, for the strings "XMJYAUZ" and "MZJAWXU", it is
"MJAU".
;---------------------------------------------------------------------------
!TOPIC 294 @LEFT
!NOINDEX
!TTY

@LEFT[n,string]:  Returns the leftmost n characters from the
string.  If n is greater than the length of the string, returns the
entire string.  For example, %@left[2,jpsoft] returns the string
"jp".  If n is negative, returns all but the rightmost n characters.
;---------------------------------------------------------------------------
!TOPIC 295 @LEN
!NOINDEX
!TTY

@LEN[string]:  Returns the length of a string.
;---------------------------------------------------------------------------
!TOPIC 296 @LFN
!NOINDEX
!TTY

@LFN[filename]:  Returns the long filename for a short ("8.3")
filename.  This function will only work if you are running under
Windows 95/98/ME.  The filename may contain any valid filename element
including drive letter, path, filename and extension; the entire name
including all intermediate paths will be returned in long name format.
Be sure to read the notes under 241Variable Functions about quoting
returned long filenames.
;---------------------------------------------------------------------------
!TOPIC 297 @LINE
!NOINDEX
!TTY

@LINE[filename,n]:  Returns line n from the specified file.  The
first line in the file is numbered 0.  "**EOF**" is returned for all line
numbers beyond the end of the file.

@LINE works with files having lines of no more than 511 characters; longer
lines will not be counted accurately.

The @LINE function must read each line of the file to find the line you
request, and will therefore cause significant delays if used in a long loop
or on a large file.  For a more effective method of processing each line of
a file in sequence use the FOR command, or 273@FILEOPEN and a sequence of
@FILEREADs.

You can retrieve input from standard input if you specify CON as the
filename.  If you are 051redirecting input to @LINE using this feature,
you must use 085command grouping or the redirection will not work
properly (you can 052pipe to @LINE without a command group; this
restriction applies only to input redirection).  For example:

    (echo %@line[con,0]) < myfile.dat
;---------------------------------------------------------------------------
!TOPIC 298 @LINES
!NOINDEX
!TTY

@LINES[filename]:  Returns the line number of the last line in the
file, or "-1" if the file is empty.  The first line in the file is numbered
0, so (for example) @LINES will return 0 for a file containing one line.
To get the actual number of lines, use %@INC[%@LINES[filename]].

@LINES works with files having lines of no more than 511 characters; longer
lines will not be counted accurately.

@LINES must read each line of the file in order to count it, and will
therefore cause significant delays if used in a long loop or on a large file.
;---------------------------------------------------------------------------
!TOPIC 299 @LOWER
!NOINDEX
!TTY

@LOWER[string]:  Returns the string converted to lower case.
;---------------------------------------------------------------------------
!TOPIC 300 @LPT
!NOINDEX
!TTY

@LPT[n]:  Returns a "1" if the specified printer is ready; otherwise,
returns "0".  n=1 checks the printer connected to LPT1, n=2 checks LPT2,
and n=3 checks LPT3.

The value returned from @LPT may reflect the status of the printer port, or
the printer itself, depending on your BIOS and printer port hardware.  You
may need to experiment to determine what values are returned on your system.
;---------------------------------------------------------------------------
!TOPIC 406 @LTRIM
!NOINDEX
!TTY

@LTRIM[chars,string]:  Returns string with all the leading characters in
chars removed.  For example, %@LTRIM[IJMPX,JP Software] returns " Software".
The test is case sensitive.  To include a comma in the chars string,
enclose the entire first argument in double quotes.  @LTRIM will remove the
quotes before processing the string.
;---------------------------------------------------------------------------
!TOPIC 301 @MAKEAGE
!NOINDEX
!TTY

@MAKEAGE[date[,time]]:  Returns the date and time (if included) as a
single value in the same format as 269@FILEAGE.  Can be used to compare the
time stamp of a file with a specific date and time, for example:

    if %@fileage[myfile] lt %@makeage[1/1/85] echo OLD!

The value returned by @MAKEAGE can be used for comparisons, but can not be
used for date and time calculations because it is not in identifiable units.

The @MAKEAGE value changes every two seconds, so, for example,
%@MAKEAGE[01-06-2003,12:00:00] and %@MAKEAGE[01-06-2003,12:00:01]
will return the same result.

The date may be in either the local date format, or in ISO format with a
four-digit year; see 344date formats for more information.  The time
must be in 24-hour format; "am" and "pm" cannot be used.  If the time is
not specified, it defaults to midnight.
;---------------------------------------------------------------------------
!TOPIC 302 @MAKEDATE
!NOINDEX
!TTY

@MAKEDATE[n[,format]]:  Returns a date (formatted according to the current
country settings).  n is the integer number of days since 1980-01-01.  This
is the inverse of 250@DATE.  @MAKEDATE takes an optional second argument
for the date format:

    0 - system default format
    1 - U.S. format (mm-dd-yy)
    2 - European format (dd-mm-yy)
    3 - Japanese format (yy-mm-dd)
    4 - ISO 8601 international format (yyyy-mm-dd)
    5 - ISO 8601 international format (yyyy-Www-d) week date
    6 - ISO 8601 international format (yyyy-ddd) ordinal date

The separator used in the return string depends on the current country
settings of the system, except for in the ISO 8601 international format,
where it will always by a hyphen ('-') as per spec.
;---------------------------------------------------------------------------
!TOPIC 303 @MAKETIME
!NOINDEX
!TTY

@MAKETIME[n]:  Returns a time (formatted according to the current
country settings).  n is the number of seconds since midnight.  This is
the inverse of 322@TIME.
;---------------------------------------------------------------------------
!TOPIC 304 @MASTER
!NOINDEX
!TTY

@MASTER[varname]:  Returns the value of a variable from the master
environment.
;---------------------------------------------------------------------------
!TOPIC 342 @MAX
!NOINDEX
!TTY

@MAX[a,b,c,...]:  Returns the largest integer in the list.
;---------------------------------------------------------------------------
!TOPIC 402 @MD5
!NOINDEX
!TTY

@MD5[filename]:  Returns the 32 hexadecimal digit MD5 hash of the contents
of the specified file, or "-1" if the file doesn't exist. The RSA Data
Security Inc. MD5 message-digest algorithm described in RFC 1321 is used to
compute the hash value.
;---------------------------------------------------------------------------
!TOPIC 343 @MIN
!NOINDEX
!TTY

@MIN[a,b,c,...]:  Returns the smallest integer in the list.
;---------------------------------------------------------------------------
!TOPIC 305 @MONTH
!NOINDEX
!TTY

@MONTH[date]:  Returns the month number for the specified date (1-12).  The
date may be in either the local date format, or in ISO format with a
four-digit year; see 344date formats for more information.
;---------------------------------------------------------------------------
!TOPIC 369 @MONTHF
!NOINDEX
!TTY

@MONTHF[date]:  Returns the full month name for the specified date
("January, "February", etc.).  The date may be in either the local date
format, or in ISO format with a four-digit year; see 344date formats for
more information.
;---------------------------------------------------------------------------
!TOPIC 306 @NAME
!NOINDEX
!TTY

@NAME[filename]:  Returns the base name of a file, without the path or
extension.

See the notes under 241Variable Functions about quoting returned
long filenames.
;---------------------------------------------------------------------------
!TOPIC 307 @NUMERIC
!NOINDEX
!TTY

@NUMERIC[string]:  Returns "1" if string is composed entirely of
digits (0 to 9), signs (+ or -), and the thousands and decimals
separators.  Otherwise, returns "0".

If the string begins with a decimal separator it is not considered numeric
unless the next character is a digit, and there are no more decimal
separators within the string.  For example, ".07" is numeric, but ".a" and
".07.50" are not.
;---------------------------------------------------------------------------
!TOPIC 308 @PATH
!NOINDEX
!TTY

@PATH[filename]:  Returns the path from a filename, including the
drive letter and a trailing backslash but not including the base name or
extension.

See the notes under 241Variable Functions about quoting returned
long filenames.
;---------------------------------------------------------------------------
!TOPIC 503 @QUOTE
!NOINDEX
!TTY

@QUOTE[filename]:  Returns a double quoted argument, if it contains any
whitespace characters.
;---------------------------------------------------------------------------
!TOPIC 309 @RANDOM
!NOINDEX
!TTY

@RANDOM[min, max]:  Returns a "pseudo-random" value between min and max,
inclusive.  Min, max, and the returned value are all integers.

The pseudo-random number generator is initialized from the system clock the
first time it is used after 4DOS starts, so it will produce a different
sequence of random numbers each time you use it.  It can be called up to
115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,
457,584,007,913,129,639,935 (2^256-1) times before repeating the sequence of
pseudo-random numbers it produces.  The Xorshift7 generator proposed in the
paper "On the Xorshift Random Number Generators" by Francois Panneton and
Pierre L'Ecuyer is used to generate the pseudo-random numbers.
;---------------------------------------------------------------------------
!TOPIC 310 @READSCR
!NOINDEX
!TTY

@READSCR[row,col,length]:  Returns the text displayed on the screen at
the specified location.  The upper left corner of the screen is location
0,0.

The row and col can be specified as an offset from the current
cursor location by preceding either value with a [+] or [-].  For example:

     %@readscr[-2,+2,10]

returns 10 characters from the screen, starting 2 rows above and 2 columns to
the right of the current cursor position.

You can also specify the row and column as offsets from the current cursor
position.  Begin the value with a plus sign [+] to read the screen the
specified number of rows below (or columns to the right of) the current
position, or with a minus sign [-] to read the screen above (or to the
left of) the current position.
;---------------------------------------------------------------------------
!TOPIC 311 @READY
!NOINDEX
!TTY

@READY[d:]:  Returns "1" if the specified drive is ready; otherwise
returns "0".

Warning:  Some CD-ROM drivers may report an incorrect status to 4DOS.
;---------------------------------------------------------------------------
!TOPIC 312 @REMOTE
!NOINDEX
!TTY

@REMOTE[d:]:  Returns "1" if the specified drive is a remote (network)
drive; otherwise returns "0".
;---------------------------------------------------------------------------
!TOPIC 313 @REMOVABLE
!NOINDEX
!TTY

@REMOVABLE[d:]:  Returns "1" if the specified drive is removable (i.e.,
a floppy disk or removable hard disk); otherwise returns "0".
;---------------------------------------------------------------------------
!TOPIC 314 @REPEAT
!NOINDEX
!TTY

@REPEAT[c,n]:  Returns the character c repeated n times.
;---------------------------------------------------------------------------
!TOPIC 315 @REPLACE
!NOINDEX
!TTY

@REPLACE[string1,string2,text]:  Replaces all occurrences of string1 in
the text string with string2.  For example, %@replace[w,ch,warming]
returns the string "charming".  The search is case-sensitive.
;---------------------------------------------------------------------------
!TOPIC 729 @REVERSE
!NOINDEX
!TTY

@REVERSE[string]:  Reverses the order of the characters in string.
;---------------------------------------------------------------------------
!TOPIC 316 @RIGHT
!NOINDEX
!TTY

@RIGHT[n,string]:  Returns the rightmost n characters from the
string.  If n is greater than the length of the string, returns the
entire string.  For example, %@right[4,jpsoft] returns the string "soft".
If n is negative, returns all but the leftmost n characters.
;---------------------------------------------------------------------------
!TOPIC 407 @RTRIM
!NOINDEX
!TTY

@RTRIM[chars,string]:  Returns string with all the trailing characters in
chars removed.  For example, %@RTRIM[958NPTX,Windows XP] returns "Windows ".
The test is case sensitive.  To include a comma in the chars string,
enclose the entire first argument in double quotes.  @LTRIM will remove the
quotes before processing the string.
;---------------------------------------------------------------------------
!TOPIC 317 @SEARCH
!NOINDEX
!TTY

@SEARCH[filename[,path]]:  Searches for the filename using the 138PATH
environment variable or the specified path, appending an extension if one
isn't specified.  Returns the fully-expanded name of the file including
drive, path, base name, and extension, or an empty string if a matching
file is not found.  If wildcards are used in the filename, @SEARCH will
search for the first file that matches the wildcard specification, and
return the drive and path for that file plus the wildcard filename (e.g.,
E:\UTIL\*.COM).
;---------------------------------------------------------------------------
!TOPIC 318 @SELECT
!NOINDEX
!TTY

@SELECT[filename,top,left,bottom,right,title[,1]]:  Pops up a selection
window with the lines from the specified file, allowing you to display menus
or other selection lists from within a batch file.  You can move through the
selection window with standard popup window navigation keystrokes, including
character matching (see 894Popup Windows for details; to change the
navigation keys see 481Key Mapping Directives).

@SELECT returns the text of the line the scrollbar is on if you press
Enter, or an empty string if you press Esc.  The filename must be in
quotes if it contains whitespace or special characters.  The file size is
limited only by available memory.  To select from lines passed through input
redirection or a pipe, use CON as the filename.  To select from lines
on the Windows clipboard, use CLIP: as the filename.  If you use the
optional 1 argument after the window title, the list will be sorted
alphabetically.
;---------------------------------------------------------------------------
!TOPIC 358 @SERIAL
!NOINDEX
!TTY

@SERIAL[d:]:  Returns the serial number of the specified disk drive
(in hex, i.e.: ABCD:1234).
;---------------------------------------------------------------------------
!TOPIC 319 @SFN
!NOINDEX
!TTY

@SFN[filename]:  Returns the fully expanded short ("8.3") filename for a
long filename.  This function will only work if you are running under
Windows 95/98/ME.  The filename may contain any valid filename element
including drive letter, path, filename and extension; the entire name
including all intermediate paths will be returned in short name format.
The filename should not be quoted.
;---------------------------------------------------------------------------
!TOPIC 403 @SHA1
!NOINDEX
!TTY

@SHA1[filename]:  Returns the 40 hexadecimal digit SHA1 hash of the contents
of the specified file, or "-1" if the file doesn't exist.  The Secure Hash
Algorithm 1 (SHA1) described in RFC 4634 is used to compute the hash value.
;---------------------------------------------------------------------------
!TOPIC 733 @SIMILAR
!NOINDEX
!TTY

@SIMILAR[string1,string2]:  Returns a percentage value (0 - 100) reflecting
the similarity between string1 and string2.  0 means the two strings have
nothing in common; 100 means the strings are identical.  Using the longer
string as the first parameter usually results in lower similarity values and
using the shorter results in higher values.  The algorithm is the same as in
the PHP similar_text() function and was derived from the paper "Decision
Graphs - An Extension of Decision Trees" by Jonathan Oliver.
;---------------------------------------------------------------------------
!TOPIC 409 @SMBSTR
!NOINDEX
!TTY

@SMBSTR[type,n]:  Returns the nth string of a given type from the System
Management (SM) BIOS Desktop Management Interface (DMI) data.  If a SMBIOS
or the requested string is not present, an empty string is returned.  Type
must be from 0 to 127, inclusively.  The string number n must be positive.

The number of the standardized strings is large (about 60) so a full list is
not included here - see the System Management BIOS Reference Specification.
Your BIOS may not include some of the strings and even the included ones may
be incorrect or not meaningful in some cases.  Here is only a part of them:

     Type  n    Meaning of the string
     
      0    1    BIOS manufacturer name
      0    2    BIOS version
      0    3    BIOS release date
      1    1    system manufacturer name
      1    2    system (product) name
      1    3    system (product) version
      1    4    system serial number
      2    1    main board manufacturer name
      2    2    main board (product) name
      2    3    main board (product) version
      2    4    main board serial number
      4    1    CPU socket designation
      4    2    CPU manufacturer name
      4    3    CPU version
;---------------------------------------------------------------------------
!TOPIC 320 @STRIP
!NOINDEX
!TTY

@STRIP[chars,string]:  Removes the characters in chars from the
string and returns the result.  For example, %@STRIP[AaEe,All Good Men]
returns "ll Good Mn".  The test is case sensitive.  To include a comma in
the chars string, enclose the entire first argument in double quotes.
@STRIP will remove the quotes before processing the string.
;---------------------------------------------------------------------------
!TOPIC 321 @SUBSTR
!NOINDEX
!TTY

@SUBSTR[string,start,length]:  This is an older, deprecated version of
291@INSTR.  The string parameter is at the start of the @SUBSTR
argument list.  If the string includes commas, it must be quoted with
quote marks ["] or back-quotes [`], or else the commas must be escaped
using the 086escape character.  The quotes do count in calculating the
position of the substring.  @INSTR, which has the string argument last,
does not have this limitation.
;---------------------------------------------------------------------------
!TOPIC 722 @SUBST
!NOINDEX
!TTY

@SUBST[n,str1, str2]:  Substitutes str1 starting at position n in str2.
;---------------------------------------------------------------------------
!TOPIC 322 @TIME
!NOINDEX
!TTY

@TIME[time]:  Returns the number of seconds since midnight for the
specified time.  The time must be in 24-hour format; "am" and "pm" cannot
be used.
;---------------------------------------------------------------------------
!TOPIC 323 @TIMER
!NOINDEX
!TTY

@TIMER[n]:  Returns the current split time for a stopwatch started with the
673TIMER command.  The value of n specifies the timer to read and can be
1, 2, or 3.
;---------------------------------------------------------------------------
!TOPIC 324 @TRIM
!NOINDEX
!TTY

@TRIM[string]:  Returns the string with the leading and trailing white
space (space and tab characters) removed.
;---------------------------------------------------------------------------
!TOPIC 325 @TRUENAME
!NOINDEX
!TTY

@TRUENAME[filename]:  Returns the true, fully-expanded name for a
file.  TRUENAME will "see through" a JOIN or SUBST, and requires
DOS 3.0 or above.  073Wildcards may not be used in the filename.

@TRUENAME can handle simple drive substitutions such as those created by
JOIN, SUBST, or most network drive mappings.  However, it may not be able to
correctly determine the true name if you use "nested" JOIN or SUBST
commands, or a network which does not report true names properly.
;---------------------------------------------------------------------------
!TOPIC 408 @TRUNCATE
!NOINDEX
!TTY

@TRUNCATE[n]:  Truncate the file opened for write access by 273@FILEOPEN
at the current position of the file pointer, where n is the value returned
by 273@FILEOPEN.  Be sure to read the cautionary note about file functions
under 241Variable Functions.
;---------------------------------------------------------------------------
!TOPIC 326 @UNIQUE
!NOINDEX
!TTY

@UNIQUE[d:\path]:  Creates a zero-length file with a unique name in the
specified directory, and returns the full name and path.  If no path is
specified, the file will be created in the current directory.  The file
name will be FAT-compatible (8 character name and 3 character extension)
regardless of whether the file is created on a FAT or LFN drive.

This function allows you to create a temporary file without overwriting an
existing file.
;---------------------------------------------------------------------------
!TOPIC 504 @UNQUOTE
!NOINDEX
!TTY

@UNQUOTE[filename]:  Returns the argument with all double quotes removed.
;---------------------------------------------------------------------------
!TOPIC 723 @UNQUOTES
!NOINDEX
!TTY

@UNQUOTES[filename]:  Returns the argument with leading and trailing double
quotes removed.
;---------------------------------------------------------------------------
!TOPIC 327 @UPPER
!NOINDEX
!TTY

@UPPER[string]:  Returns the string converted to upper case.
;---------------------------------------------------------------------------
!TOPIC 328 @WILD
!NOINDEX
!TTY

@WILD[string1,string2]:  Performs a comparison of the two strings, and
returns "1" if they match or "0" if they don't match.  The second argument,
string2, may contain wildcards or extended wildcards; the first argument,
string1, may not.  The test is not case sensitive.  The following example
tests whether the \UTIL directory (or any directory that begins with the
characters UTIL) is included in the 138PATH:

     if %@wild[%path,*\UTIL*] == 1 command
;---------------------------------------------------------------------------
!TOPIC 329 @WORD
!NOINDEX
!TTY

@WORD[["xxx",]n,string]:  Returns the nth word in the string.  The first
word is numbered 0.  If n is negative, words are returned from the end of
the string.  The first argument is a list of word separators you want to
use; if you don't specify it, only spaces, tabs, and commas are considered
to be word separators.  See also 347@FIELD.

If you want to use a double quote as a separator, prefix it with an
086escape character.  If the string argument is enclosed in quotation
marks, you must enter a list of separators.

For example:

    %@WORD[2,NOW IS THE TIME]     returns "THE"
    %@WORD[-0,NOW IS THE TIME]    returns "TIME"
    %@WORD[-2,NOW IS THE TIME]    returns "IS"
    %@WORD["=",1,2 + 2=4]         returns "4"
;---------------------------------------------------------------------------
!TOPIC 330 @WORDS
!NOINDEX
!TTY

@WORDS[["xxx",]string]:  Returns the number of words in the string.  The
first argument is a list of word separators you want to use; if you don't
specify it, only spaces, tabs, and commas are considered to be word
separators.  See also 449@FIELDS.

If you want to use a double quote as a separator, prefix it with an
086escape character.  If the string argument is enclosed in quotation
marks, you must enter a list of separators.
;---------------------------------------------------------------------------
!TOPIC 331 @XMS
!NOINDEX
!TTY

@XMS[b|k|m]:  Returns the amount of free XMS memory.
;---------------------------------------------------------------------------
!TOPIC 332 @YEAR
!NOINDEX
!TTY

@YEAR[date]:  Returns the year for the specified date.  The date may be in
either the local date format, or in ISO format with a four-digit year; see
344date formats for more information.
;---------------------------------------------------------------------------
!TOPIC 351 4DOS.INI
!NOINDEX

Part of the power of 4DOS is its flexibility.  You can alter its configuration
to match your style of computing.  Most of the configuration of 4DOS is
controlled through a file of initialization information called 4DOS.INI,
which is discussed in the following sections:

!NOWRAP
!INDENT 5 5 5 5
     353Modifying the .INI File
     354Using the .INI File
     355.INI File Sections
     356.INI File Directives
     357.INI File Examples
!INDENT 0
!WRAP

We also discuss many ways of configuring 4DOS
in other sections of the help, for example:

!INDENT 7 5 5 5
     * With 101aliases you can set default options for internal commands
     and create new commands.

     * With 082executable extensions you can associate data files with the
     applications you use to open them.

     * With the 137FILECOMPLETION environment variable and the
     429FileCompletion .INI directive you can customize filename
     completion to match the command you are working with.

     * With the 133COLORDIR environment variable and the 463ColorDir
     .INI directive you can set the colors used by the 612DIR and
     662SELECT commands.

     * With the 664SETDOS command, you can change some aspects of
     4DOS's operation "on the fly."
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 352 Starting 4DOS
!NOINDEX

There are two ways that a copy of 4DOS may be started:  it can be loaded
as a primary shell by the operating system when the system boots or
a session opens, or it can be started as a secondary shell by another
program or by running a copy of 4DOS directly from the command
line.

4DOS can be defined as the primary shell by changing a single line in the
CONFIG.SYS file.  It tells DOS to use 4DOS as the command processor instead
of COMMAND.COM.  All of the options go on one line and if you use more than
one of these fields, their order is important.

The format of this line is:

     SHELL=d:\path\4DOS.COM [d:\path] [@d:\path\inifile]
           [//iniline]... [/D] [/E:nnnn] [/F] [/L] [/LA] [/LD] [/LF] [/LH]
           [/Y] [/P[:filename]] [[/C | /K]command]

The command (at the prompt, or from within applications) to start 4DOS as
a secondary shell follows the same format, without the preceeding "SHELL=".

Replace the first "d:\path\" (immediately after SHELL=) with the 4DOS drive
and directory.  If you're using DOS, the drive and path must be correct or
your system won't boot.

The remainder of the items on this line are optional.  If they are used,
you should not include the square brackets.  In the descriptions below,
"d:" means a drive letter and "\path" means a subdirectory name.

!INDENT 5 5 5 5
     d:\path:  This is the second d:\path above (not the one immediately
     after SHELL=).  It sets the drive and directory where 4DOS is stored,
     called the COMSPEC path.  4DOS uses this path to find its files and to
     set the 134COMSPEC environment variable.

     This option is generally required for the primary shell, but not for
     secondary shells.  In some cases the primary 4DOS shell can find its
     directory automatically and this option is not needed, but we
     recommend that you use it on all primary shells to ensure that the
     directory is found.

     If you are running Windows 95/98 and you do not load 4DOS as the
     primary shell in CONFIG.SYS, you should use this option in each desktop
     object or shortcut command line to allow 4DOS to find its files.

     @d:\path\inifile:  This option sets the path and name of the
     3514DOS.INI file.  You don't need this option if you aren't
     using an .INI file at all, or if the file is called 4DOS.INI and it is
     either in the same directory as 4DOS.COM or in the root directory of the
     boot drive.

     This option is not necessary for a secondary shell if you want 4DOS to
     use the same .INI file that you used for the primary shell, because
     values from that file -- including those in its [Secondary] section --
     will be passed automatically to secondary shells.

     See 354Using the .INI File and 355.INI File Sections for more
     information.

     //iniline:  This option tells 4DOS to treat the text appearing
     between the // and the next space or tab as a .INI
     directive.  The directive should be in the same format as a line in
     4DOS.INI, but may not contain spaces, tabs, or comments.  Directives
     on the SHELL= line override any corresponding directive in
     4DOS.INI.  This is a convenient way to place one or two simple directives
     on the startup line without having to modify or create a new .INI file.

     /D:  This option disables execution of 109AUTOEXEC.BAT (or
     the file named in the 375AutoExecPath directive in 4DOS.INI or
     on the SHELL= line).  It is used internally by recent versions of DOS
     which perform a clean boot or an interactive boot by pressing F5 or
     F8 at the "Starting DOS..." prompt.

     /E:nnnn:  This option sets the size of the 131environment,
     in bytes.  If you don't use this option, 4DOS will allocate 512 bytes
     for the environment.  You can use any value from 160 to 32767 as the
     environment size.  For example, to set an environment size of 1,000
     bytes, you would enter the option as /E:1000.

     You can also set the environment size with the 377Environment
     directive in 4DOS.INI.  We recommend that you use the directive instead
     of the /E switch, so that all configuration information is kept in one
     place in the 4DOS.INI file.

     /F:  This option tells 4DOS to automatically provide a Fail
     response to all 083critical errors, without prompting or waiting
     for a user response.  It is rarely used except on systems that must
     run unattended, like bulletin boards.  We do not recommend use of
     this option on a normal system, because you will not have a chance to
     react to a critical error and correct the problem that caused it.  /F
     only affects critical errors detected by 4DOS, and will not affect
     critical error handling for many application programs which perform this
     function themselves.  It is equivalent to the directive
     562CritFail=Yes in 4DOS.INI.

     /L, /LA, /LD, /LF, and /LH:  These options force 4DOS to use a
     local alias, directory history, function, and / or command history list.
     They can be used to override any 385LocalAliases=No,
     386LocalDirHistory=No, 387LocalFunctions=No, or
     388LocalHistory=No settings in 4DOS.INI.  This allows you to use
     global lists as the default, but start a specific shell or DOS session
     with local aliases or histories.  See 033Command History and Recall
     for details on local and global history, 040Directory History Window
     for details on local and global directory history, 696FUNCTION for
     details on local and global functions, and 595ALIAS for details on
     local and global aliases.  /LA forces local aliases, /LD forces
     local directory history, /LF forces local functions, /LH forces
     local command history, and /L forces all four: local aliases, command
     history, functions, and directory history.

     /Y:  This option causes 4DOS to enable the batch file debugger for
     1094START and AUTOEXEC.BAT (or the file named in the
     375AutoExecPath directive).  It is used internally by recent
     versions of DOS which perform an interactive boot if you press F8
     at the "Starting DOS..." prompt.

     /P[:filename]:  This option tells 4DOS to load permanently and to
     run 109AUTOEXEC.BAT.  If you specify a filename after the
     /P, that file will be run instead of AUTOEXEC.BAT.

     Caution:  In order to support some multi-boot scenarios where different
     AUTOEXEC files may have non-standard file extensions (for example, under
     DR DOS 6.0 and above in conjunction with SYS /DR:ext and LOADER), 4DOS
     does not require the file extension to be only .BAT or .BTM.  But the
     specified filename must refer to an actual batch file -- no
     binary executable or data file is allowed.  You should specify the
     full name of the file, including drive and directory.  A filename after
     /P will override the 375AutoExecPath option in 4DOS.INI.

     When 4DOS is loaded from the SHELL= command in CONFIG.SYS, or as the
     shell for an OS/2 DOS session, it will normally detect that it is the
     primary shell and set the /P option automatically.  Under very rare
     circumstances, you may want to load 4DOS permanently and have it run
     AUTOEXEC even though you are not loading it from CONFIG.SYS; in such
     cases you must set /P yourself.  4DOS will not run AUTOEXEC.BAT
     without either an automatic or an explicit /P.  Do not use this
     option in secondary shells, or you will be unable to return to the
     primary shell.

     [/C | /K] command:  This option tells 4DOS to run a specific command
     after starting.  The command will be run after 4START and AUTOEXEC.BAT,
     but before displaying the prompt.  The command can be any valid alias,
     internal or external command, or batch file.  All other startup options
     must be placed before the command, because 4DOS will treat characters
     after the command as part of the command and not as additional startup
     options.

     When the command is preceded by a /C, 4DOS will execute the command
     and then exit and return to the parent program or the desktop without
     displaying a prompt.  This is sometimes called a "transient" command
     interpreter session.

     When 4DOS is started as a secondary shell (for example from the Windows
     desktop), the /K switch has no effect; using it is the same as
     placing the command (without a /C or /K) at the end of the startup
     command line.  It is included only for compatibility with COMMAND.COM.

     When you start 4DOS from the SHELL= line in MS-DOS / PC DOS 6.x and use
     /K, the command will be executed instead of AUTOEXEC.BAT (for
     compatibility with MS-DOS / PC DOS 6.x COMMAND.COM).  This behavior
     occurs only in MS-DOS / PC DOS 6.x, not in other DOS versions or
     in Windows 95/98.
!INDENT 0

If you specify a path and name for the 4DOS.INI file,
or if you use options that will override directives in 4DOS.INI, you must
place the command line options in the order in which
they are listed above.  If you do not, you may find that the command line
options do not properly override directives in 4DOS.INI.

Caution:

There is a bug in all versions of MS-DOS and PC DOS from 2.0 through
4.01:  the SHELL= line in the CONFIG.SYS file may not contain more than 31
characters following the name of the shell program (i.e., beginning with
the space after "4DOS.COM").  If the line is too long, the options will not
be passed properly to 4DOS and a variety of errors can occur.  You can set
all necessary 4DOS options without exceeding this limit, especially if you
put 4DOS.COM and 4DOS.INI in the root directory of your boot drive.  This
limit is not present in MS-DOS / PC DOS 5.0 and above, in DR-DOS, or in
OS/2.

Exit Codes

If you start 4DOS from another program as a temporary process (e.g. to
run a batch file or internal command), it will return a numeric code to
the other program when it is finished.  This code is usually used to
indicate whether the operation performed was successful or not, with
0 often indicating success and a non-zero value indicating a failure or
other numeric result.

The exit code is normally the numeric exit code from the last
external command.  Internal commands do not set the exit code.  If
you enter an unknown command the exit code will be 2, which is the
internal 4DOS unknown command error number.

You can also use the 624EXIT n command to explicitly set the exit
code.  If you do, this will override the rules above, and set the
return code to the value in your EXIT command.

The normal rules described above may not return a code that
indicates the success or failure of the specific operation that
concerns you.  Therefore, if you need to rely on the exit code from
4DOS, we recommend that you use a batch file or alias to create the
exit code you want, and then set the code explicitly with EXIT n.

Running temporary instances of 4DOS in CONFIG.SYS

Under MS-DOS / PC DOS 4.0 or above, and DR DOS 3.41 or above, you can
use the CONFIG.SYS "INSTALL=" directive to load 4DOS on a temporary
basis similar as if you were loading it from the prompt.  For example,
this can be used to execute some initial batch jobs before returning
back into normal CONFIG.SYS processing and loading some specific
TSRs.

However, since MS-DOS / PC DOS do reorder CONFIG.SYS statements, and
"INSTALL=" directives will always be executed after all other directives
except for the "SHELL=" directive, there is limited use for this feature
under these DOS versions.

DR-DOS, however, does not reorder the CONFIG.SYS directives and executes
them in the order the interpreter finds them while running through the
file.  Utilizing "INSTALL=" this feature can be used to load TSRs before
device drivers, but it can just as well be used to only load temporary
programs, and therefore allows to run batch files virtually anywhere from
within CONFIG.SYS using something like:

     ...
     install = c:\4dos\4dos.com /C batch1.bat ...
     ...
     install = c:\4dos\4dos.com /C batch2.bat ...
     ...
     shell = c:\4dos\4dos.com c:\4dos /P ...

Sometimes, this can be a very powerful and convenient feature.

If you were using this trick to run temporary instances of 4DOS via
"INSTALL=" in CONFIG.SYS, you could take advantage of some special
CONFIG.SYS directives like ONERROR, GOTO, or GOSUB supported by
DR DOS 6.0 and above to branch into different directions depending
on the exit code return by a driver or program loaded in
CONFIG.SYS.  For example, using 4DOS you could set up a nice
looking boot menu and return the user choice as exit code (in some
aspects, this advanced CONFIG.SYS syntax is similar to 4DOS batch
commands, so you may find some parallels):

     ...
     :loop
     install = c:\4dos\4dos.com /C c:\bat\bootmenu.bat
     onerror >= 3 goto loop
     onerror = 1 gosub 4dos
     onerror = 2 gosub command
     goto leave
     :4dos
     install = c:\4dos\kstack.com
     device = c:\drdos\ansi.sys
     shell = c:\4dos\4dos.com c:\4dos ... /P
     return
     :command
     install = c:\drdos\doskey.exe ...
     shell = c:\command.com c:\ ... /P
     return
     :leave
     ...
;---------------------------------------------------------------------------
!TOPIC 353 Modifying the .INI File
!NOINDEX

You can create, add to, and modify the .INI file in two ways:
with the OPTION command and by editing the file with any ASCII
editor.  OPTION displays a set of dialogs which allow you to modify
the settings that are used most often.  When you exit from the
dialogs, you can select the Save button to save your changes in
the .INI file for use in the current session and all future
sessions, select the Use or OK button to use your changes in the
current session only, or discard the changes you have made by
selecting the Cancel button.  See the 648OPTION command for
additional details.

Changes you make in the Startup section of the OPTION dialogs will
only take effect when you reboot your system (under DOS or Windows 3.xx),
or restart the session or window in which 4DOS is running (under
Windows 95/98/ME or OS/2).

OPTION handles most standard .INI file settings.  A few more advanced
settings, as well as all settings that affect the interpretation of
keystrokes, cannot be modified with OPTION and must be inserted or modified
manually.  For more details see the 648OPTION command.

You can also create, add to, and edit the .INI file "manually" with
any ASCII text editor.  4DOS reads its .INI file when it starts, and
configures itself accordingly.  The .INI file is not re-read when
you change it manually.  For manual changes to take effect, you must
reboot your system (under DOS or Windows 3.xx), or restart the
session or window in which 4DOS is running (under Windows 95/98/ME
or OS/2).  If you edit the .INI file manually, make sure you save
the file in ASCII format.

Each item that you can include in the .INI file has a default value.  You
only need to include entries in the file for settings that you want to
change from their default values.


Format

Most lines in the .INI file consist of a one-word directive, an equal sign
[=], and a value.  For example, in the following line, the word
"Environment" is the directive and "2048" is the value:

     Environment = 2048

Any spaces before or after the equal sign are ignored.

If you have a long string to enter in the .INI file (for example, for the
463ColorDir directive), you must enter it all on one line.  Strings
cannot be "continued" to a second line.  Each line may be up to 511
characters long.

The format of the value part of a directive line depends on the individual
directive.  It may be a numeric value, a single character, a choice (like
"Yes" or "No"), a color setting, a key name, a path, a filename, or a text
string.  The value begins with the first non-blank character after the equal
sign and ends at the end of the line or the beginning of a comment.

Blank lines are ignored in the .INI file and can be used to separate groups
of directives.  You can place comments in the file by beginning a line with a
semicolon [;].  You can also place comments at the end of any line except
one containing a text string value.  To do so, enter at least one space or
tab after the value, a semicolon, and your comment, like this:

     Environment = 2048     ; set standard environment size

If you try to place a comment at the end of a string value, the comment will
become part of the string and will probably cause an error.

If you use the 648OPTION dialogs to modify the .INI file, comments on
lines modified from within the dialogs will not be preserved when the
new lines are saved.  To be sure .INI file comments are preserved, put
them on separate lines in the file.

If you want to include the text of one .INI file within another (for
example, if you have a set of common directives used by several JP Software
products), see the 567Include directive.
;---------------------------------------------------------------------------
!TOPIC 354 Using the .INI File
!NOINDEX

Some settings in the .INI file are initialized when you install 4DOS, so you
will probably have a 4DOS.INI file even if you didn't create one yourself.

4DOS primary shells search for the .INI file in three places:

!INDENT 7 5 5 5
     * If there is an "@d:\path\inifile" option on the SHELL= line in
     CONFIG.SYS 4DOS will use the path and file name specified there, and
     will not look elsewhere.  See 352Starting 4DOS
     for details about the startup command line.

     * If there is no .INI file name on the SHELL= line, the search proceeds
     to the same directory where 4DOS program file
     (4DOS.COM) is stored.  This is the "normal" location for the .INI
     file.  4DOS determines this directory from the 134COMSPEC directory
     name on the SHELL= line in CONFIG.SYS.  See 352Starting 4DOS for
     details about the COMSPEC directory name.

     * If the .INI file is not found in the directory where the program file
     is stored, a final check is made in the root directory of the boot drive.
!INDENT 0

When 4DOS is loaded as a secondary shell, it does not search for the .INI
file.  Instead, it retrieves the primary shell's .INI file data, processes
the [Secondary] section of the original .INI file if necessary, and then
processes any "@d:\path\inifile" option on the secondary shell command line
(see 352Starting 4DOS for details).  You can override this behavior with
the 571NextINIFile directive.

Secondary shells automatically inherit the configuration settings currently
in effect in the previous shell.  If values have been changed by
664SETDOS since the primary shell started, the current values will be
passed to the secondary shell.  If the previous shell's .INI file had a
[Secondary] section, it will then be read and processed (see
355.INI File Sections).  If not, the previous shell's settings will
remain in effect.

For example, you might set BatchEcho to Yes in the .INI file, to enable batch
file echo.  If you then use 664SETDOS /V0 to turn off batch file echoing
in the primary shell, then any secondary shells will inherit the SETDOS
setting, rather than the original value from the .INI file; i.e., batch
files in the secondary shell will default to no echo.

If you want to force secondary shells to start with a specific value for a
particular directive, regardless of any changes made with SETDOS in a
previous shell, repeat the directive in the [Secondary] section of the
.INI file.

When you start a secondary shell (e.g. from the Windows desktop) you
can specify an alternate location and name for 4DOS.INI by passing
the "@d:\path\inifile" option to 4DOS as a command-line parameter
(see 352Starting 4DOS for details).  In this case, the
configuration settings in the alternate 4DOS.INI file will supersede
any settings inherited from the previous shell.  Any values which
are not explicitly set in the alternate file will retain the value
they had in the previous shell.

The 664SETDOS command can override several of the .INI file
directives.  For example, the cursor shape used by 4DOS can be adjusted
either with the 419CursorIns and 420CursorOver directives or the
SETDOS /S command.  The correspondence between SETDOS options and .INI
directives is noted with each directive, and under each option of the SETDOS
command.

When 4DOS detects an error while processing the .INI
file, it displays an error message and prompts you to press a key to
continue processing the file.  This allows you to note any errors before the
startup process continues.  The directive in error will retain its previous
or default value.  Only the most catastrophic errors (like a disk read
failure) will terminate processing of the remainder of the .INI file.  If
you don't want a pause after each error, use a "PauseOnError = No" directive
at the beginning of the .INI file.

If you need to test different values for an .INI directive without repeatedly
editing the .INI file, use the 648OPTION command or see the
383INIQuery directive.
;---------------------------------------------------------------------------
!TOPIC 355 .INI File Sections
!NOINDEX

The .INI file has three possible sections:  the first or global section,
named [4DOS]; the [Primary] section; and the [Secondary] section.  Each
section is identified by the section name in square brackets on a line by
itself.

Directives in the global section are effective in all shells.  In most cases,
this is the only section you will need.  Any changes you make to the .INI
file with the 648OPTION command are stored in the global section.

The [Primary] and [Secondary] sections include directives that are used
only in primary and secondary shells, respectively.  You don't need to set
up these sections unless you want different directives for primary and
secondary shells.

Directives in the [Primary] section are used for the first or primary
shell.  The values are passed automatically to all secondary shells, unless
overridden by a directive with the same name in the [Secondary] section.

Directives in the [Secondary] section are used in secondary shells only,
and override any corresponding primary shell settings.  For example, these
lines in the .INI file:

     [Primary]
     ScreenRows = 25
     [Secondary]
     ScreenRows = 50

mean to assume that you have 25 rows on the screen in the primary shell and
50 lines in all secondary shells.

Sections that begin with any name other than [4DOS], [Primary], or
[Secondary] are ignored.
;---------------------------------------------------------------------------
!TOPIC 356 .INI File Directives
!NOINDEX

For information on specific directives, see the separate topic for each
type of directive.

!NOWRAP
!INDENT 5 5 5 5
     371Initialization Directives
     410Configuration Directives
     448Color Directives
     481Key Mapping Directives
     550Advanced Directives
!INDENT 0
!WRAP

These topics list the directives, with a one-line description of each, and
a cross-reference which selects a full screen help topic on that directive.  A
few of the directives are simple enough that the one-line description is
sufficient, but in most cases you should check for any additional
information in the cross-reference topic if you are not already familiar
with the directive.

You can also obtain help on most directives with a HELP directive command
at the prompt.

There are 8 types of directives in the .INI file.  The different types of
directives are shown in the descriptions as follows:

!INDENT 7 5 5 5
     * Name = nnnn (1234):  This directive takes a numeric value which
     replaces the "nnnn."  The default value is shown in parentheses.

     * Name = c (X):  This directive accepts a single character as its
     value.  The default character is shown in parentheses.  You must type
     in the actual character; you cannot use a key name.

     * Name = CHOICE1 | Choice2 | ... :  This directive takes a choice
     value.  The possible choices are listed, separated by vertical bars.  The
     default value is shown in all upper case letters in the directive
     description, but in your file any of the choices can be entered in
     upper case or lower case.  For example, if the choices were shown as
     "YES | No" then "YES" is the default.

     * Name = Color:  This directive takes a color specification.  See
     892Colors and Color Names for the format of color names.

     * Name = Key (Default):  This directive takes a key specification.  See
     893Keys and Key Names for the format of key names.

     * Name = Path:  This directive takes a path specification, but not a
     filename.  The value should include both a drive and path (e.g., C:\4DOS)
     to avoid any possible ambiguities.  A trailing backslash [\] at the
     end of the path name is acceptable but not required.  Any default path
     is described in the text.

     * Name = File:  This directive takes a filename.  We recommend that
     you use a full filename including the drive letter and path to avoid any
     possible ambiguities.  Any default filename is described in the text.

     * Name = String:  This directive takes a string in the format
     shown.  The text describes the default value and any additional
     requirements for formatting the string correctly.  No comments are
     allowed.
!INDENT 0

4DOS contains a fixed-length area for storing strings entered in the .INI
file, including file names, paths, and other strings.  This area is large
and is unlikely to overflow; if it does, you will receive an error
message.  If this occurs, reduce the complexity of your .INI file.
;---------------------------------------------------------------------------
!TOPIC 357 .INI File Examples
!NOINDEX

The following examples will give you an idea of the types of things that can
be done with the .INI file.  The comments on each directive explain what it
does.

First, a very simple example that just sets up swapping and environment
size, leaving everything else at its default value:

     [4DOS]
     InstallPath = c:\4dos        ; Installation directory
     Swapping = ems, c:\          ; try EMS, then C: root
     Environment = 1024           ; set environment size

Here's an example for a system which supports Upper Memory blocks
(UMBs).  Several settings take advantage of UMBs, and others modify the 4DOS
configuration to match the user's preferences.  Note that the comment for the
391Swapping directive is on separate lines before the directive itself,
as no comments are allowed in string directives:

     [4DOS]
     InstallPath = c:\4dos        ; Installation directory
     Environment = 3072           ; expand environment to 3KB
     Alias = 6144                 ; expand aliases to 6KB
     LocalHistory = No            ; use a global history
                                  ; for swapping try XMS, then RAM disk H:,
                                  ; then hard disk C:
     Swapping = xms, h:\, c:\
     UMBLoad = Yes                ; resident part of 4DOS in UMB
     UMBEnvironment = Yes         ; master environment in UMB
     UMBHistory = Yes             ; global history in UMB
     BatchEcho = No               ; default is ECHO OFF
     EditMode = Insert            ; editor in insert mode
     CursorOver = 100             ; overstrike cursor 100%
     CursorIns = 10               ; insert cursor 10%
;---------------------------------------------------------------------------
!TOPIC 371 Initialization Directives
!NOINDEX

    3724StartPath            Path for 4START and 4EXIT
     373Alias                 Size of alias list
     374AutoExecParms         Parameters for AUTOEXEC.BAT
     375AutoExecPath          Path and optional file name for AUTOEXEC.BAT
     376DirHistory            Size of directory history list
     377Environment           Size of environment
     378EnvFree               Required free space in environment
     379Function              Size of function list
    380HelpOptions           Options for help system
     381HelpPath              Path to 4HELP.EXE (obsolete)
     400HistLogOn             Default history logging state
     382History               Size of history list
     383INIQuery              Query for each line in 4DOS.INI
    384InstallPath           Location of 4DOS files
     385LocalAliases          Local vs. global aliases
     386LocalDirHistory       Local vs. global directory history
     387LocalFunctions        Local vs. global functions
     388LocalHistory          Local vs. global history
     399LogOn                 Default command logging state
     389PauseOnError          Pause on errors in 4DOS.INI
    390REXXPath              Set path to PC DOS 7.0 / 2000 REXX interpreter
     391Swapping              Swapping type(s)
    392TreePath              Path for directory database
     393UMBAlias              Load global aliases in UMB
     394UMBDirHistory         Load global directory history in UMB
     395UMBEnvironment        Load master environment in UMB
     396UMBFunction           Load global functions in UMB
     397UMBHistory            Load history in UMB
     398UMBLoad               Load resident part of 4DOS in UMB


Directives marked with a  may be dynamically changed at the command line
using the 648OPTION //optname=value syntax.  If a directive does not
have this mark, it may not be meaningful to change it after 4DOS has
started.  Or there may be some simpler way to change it, e.g. options to the
643LOG or 668SWAPPING commands.  When starting a secondary copy of
4DOS, remember that you can pass directives on its command line using the
//iniline syntax; see 352Starting 4DOS for details.

Nearly all the initialization directives can be easily adjusted using the
interactive 648OPTION dialogs.  The only exceptions are the obsolete
381HelpPath, and 383INIQuery and 389PauseOnError, used to debug
.INI files.
;---------------------------------------------------------------------------
!TOPIC 400 HistLogOn
!NOINDEX
!TTY

HistLogOn = Yes | NO:  Default history logging state (see 643LOG /H.)
;---------------------------------------------------------------------------
!TOPIC 399 LogOn
!NOINDEX
!TTY

LogOn = Yes | NO:  Default command logging state (see 643LOG.)
;---------------------------------------------------------------------------
!TOPIC 372 4StartPath
!NOINDEX
!TTY

4StartPath = Path:  Sets the drive and directory where the 4START and
4EXIT batch files (if any) are located.

You can use the 648OPTION //optname=value syntax to change this setting
if you need to dynamically 797relocate 4DOS to a different drive.
;---------------------------------------------------------------------------
!TOPIC 373 Alias
!NOINDEX
!TTY

Alias = nnnn  (1024):  Sets the amount of memory in bytes allocated for
the alias list.  The allowable range of values is 256 to 32767 bytes.  If
you use a global alias list (see 595ALIAS), the Alias value is
ignored in all shells except the shell which first establishes the global
list.
;---------------------------------------------------------------------------
!TOPIC 374 AutoExecParms
!NOINDEX
!TTY

AutoExecParms = String:  Sets the parameter or parameters to be passed
to 109AUTOEXEC.BAT, or the file specified with the 375AutoExecPath
directive when 4DOS is started as a primary shell with the /P
option in 352CONFIG.SYS.  The parameters will be available in your
AUTOEXEC.BAT file as %1, %2, etc.
;---------------------------------------------------------------------------
!TOPIC 375 AutoExecPath
!NOINDEX
!TTY

AutoExecPath = Path | File:  Sets the path used to find AUTOEXEC.BAT if
4DOS is started as a primary shell with the /P option in
352CONFIG.SYS.  If you include only a path, 4DOS will look for
AUTOEXEC.BAT in the specified directory.  If you include a complete file
name, 4DOS will look for the specified file, and will not look for
AUTOEXEC.BAT.  The default is the file AUTOEXEC.BAT in the root directory
of the boot drive.
!TTY

Using AutoExecPath with a complete file name lets you store multiple
startup files in a single directory.  You may find this useful if you have
multiple boot software and use different startup files under different
configurations, or under OS/2 if you have several DOS sessions with
different startup files.  If you are running 4DOS under OS/2, using
AutoExecPath is equivalent to setting DOS_AUTOEXEC on a session's DOS
properties notebook page (see the OS/2 documentation and your Introduction
and Installation Guide for details on DOS settings).
;---------------------------------------------------------------------------
!TOPIC 376 DirHistory
!NOINDEX
!TTY

DirHistory = nnnn (256):  Sets the amount of memory allocated to the
directory history in bytes.  The allowable range of values is 256 to 2048
bytes.   If you use a global directory history list, the
DirHistory value is ignored in all shells except the shell which first
establishes the global list.
;---------------------------------------------------------------------------
!TOPIC 377 Environment
!NOINDEX
!TTY

Environment = nnnn  (512):  Sets the amount of memory allocated to the
environment in bytes.  The allowable range of values is 160 to 32767 bytes.
;---------------------------------------------------------------------------
!TOPIC 378 EnvFree
!NOINDEX
!TTY

EnvFree = nnnn  (128):  Sets the minimum amount of memory in bytes that
will be available in the environment for secondary shells.  4DOS will
enlarge the environment for each secondary shell, if necessary, so that
there is at least this much free environment space when the shell starts.  The
allowable range of values is 128 to 32767 bytes.

When launching a secondary shell, it may be useful to specify the directive
using the //iniline syntax:

   c:\4dos\4dos.com //envfree=2048 /c%_batchname

See 352Starting 4DOS for an explanation of //iniline.
;---------------------------------------------------------------------------
!TOPIC 379 Function
!NOINDEX
!TTY

Function = nnnn  (1024):  Sets the amount of memory in bytes allocated for
the function list.  The allowable range of values is 256 to 32767 bytes.  If
you use a global function list, the Function value is ignored in all shells
except the shell which first establishes the global list.
;---------------------------------------------------------------------------
;NOTE - Synch this switch information with the 4DOS Help topic
!TOPIC 380 HelpOptions
!NOINDEX
!TTY

HelpOptions = String:  Sets default options for the 4DOS help system.  The
options are:

!INDENT 5 5 0 5
   ---------------------------------------------------------------
!TOPIC 215 _SECOND
!NOINDEX
!TTY

_SECOND is the current second (0 - 59).
;--------------------------------------.

     /F:  (Full screen index) Forces the index talled, "0" if not installed and OK to
install, and "-1" if not installed and not OK to install.
;---------------------------------------------------------------------------
!TOPIC 216 _SHELL
!NOINDEX
!TTY

_SHELL is the current shell nesting level.     the Table hell is level
"0", and each subsequent secondary shell increments the level by 1.
;---------------------------------------------------------------------------
!TOPIC 238 _SHIFT
!NOINDEX
!TTY
.

     /otherwise.
;---------------------------------------------------------------------------
!TOPIC 803 _SMARTDRV
!NOINDEX
!TTY

_SMARTDRV is "1" if SMARTDRV or a compatible disk cache is installed, and
"0" otherwise.
;---------------------------------ment speed.  /S---------------------------
!TOPIC 737 _STARTPATH
!NOINDEX
!TTY

_STARTPATH is the startup directory for the current shell (not necessarily
the same as the location of the executable!).
;-------------------------------------------------------------  /X:  Disable the mouse while HELP is runninTTY

_STDERR is "1" if the standard error points to the console, and "0" if it
has been redirected.
;---------------------------------------------------------------------------
!TOPIC 367 _STDIN
!NOINDEX
!TTY

_STDIN is "1" if the standard inpu this option to disable the mouse.  (The delay with some
     ---------------------------------------------------------------------------
!TOPIC 368 _STDOUT
!NOINDEX
!TTY

_STDOUT is "1" if the standarmore information and examples, see 014Help Reference.
;---------------------------------------------------------------------------
!TOPIC 381 HelpPath
!NOINDEX
!TTY

HelpPath = Path:  This directive is obsolete.  It has been replaced by
384InstallPath.
;---------------------------------------------------------------------------
!TOPIC 382 History
!NOINDEX
!TTY

History = nnnn  (1024):  Sets the amount of memory allocated to the
command history list in bytes.  The allowable range of values is 256 to
8192 bytes.  If you use a global history list (see 033Command History
and Recall), the History value is ignored in all shells except the shell
which first establishes the global list.
;---------------------------------------------------------------------------
!TOPIC 383 INIQuery
!NOINDEX
!TTY

INIQuery = Yes | NO:  If set to Yes, a prompt will be displayed
before execution of each subsequent line in the current .INI file.  This
allows you to modify certain directives when you start 4DOS in order to
test different configurations.  INIQuery can be reset to No at any
point in the file.  Normally INIQuery = Yes is only used during testing of
other 4DOS.INI directives.
!TTY

The prompt generated by INIQuery = Yes is:

     [contents of the line]  (Y/N/Q/R/E)  ?

At this prompt, you may enter:

     Y = Yes:   Process this line and go on to the next.
     N = No:    Skip this line and go on to the next.
     Q = Quit:  Skip this line and all subsequent lines.
     R = Rest:  Execute this and all subsequent lines.
     E = Edit:  Prompt for a new value for this entry.

If you choose E for Edit, you can enter a new value for the directive, but
not a new directive name.

For example, if you have found a compatibility problem you think may be
related to 4DOS's swapping or upper memory block usage, you might change
your 4DOS.INI file so a part of it read as follows:

     INIQuery = Yes
     Swapping = XMS, EMS, C:\
     UMBLoad = Yes
     UMBEnvironment = Yes
     INIQuery = No

You could then choose to process, ignore, or edit the Swapping, 398UMBLoad,
or 395UMBEnvironment directive each time 4DOS started.  This would allow
you to test several possible combinations to see if you could resolve the
compatibility problem.
;---------------------------------------------------------------------------
!TOPIC 384 InstallPath
!NOINDEX
!TTY

InstallPath = Path:  Sets the path used to find the help system,
OPTION.EXE, and other 4DOS files.  This directive is normally set by
the installation program, and should not be changed unless you move the 4DOS
files to a different directory.

You can use the 648OPTION //optname=value syntax to change this setting
if you need to dynamically 797relocate 4DOS to a different drive.

(See also: 381HelpPath.)
;---------------------------------------------------------------------------
!TOPIC 385 LocalAliases
!NOINDEX
!TTY

LocalAliases = YES | No:  No forces all copies of 4DOS to share the
same alias list.  Yes keeps the lists for each shell separate.  See
595ALIAS for more details on local and global alias lists.
;---------------------------------------------------------------------------
!TOPIC 386 LocalDirHistory
!NOINDEX
!TTY

LocalDirHistory = YES | No:  No forces all copies of 4DOS to
share the same directory history.  Yes keeps the directory histories for
each shell separate.  See 040Directory History Window for more details on
local and global directory histories.
;---------------------------------------------------------------------------
!TOPIC 387 LocalFunctions
!NOINDEX
!TTY

LocalFunctions = YES | No:  No forces all copies of 4DOS to share the
same user-defined functions list.  Yes keeps the lists for each shell
separate.
;---------------------------------------------------------------------------
!TOPIC 388 LocalHistory
!NOINDEX
!TTY

LocalHistory = YES | No:  No forces all copies of 4DOS to share the
same history list.  Yes keeps the lists for each shell separate.  See
033Command History and Recall for more details on local and global
history lists.
;---------------------------------------------------------------------------
!TOPIC 389 PauseOnError
!NOINDEX
!TTY

PauseOnError = YES | No:  Yes forces a pause with the message
"Error in filename, press any key to continue processing" after displaying
any error message related to a specific line in 4DOS.INI.  No continues
processing with no pause after an error message is displayed.
;---------------------------------------------------------------------------
!TOPIC 390 REXXPath
!NOINDEX
!TTY

REXXPath = File:  Specifies the program that 4DOS will use to execute .BAT
files that begin with the characters [/*].  Specify a full path and
filename if the program is not in your 138PATH.

Under PC DOS 7.0 and above, REXXPath defaults to REXX.EXE, the REXX
interpreter included with the operating system.  If REXX.EXE is not in your
PATH under PC DOS 7.0 or above, you must use this directive to specify the
location of the REXX interpreter.

See 116REXX Support for more details.
;---------------------------------------------------------------------------
!TOPIC 391 Swapping
!NOINDEX
!TTY

Swapping = swap type [, swap type] ...:  Sets the type of swapping 4DOS
should use.  4DOS runs in two parts, a resident portion that is always in
memory and a transient portion that is "swapped" to EMS memory, XMS memory,
a RAM disk, or your hard disk while application programs are running.  The
swap area for the transient portion normally requires about 245K bytes of
memory or disk space for the primary shell, and 60K bytes for each
secondary shell (unless you set 575SwapReopen = Yes).
!TTY

The swap types can be any of the following:

!INDENT 5 5 5 5
     EMS:  4DOS will swap to EMS expanded memory if it is available.  You
     must have expanded memory and an EMS memory manager (version 3.2
     or later) for this option.

     XMS:  4DOS will swap to XMS extended memory if it is available.  You
     must have an an XMS memory manager and a 80286, 386, 486, Pentium,
     Pentium Pro, II, III, 4 (or compatible) class computer for this option.

     d:\path:  4DOS will create a swap file in the drive and directory
     specified.  The file will be called 4DOSSWAP.nnn where "nnn" is the
     shell number (unless you use the 576UniqueSwapName to generate a
     unique swap file name).  This swap file is created as a hidden system
     file to avoid accidental deletion and will not be visible with a
     normal DIR command.  Swapping to a RAM disk will generally be faster
     than swapping to a hard disk.  Do not use a floppy disk for swapping
     because its performance is likely to be unacceptably slow.

     If you use disk swapping in the primary shell under Windows 95/98,
     4DOS sessions run from inside Windows will not inherit aliases, .INI
     settings, functions, the command history, or the directory history
     from the primary shell.  This is due to a restriction of
     Windows 95/98.

     None:  No swapping.  The transient portion of 4DOS will remain in
     memory at all times.  This option will reduce memory available for
     application programs by about 245K compared to the other swap types,
     and should be used only when no other swapping options are available.
!INDENT 0

You can specify multiple swap types and 4DOS will try them in the order
listed.  Swap type "None" is always appended to your list of possible swap
types as a "last resort," even if you don't include it explicitly.  This
allows 4DOS to start even if the other swap types you specify don't work.

For example, if your system has EMS memory and a RAM disk set up as drive
D, the directive:

     Swapping = EMS, D:\, C:\SWAP

tells 4DOS to try EMS memory first, then the RAM disk, and finally the
\SWAP directory on drive C.  If all of these options fail (because there
isn't enough free space available), the transient portion of 4DOS will
remain in memory (swap type "None").

The default Swapping specification is:

     Swapping = EMS, XMS, x:\, None

where "x" is the boot drive (for the primary shell) or the 134COMSPEC
drive (for secondary shells).  (Disk swapping will not be included as part
of the default if the boot drive is A: or B:, because floppy disk swapping
is too slow to be useful on most systems.)

After 4DOS starts, you can use the 668SWAPPING command to view the
type of swapping in use.
;---------------------------------------------------------------------------
!TOPIC 392 TreePath
!NOINDEX
!TTY

TreePath = Path:  Sets the location of JPSTREE.IDX, the file used
for 048extended directory searches.  By default, the file is placed in
the root directory of drive C:\.
;---------------------------------------------------------------------------
!TOPIC 393 UMBAlias
!NOINDEX
!TTY

UMBAlias = Yes | NO | 1 | 2 ... | 8:  Yes attempts to load global
alias list storage into a UMB (Upper Memory Block).  If you use a specific
region number (1 through 8), 4DOS will attempt to reserve room for
the global alias list in that UMB region.
!TTY

;The two following region paragraphs have been copied to the other UMB
;directives
;
Region numbers can be used under MS-DOS / PC DOS 5.0 and above, and under
OS/2's DOS support.  To use them, you must enable DOS UMB management with
the DOS=UMB or DOS=HIGH,UMB directive in CONFIG.SYS.

If you use an invalid region number, or if region numbers have not been
enabled on your system, 4DOS will load the global alias list into the first
available region.  If no upper memory is available, space for the global
alias list will be reserved in low memory.

UMBAlias applies to global aliases only, and is only used in the first
shell which establishes the global alias area (see 595ALIAS for more
information on local and global alias lists).  If you specify
385LocalAliases = Yes, or if the previous shell already created a global
alias area, any UMBAlias setting is ignored.
;---------------------------------------------------------------------------
!TOPIC 394 UMBDirHistory
!NOINDEX
!TTY

UMBDirHistory = Yes | NO | 1 | 2 ... | 8:  Yes attempts to load global
directory history list storage into a UMB (Upper Memory Block).  See
040Directory History Window for more details on local and global
directory histories.

Region numbers can be used under MS-DOS / PC DOS 5.0 and above, and under
OS/2's DOS support.  To use them, you must enable DOS UMB management with
the DOS=UMB or DOS=HIGH,UMB directive in CONFIG.SYS.

If you use an invalid region number, or if region numbers have not been
enabled on your system, 4DOS will load the global directory history list
into the first available region.  If no upper memory is available, space for
the global directory history list will be reserved in low memory.

UMBDirHistory applies to global directory history only, and is only used in
the first shell which establishes the global directory history area (see
040Directory History Window for more information on local and global
directory history lists).  If you specify 386LocalDirHistory = Yes, or if
the previous shell already created a global directory history area, any
UMBDirHistory setting is ignored.
;---------------------------------------------------------------------------
!TOPIC 395 UMBEnvironment
!NOINDEX
!TTY

UMBEnvironment = Yes | NO | 1 | 2 ... | 8:  Yes attempts to load
the master environment into a UMB (Upper Memory Block).  This reduces
4DOS's base memory requirements but may cause problems with some programs
that try to access the master environment directly.

Region numbers can be used under MS-DOS / PC DOS 5.0 and above, and under
OS/2's DOS support.  To use them, you must enable DOS UMB management with
the DOS=UMB or DOS=HIGH,UMB directive in CONFIG.SYS.

If you use an invalid region number, or if region numbers have not been
enabled on your system, 4DOS will load the environment into the first
available region.  If no upper memory is available, space for the environment
will be reserved in low memory.
;---------------------------------------------------------------------------
!TOPIC 396 UMBFunction
!NOINDEX
!TTY

UMBFunction = Yes | NO | 1 | 2 ... | 8:  Yes attempts to load global
function list storage into a UMB (Upper Memory Block).  If you use a
specific region number (1 through 8), 4DOS will attempt to reserve room for
the global function list in that UMB region.

Region numbers can be used under MS-DOS / PC DOS 5.0 and above, and under
OS/2's DOS support.  To use them, you must enable DOS UMB management with
the DOS=UMB or DOS=HIGH,UMB directive in CONFIG.SYS.

If you use an invalid region number, or if region numbers have not been
enabled on your system, 4DOS will load the function list into the first
available region.  If no upper memory is available, space for the function
list will be reserved in low memory.

UMBFunction applies to global functions only, and is only used in the
first shell which establishes the global function area.  If you specify
385LocalFunctions = Yes, or if the previous shell already created a 
global function area, any UMBFunction setting is ignored.
;---------------------------------------------------------------------------
!TOPIC 397 UMBHistory
!NOINDEX
!TTY

UMBHistory = Yes | NO | 1 | 2 ... | 8:  Yes attempts to load global
history list storage into a UMB (Upper Memory Block).  If you use a
specific region number (1 through 8), 4DOS will attempt to reserve room for
the global history list in that UMB region.

Region numbers can be used under MS-DOS / PC DOS 5.0 and above, and under
OS/2's DOS support.  To use them, you must enable DOS UMB management with
the DOS=UMB or DOS=HIGH,UMB directive in CONFIG.SYS.

If you use an invalid region number, or if region numbers have not been
enabled on your system, 4DOS will load the history list into the first
available region.  If no upper memory is available, space for the history list
will be reserved in low memory.

UMBHistory applies to global history only, and is only used in the
first shell which establishes the global history area (see
033Command History and Recall for more information on local and global
history lists).  If you specify 388LocalHistory = Yes, or if
the previous shell already created a global history area, any UMBHistory
setting is ignored.
;---------------------------------------------------------------------------
!TOPIC 398 UMBLoad
!NOINDEX
!TTY

UMBLoad = Yes | NO | 1 | 2 ... | 8:  Yes attempts to load the
resident portion of 4DOS into a UMB (Upper Memory Block).  This reduces the
size of the resident portion in base memory from about 3K bytes to 256
bytes.

Region numbers can be used under MS-DOS / PC DOS 5.0 and above, and under
OS/2's DOS support.  To use them, you must enable DOS UMB management with
the DOS=UMB or DOS=HIGH,UMB directive in CONFIG.SYS.

If you use an invalid region number, or if region numbers have not been
enabled on your system, 4DOS will load it's resident portion into the first
available region.  If no upper memory is available, space for the resident
portion will be reserved in low memory.
;---------------------------------------------------------------------------
!TOPIC 410 Configuration Directives
!NOINDEX

    411AmPm                  Time display format
     412ANSI                  ANSI driver state
    413AppendToDir           "\" on directory names in filename completion
     414BatchEcho             Default batch file echo state
    415BeepFreq              Default beep frequency
    416BeepLength            Default beep length
    417CDDWinHeight          Position and size of the popup window used
    417CDDWinLeft               by extended directory searches
    417CDDWinTop                          "
    417CDDWinWidth                        "
     418CommandSep            Multiple command separator character
    472CompleteHidden        Filename completion of hidden/system files
    450CopyPrompt            Prompt before overwriting existing files
     419CursorIns             Cursor shape in insert mode
     420CursorOver            Cursor shape in overstrike mode
     421DecimalChar           Decimal separator
    422DescriptionMax        Maximum length of file descriptions
     423DescriptionName       Name of file to hold file descriptions
     424Descriptions          Enable / disable description processing
     425EditMode              Editing mode (insert / overstrike)
     426EscapeChar            4DOS escape character
     427EvalMax               Max digits after decimal point in @EVAL
     428EvalMin               Min digits after decimal point in @EVAL
     429FileCompletion        Filename completion by extension
    430FuzzyCD               Selects Extended Directory Search mode
    431HistCopy              History copy mode
    451HistDups              History duplicate removal
     432HistLogName           History log file name
    433HistMin               Minimum command length to save
    434HistMove              History move mode
    435HistWrap              History wrap mode
     436LineInput             Enable / disable line input mode
    475ListRowStart          Starting row number for LIST and FFIND
    473LogErrors             Write errors to log file
     437LogName               Log file name
     474Mouse                 Enable / disable mouse for popup boxes
     438NoClobber             Overwrite protection for output redirection
     439ParameterChar         Alias / function / batch file parameter character
    477PathExt               Enable or disable the PATHEXT variable
    440PopupWinHeight        Position and size of the popup windows used
    440PopupWinLeft             for the command history, directory history,
    440PopupWinTop              and filename completion
    440PopupWinWidth                      "
    441Printer               LIST print device
    442ScreenColumns         Screen width
    443ScreenRows            Screen height
    444TabStops              Tab width in LIST
     445ThousandsChar         Thousands separator
    476UnixPaths             Enable or disable slash in command paths
     446UpperCase             Force file names to upper case
    447Win95SFNSearch        Control short filename search


Directives marked with a  may be dynamically changed at the command line
using the 648OPTION //optname=value syntax.  If a directive does not
have this mark there is probably some simpler way to change it, such as
options to the 664SETDOS or 643LOG command, or the 137FILECOMPLETION
environment variable.

Most of the configuration directives can be easily adjusted using the
interactive 648OPTION dialogs.  The exceptions are 423DescriptionName,
436LineInput, 475ListRowStart, and 477PathExt.
;---------------------------------------------------------------------------
!TOPIC 411 AmPm
!NOINDEX
!TTY

AmPm = Yes | NO | Auto:  Yes displays times in 12-hour format with
a trailing "a" for AM or "p" for PM.  The default of No forces a
display in 24-hour time format.  Auto formats the time according to the
country code set for your system.  AmPm controls the time displays used by
612DIR and 662SELECT, in 643LOG files, and the output of
the 673TIMER, 608DATE, and 672TIME commands.  It has no
effect on 219%_TIME, 303%@MAKETIME, the $t and $T options of
652PROMPT, or date and time 074ranges.
;---------------------------------------------------------------------------
!TOPIC 412 ANSI
!NOINDEX
!TTY

ANSI = AUTO | Yes | No:  Tells 4DOS whether an ANSI driver is installed
and should be used for the 604CLS and 605COLOR commands.  4DOS
normally determines this itself, but if you are using a non-standard
842ANSI driver or your loading sequence is unusual, you may need to
explicitly inform 4DOS.  Also see 664SETDOS /A.
;---------------------------------------------------------------------------
!TOPIC 413 AppendToDir
!NOINDEX
!TTY

AppendToDir = Yes | NO:  If set to Yes, a trailing "\" will be
appended to directory names when doing filename completion.  The
default is No.  (Regardless of the setting of this directive, a trailing
backslash is always appended to a directory name at the beginning of the
command line to enable automatic directory changes.)
;---------------------------------------------------------------------------
!TOPIC 414 BatchEcho
!NOINDEX
!TTY

BatchEcho = YES | No:  Sets the default batch echo mode.  Yes
enables echoing of all batch file commands unless 619ECHO is
explicitly set off in the batch file.  No disables batch file echoing
unless ECHO is explicitly set on.  Also see 664SETDOS /V.
;---------------------------------------------------------------------------
!TOPIC 415 BeepFreq
!NOINDEX
!TTY

BeepFreq = nnnn  (440):  Sets the default 597BEEP command
frequency in Hz.  This is also the frequency for "error" beeps (for
example, if you press an illegal key).  To disable all error beeps set this
or 416BeepLength to 0.  If you do, the BEEP command will not produce
sound unless you explicitly specify a frequency and duration.
;---------------------------------------------------------------------------
!TOPIC 416 BeepLength
!NOINDEX
!TTY

BeepLength = nnnn  (2):  Sets the default 597BEEP length in
system clock ticks (approximately 1/18 of a second per tick).  BeepLength
is also the default length for "error" beeps (for example, if you press an
illegal key).  To disable all error beeps set this or 415BeepFreq to
0.  If you do, the BEEP command will not produce sound unless you explicitly
specify a frequency and duration.
;---------------------------------------------------------------------------
!TOPIC 417 CDDWin Directives
!NOINDEX
!TTY

CDDWinLeft = nnnn, CDDWinTop = nnnn, CDDWinWidth = nnnn,
CDDWinHeight = nnnn:  These numeric values set the position and size of
the popup window used by 048extended directory searches, in characters,
including the border.  The defaults are 3, 3, 72, and 16, respectively
(i.e., a window
beginning in column 3, row 3, 72 columns wide and 16 rows high).  The
position is relative to the top left corner of the screen.  The width and
height values include the space required for the window border.  The window
cannot be smaller than than 10 columns wide by 5 rows high (including the
border).  The values you enter will be adjusted if necessary to keep a
minimum-size window visible on the screen.

The window is normally displayed with a shadow, but if you specify a window
starting at column 0 and extending to the right margin, the shadow is
eliminated; this may be useful to prevent speech software from reading text
in the shadow area while viewing the window.
;---------------------------------------------------------------------------
!TOPIC 418 CommandSep
!NOINDEX
!TTY

CommandSep = c (^):  This is the character used to separate 041multiple
commands on the same line.  The default is the caret [^].  You cannot
use any of the redirection characters [<>|] or any of the
whitespace characters (space, tab, comma, or equal sign).  The command
separator is saved by 665SETLOCAL and restored by 621ENDLOCAL.

Also see 664SETDOS /C, the 166%+ internal variable,
and 054Special Character Compatibility for information on using
compatible command separators for two or more products.
;---------------------------------------------------------------------------
!TOPIC 472 CompleteHidden
!NOINDEX
!TTY

CompleteHidden = Yes | NO:  If set to YES, filename completion will
return hidden and system files and directories, and CDD /S will include
hidden directories when indexing.
;---------------------------------------------------------------------------
!TOPIC 450 CopyPrompt
!NOINDEX
!TTY

CopyPrompt = Yes | NO:  If set to Yes, a 606COPY or 646MOVE will
prompt before overwriting an existing file if the command is being performed
at the command prompt.  This duplicates the behavior of later versions of
COMMAND.COM and CMD.EXE.  See also the environment variable 135COPYCMD.
;---------------------------------------------------------------------------
!TOPIC 419 CursorIns
!NOINDEX
!TTY

CursorIns = nnnn  (100):  This is the shape of the cursor for insert mode
during command-line editing and all commands which accept line input
(DESCRIBE, ESET, etc.).  The size is a percentage of the total character
cell size, between 0% and 100%.  Because of the way video BIOSes and drivers
map the cursor shape, you may not get a smooth progression in cursor shapes
as CursorIns and CursorOver change.

If CursorIns or CursorOver is set to -1, 4DOS will not
attempt to modify the cursor shape at all; you can use this feature to give
another program full control of the cursor shape.

Also see 420CursorOver and 664SETDOS /S.
;---------------------------------------------------------------------------
!TOPIC 420 CursorOver
!NOINDEX
!TTY

CursorOver = nnnn  (15):  This is the shape of the cursor for overstrike
mode during command-line editing and all commands which accept line
input.  The size is a percentage of the total character cell size, between
0% and 100%.

Also see 419CursorIns and 664SETDOS /S.
;---------------------------------------------------------------------------
!TOPIC 421 DecimalChar
!NOINDEX
!TTY

DecimalChar = . | , | AUTO:  Sets the character used as the decimal
separator for 263@EVAL, numeric 633IF and 634IFF tests, version
numbers, and other similar uses.  The only valid settings are period [.],
comma [,], and Auto (the default).  A setting of Auto tells 4DOS
to use the decimal separator associated with your current country
code.  If you change the decimal character you must also adjust the
thousands character (with 445ThousandsChar) so that the two characters
are different.

Also see 664SETDOS /G.
;---------------------------------------------------------------------------
!TOPIC 422 DescriptionMax
!NOINDEX
!TTY

DescriptionMax = nnnn (40):  Controls the description length limit for
611DESCRIBE.  The allowable range is 20 to 511 characters.
;---------------------------------------------------------------------------
!TOPIC 423 DescriptionName
!NOINDEX
!TTY

DescriptionName = File: Sets the file name in which to store file
descriptions.  The default file name is DESCRIPT.ION.  Use this directive
with caution because changing the name from the default will make it
difficult to transfer file descriptions to another system.

Also see 664SETDOS /D.
;---------------------------------------------------------------------------
!TOPIC 424 Descriptions
!NOINDEX
!TTY

Descriptions = YES | No:  Turns description handling on or off during
the file processing commands COPY, DEL, MOVE, and REN.  If set to No,
4DOS will not update the description file when files are moved, copied,
deleted or renamed.  Also see 664SETDOS /D.
;---------------------------------------------------------------------------
!TOPIC 425 EditMode
!NOINDEX
!TTY

EditMode = Insert | OVERSTRIKE | InitOverstrike | InitInsert:  This
directive lets you start the command-line editor in either Insert or
Overstrike mode. If you specify InitOverstrike or InitInsert, the command
line editor will start in the specified state, but if you toggle insert
mode while editing a line, the editor will continue to use the new mode
on subsequent lines.  Also see 664SETDOS /M.
;---------------------------------------------------------------------------
!TOPIC 426 EscapeChar
!NOINDEX
!TTY

EscapeChar = c (Ctrl-X):  Sets the character used to suppress the
normal meaning of the following character.  The default is
Ctrl-X [<Ctrl-X>].  See 086Escape Character for a description of special escape
sequences.  You cannot use any of the redirection characters
[<>|] or the whitespace characters (space, tab, comma,
or equal sign) as the escape character.  The escape character is saved by
665SETLOCAL and restored by 621ENDLOCAL.

Also see 664SETDOS /E, the 165%= internal variable, and 054Special
Character Compatibility for information on using
compatible escape characters for two or more products.
;---------------------------------------------------------------------------
!TOPIC 427 EvalMax
!NOINDEX
!TTY

EvalMax = nnnn (10):  Controls the maximum number of digits after
the decimal point in values returned by 263@EVAL.  This setting
can be overridden with the construct @EVAL[expression=n.n].  The
allowable range is 0 to 10.  Also see 664SETDOS /F.
;---------------------------------------------------------------------------
!TOPIC 428 EvalMin
!NOINDEX
!TTY

EvalMin = nnnn (0):  Controls the minimum number of digits after
the decimal point in values returned by 263@EVAL.  The allowable
range is 0 to 10.  This directive will be ignored if EvalMin is
larger than 427EvalMax.  This setting can be overridden with the
construct @EVAL[expression=n.n].  Also see 664SETDOS /F.
;---------------------------------------------------------------------------
!TOPIC 429 FileCompletion
!NOINDEX
!TTY

FileCompletion = cmd1: ext1 ext2 ...; cmd2: ext3 ext4 ...  Sets the files
made available during 035filename completion for selected commands.  The
format is the same as that used for the 137FILECOMPLETION environment
variable.
;---------------------------------------------------------------------------
!TOPIC 430 FuzzyCD
!NOINDEX
!TTY

FuzzyCD = 0 | 1 | 2 | 3:  Enables or disables extended directory searches,
and controls their behavior.  A setting of 0 (the default) disables extended
searches.  For complete details on the meaning of the other settings see
048Extended Directory Searches.
;---------------------------------------------------------------------------
!TOPIC 431 HistCopy
!NOINDEX
!TTY

HistCopy = Yes | NO:  Controls what happens when you re-execute a line
from the command history.  If this option is set to Yes, the line is
appended to the end of the history list.  By default, or if this option is
set to No, the command is not copied.  The original copy of the
command is retained at its original position in the list, regardless
of the setting of HistCopy.

Set this option to No if you want to use 434HistMove = Yes; otherwise,
the HistCopy setting will override HistMove.
;---------------------------------------------------------------------------
!TOPIC 451 HistDups
!NOINDEX
!TTY

HistDups = OFF | First | Last:  Controls the history list duplicate
removal.  If this option is set to First, and a new entry matches an older 
one, the old entry is preserved and the new entry discarded.  If set to 
Last, the new entry is saved and the old entry deleted.  If set to Off,
everything is saved to the history.
;---------------------------------------------------------------------------
!TOPIC 432 HistLogName
!NOINDEX
!TTY

HistLogName = File:  Sets the history log file name, and optionally its
location.  If no path is specified, the history log will be created in the
root directory of the boot drive.  Using HistLogName does not turn history
logging on; you must use a 643LOG /H ON command to do so.

You can use the 648OPTION //optname=value syntax to change this setting
if you need to dynamically 797relocate 4DOS to a different drive.
;---------------------------------------------------------------------------
!TOPIC 433 HistMin
!NOINDEX
!TTY

HistMin = nnnn  (0):  Sets the minimum command-line size to save in the
command history list.  Any command line whose length is less than this
value will not be saved.  Legal values range from 0, which saves
everything, to 256.  You can prevent any command line from being saved in
the history by beginning it with an at sign [@].

See also 033Command History and Recall, the 034Command History Window,
and the 632HISTORY command.
;---------------------------------------------------------------------------
!TOPIC 434 HistMove
!NOINDEX
!TTY

HistMove = Yes | NO:  If set to Yes, a recalled line is moved to the end
of the command history.  The difference between this directive and
431HistCopy is that HistCopy = Yes copies each recalled line to
the end of the history but leaves the original in place.  HistMove = Yes
places the line at the end of history and removes the original line.

This directive has no effect if HistCopy = Yes.
;---------------------------------------------------------------------------
!TOPIC 435 HistWrap
!NOINDEX
!TTY

HistWrap = YES | No:  Controls whether the command history recall "wraps"
when you reach the top or bottom of the list.  The default setting enables
wrapping, so the list appears "circular."  If HistWrap is set to No, history
recall will stop at the beginning and end of the list rather than
wrapping.  This setting affects history recall at the prompt only; the
command history window never wraps.
;---------------------------------------------------------------------------
!TOPIC 436 LineInput
!NOINDEX
!TTY

LineInput = Yes | NO:  This directive controls how 4DOS gets its input
from the command line.  Yes forces 4DOS to perform line-by-line input,
just as COMMAND.COM and CMD.EXE do, instead of character-by-character
input.  This will disable command-line editing, history recall, the
directory history window, and filename completion.  It is normally used
only for rare memory-resident programs (TSRs) or applications which do not
work properly unless 4DOS uses line input.  If you have a particular
program that requires line input, you can use 664SETDOS /L to
temporarily change modes.

See 751Compatibility for information on any programs which require this
option.
;---------------------------------------------------------------------------
!TOPIC 475 ListRowStart
!NOINDEX
!TTY

ListRowStart = 1 | 0:  Specifies whether 640LIST and 625FFIND consider
the first line in the file to be line "1" or line "0".  The default is "1".
;---------------------------------------------------------------------------
!TOPIC 473 LogErrors
!NOINDEX
!TTY

LogErrors = Yes | NO:  If set to Yes, error messages will be written to
the log file.
;---------------------------------------------------------------------------
!TOPIC 437 LogName
!NOINDEX
!TTY

LogName = File:  Sets the log file name, and optionally its location.  If
no path is specified, the log file will be created in the root directory of
the boot drive.  Using LogName does not turn logging on; you must use a
643LOG ON command to do so.

You can use the 648OPTION //optname=value syntax to change this setting
if you need to dynamically 797relocate 4DOS to a different drive.
;---------------------------------------------------------------------------
!TOPIC 474 Mouse
!NOINDEX
!TTY

Mouse = AUTO | yes | no:  Specifies whether a mouse is available for
popup boxes.  If you don't have a mouse, or if the driver takes a long
time for the query/reset call, you should explicitly set this value to No.
;---------------------------------------------------------------------------
!TOPIC 438 NoClobber
!NOINDEX
!TTY

NoClobber = Yes | NO:  If set to Yes, will prevent standard output
050redirection from overwriting an existing file, and will require
that the output file already exist for append redirection.

Also see 664SETDOS /N.
;---------------------------------------------------------------------------
!TOPIC 439 ParameterChar
!NOINDEX
!TTY

ParameterChar = c (&):  Sets the character used after a percent sign to
specify all or all remaining command-line arguments in a batch file, alias,
or user-defined function (e.g., %& or %n&; see 102Batch Files,
595ALIAS, and 696FUNCTION).  The default is the ampersand [&].
The parameter character is saved by 665SETLOCAL and restored by
621ENDLOCAL.

Also see 664SETDOS /P.  See 054Special Character Compatibility for
information on using compatible parameter characters for two or more
products.
;---------------------------------------------------------------------------
!TOPIC 477 PathExt
!NOINDEX
!TTY

PathExt = NO | Yes:  Determines whether 4DOS will use the PATHEXT
environment variable.  If set to No (the default), the PATHEXT variable
is ignored.  If set to Yes, the PATHEXT variable will be used to
determine extensions to look for when searching the 138PATH for an
executable file.  For details, see the 143PATHEXT variable and the
649PATH command.

Cs range from 0, which saves
everything, to 256.  You can prevent any command line from being saved in
the history by beginning it with an at sign [@].

See also 0
PATHEXT is supported for compatibility reasons but should not generally
be used as a substitute for the more flexible 082executable
extensions feature.
;---------------------------------------------------------------------------
!TOPIC 440 PopupWin Directives
!NOINDEX
!TTY

PopupWinLeft = nnnn, PopupWinTop = nnnn, PopupWinWidth = nnnn,
PopupWinHeight = nnnn:  These numeric values set the position and size of
the command-line, directory history, and filename completion windows, and
most other popup windows (see 417CDDWinLeft etc. for the extended directory
search window).  The values are in characters, and include the border.

The defaults are 40, 1, 36, and 12 respectively (i.e., a window beginning in
column 40, row 1, 36 columns wide and 12 rows high).  The position is
relative to the top left corner of the screen.  The width and height values
include the space required for the window border.  The window cannot be
smaller than than 10 columns wide by 5 rows high (including the border).  The
values you enter will be adjusted if necessary to keep a minimum-size window
visible on the screen.

The window is normally displayed with a shadow, but if you specify a window
starting at column 0 and extending to the right margin, the shadow is
eliminated; this may be useful to prevent speech software from reading text
in the shadow area while viewing the window.
;---------------------------------------------------------------------------
!TOPIC 441 Printer
!NOINDEX
!TTY

Printer = devicename:  Sets the output device that the 640LIST
command will print to.  By default, LPT1 is used.  The device can be PRN,
LPT1 to 3, AUX, COM1 to 4, NUL (which will disable printed output) or
any other installed character device (for example, some systems also
support LPT4 or COM ports above 4).

PRN usually defaults to LPT1 and AUX to COM1, but on some systems you
can override these settings (for example, under DR-DOS 7.02+ you can
change them with the PRN=0 | 1..3 and AUX=0 | 1..4 CONFIG.SYS directives.)
;---------------------------------------------------------------------------
!TOPIC 442 ScreenColumns
!NOINDEX
!TTY

ScreenColumns = nnnn:  Sets the number of columns used by the video
display.  Normally the screen size is determined automatically, but if you
have a non-standard display you may need to set it explicitly.  Systems
which need to set 572OutputBIOS to Yes may also need to use this
directive.
;---------------------------------------------------------------------------
!TOPIC 443 ScreenRows
!NOINDEX
!TTY

ScreenRows = nnnn:  Sets the number of screen rows used by the video
display.  Normally the screen size is determined automatically, but if you
have a non-standard display you may need to set it explicitly.  This value
does not affect screen scrolling, which is controlled by your video BIOS or
842ANSI driver.  ScreenRows is used only by the 640LIST and
662SELECT commands, the paged output options of other commands (e.g.,
TYPE /P), and error checking in the screen output commands.  Also see
664SETDOS /R.
;---------------------------------------------------------------------------
!TOPIC 444 TabStops
!NOINDEX
!TTY

TabStops = nnnn (8):  Sets the tab stops for files displayed with the
640LIST command.  Setting TabStops=3, for example, will place a tab stop
in every third column.  The allowable range is 1 to 32.
;---------------------------------------------------------------------------
!TOPIC 445 ThousandsChar
!NOINDEX
!TTY

ThousandsChar = . | , | AUTO:  Sets the character used as the thousands
separator for numeric output.  The only valid settings are period [.],
comma [,], and Auto (the default).  A setting of Auto tells 4DOS
to use the thousands separator associated with your current country
code.  If you change the thousands character you must also adjust the decimal
character (with DecimalChar, see above) so that the two characters are
different.

Also see 664SETDOS /G.
;---------------------------------------------------------------------------
!TOPIC 476 UnixPaths
!NOINDEX
!TTY

UnixPaths = Yes | NO:  Enables the forward slash as a path separator
in the command name (the first item on the command line).  This allows
you to enter a command like:

     c:\> /bin/programs/foo.exe

without having the forward slashes interpreted as switch characters.  Note
that setting UnixPaths to Yes does not change the 4DOS or operating system
switch character ('/' by default, unless changed by 664SETDOS /W).  It
simply allows you to put forward slashes in the command name without
problems.

When UnixPaths is set to Yes command switches beginning with a forward
slash must be preceded by a space to avoid confusion (this is a good
general practice regardless of the setting of UnixPaths).  For example:

     c:\> \bin\foo.exe /c        OK
     c:\> /bin/foo.exe /c        OK
     c:\> \bin\foo.exe/c         Error
     c:\> /bin/foo.exe/c         Error
;---------------------------------------------------------------------------
!TOPIC 446 UpperCase
!NOINDEX
!TTY

UpperCase = Yes | NO:  Yes specifies that file and directory names
should be displayed in the traditional upper-case by internal commands like
COPY and DIR.  No allows the normal 4DOS lower-case style.  This
directive does not affect the display of filenames on drives which support
long filenames (see 945File Names for additional details).

Also see 664SETDOS /U.
;---------------------------------------------------------------------------
!TOPIC 447 Win95SFNSearch
!NOINDEX
!TTY

Win95SFNSearch = YES | No:  Set to No to disable the automatic search
for short filenames after long filenames in Windows 95/98/ME.  See
081LFN File Searches.
;---------------------------------------------------------------------------
!TOPIC 448 Color Directives
!NOINDEX

     461BrightBG              Bright background colors
    462CDDWinColors          Directory change window colors
     463ColorDir              Directory colors
    465InputColors           Input colors
    466ListboxBarColors      Light bar color in list boxes
    467ListColors            LIST display colors
    468ListStatBarColors     LIST status bar colors
    464PopupWinColors        Popup window colors
    469SelectColors          SELECT display colors
    470SelectStatBarColors   SELECT status bar colors
    471StdColors             Standard display colors


Directives marked with a  may be dynamically changed at the command line
using the 648OPTION //optname=value syntax.  Bright backgrounds or
blinking can be selected with 664SETDOS /B; the 133COLORDIR variable
provides an easy way to redefine directory colorization on the fly.

All of the color directives except for 466ListboxBarColors can be easily
adjusted using the interactive 648OPTION dialogs.
;---------------------------------------------------------------------------
!TOPIC 461 BrightBG
!NOINDEX
!TTY

BrightBG = Yes | No.  If set to Yes, 4DOS will enable bright
background colors.  If set to No, bright backgrounds will be disabled,
but blinking foreground characters will be enabled.  If BrightBG is not
used, 4DOS will not adjust the bright background / blinking foreground
switch at all.  Most color video boards default to a blinking foreground
with bright background colors disabled.  See also 664SETDOS /B.
!TTY

Using BrightBG requires careful attention to interactions of display type,
mode, and color.  For a detailed explanation, see 892Colors and Color
Names.
;---------------------------------------------------------------------------
!TOPIC 462 CDDWinColors
!NOINDEX
!TTY

CDDWinColors = Color:  Sets the default colors for the
popup window used by 048extended directory searches.  If this directive
is not used, the colors will be reversed from the current colors on the
screen.
;---------------------------------------------------------------------------
!TOPIC 463 ColorDir
!NOINDEX
!TTY

ColorDir = ext1 ext2 ...:colora;ext3 ext4 ... :colorb; ...:  Sets the
directory colors used by 612DIR and 662SELECT.  The format is the same
as that used for the 133COLORDIR environment variable.  See the
discussion of color-coded directories under DIR for more details.
;---------------------------------------------------------------------------
!TOPIC 465 InputColors
!NOINDEX
!TTY

InputColors = Color:  Sets the colors used for command-line input.  This
setting is useful for making your input stand out from the normal
output.  InputColors will not work properly unless you have
an ANSI driver loaded (see 842ANSI Drivers for more information).
;---------------------------------------------------------------------------
!TOPIC 466 ListboxBarColors
!NOINDEX
!TTY

ListboxBarColors = Color:  Sets the color for the highlight bar in the
popup list boxes (i.e., 034command history window,
035filename completion window, 318@SELECT window, etc.).
;---------------------------------------------------------------------------
!TOPIC 467 ListColors
!NOINDEX
!TTY

ListColors = Color:  Sets the colors used by the 640LIST command.  If
this directive is not used, LIST will use the current default colors set
by the 604CLS or 605COLOR command or by the 471StdColors
directive.
;---------------------------------------------------------------------------
!TOPIC 468 ListStatBarColors
!NOINDEX
!TTY

ListStatBarColors = Color:  Sets the colors used on the 640LIST
status bar.  If this directive is not used, LIST will set the status bar to
the reverse of the screen color (the screen color is controlled by
467ListColors).
;---------------------------------------------------------------------------
!TOPIC 464 PopupWinColors
!NOINDEX
!TTY

PopupWinColors = Color:  Sets the default colors for the command-line,
directory history, and filename completion windows, and most other popup
windows (see 462CDDWinColors for the extended directory search
window).  If this directive is not used the colors will be reversed from
the current colors on the screen.
;---------------------------------------------------------------------------
!TOPIC 469 SelectColors
!NOINDEX
!TTY

SelectColors = Color:  Sets the color used by the 662SELECT
command.  If this directive is not used, SELECT will use the current
default colors set by the 604CLS or 605COLOR command or by the
471StdColors directive.
;---------------------------------------------------------------------------
!TOPIC 470 SelectStatBarColors
!NOINDEX
!TTY

SelectStatBarColors = Color:  Sets the color used on the
662SELECT status bar.  If this directive is not used, SELECT will set
the status bar to the reverse of the screen color (the screen color is
controlled by 469SelectColors).
;---------------------------------------------------------------------------
!TOPIC 471 StdColors
!NOINDEX
!TTY

StdColors = Color:  Sets the standard colors to be used when
604CLS is used without a color specification, and for 640LIST
and 662SELECT if 467ListColors and 469SelectColors are
not used.  Using this directive is similar to placing a 605COLOR
command in AUTOEXEC.BAT or 4START.  StdColors takes effect the first time
604CLS, LIST, or SELECT is used after 4DOS starts, but will not affect
the color of error or other messages displayed during the loading and
initialization process.  If 842ANSI.SYS or a compatible driver is not
loaded, the colors will not be "sticky" -- you may lose them when you run
an application.
;---------------------------------------------------------------------------
!TOPIC 481 Key Mapping Directives
!NOINDEX

These directives allow you to change the keys used for command-line editing
and other internal functions.  They are divided into four types:

!INDENT 5 5 5 5
     General Input Keys apply to all input.  They are in effect whenever 4DOS
     requests input from the keyboard, including during 032command-line
     editing and the 611DESCRIBE, 622ESET, 636INPUT,
     640LIST, and 662SELECT commands.

     Command-Line Editing Keys apply only to command-line editing, and are only
     effective at the 4DOS prompt.

     Popup Window Keys apply to popup windows, including the
     034command history window, the 040directory history window, the
     035filename completion window, the 048extended directory search
     window, and the 318@SELECT window.

     LIST Keys are effective only inside the 640LIST command.
!INDENT 0

This topic lists all the key mapping directives, divided by type.  It
includes a one-line description of each directive, and a cross-reference
which selects a full screen help topic on that directive.  Most of the
directives are simple enough that the one-line description is sufficient if
you are generally familiar with how key mapping works.  However, for those
directives marked with an asterisk [*], the cross-reference topic
contains some additional information you may wish to review.  You can also
obtain help on any directive with a HELP directive command at the
prompt (this is why each directive has its own topic, in addition to its
appearance in the list below).

A detailed discussion of how key mapping works follows the directive list
below.

General Input Keys

    512AliasExpand           Expand aliases without executing them
    482Backspace             Deletes the character to the left of the cursor
    483BeginLine             Moves the cursor to the start of the line
    484Del                   Deletes the character at the cursor
    485DelToBeginning        Deletes from the cursor to the start of the line
    486DelToEnd              Deletes from the cursor to the end of the line
    487DelWordLeft           Deletes the word to the left of the cursor
    488DelWordRight          Deletes the word to the right of the cursor
    489Down                * Moves the cursor or scrolls the display down
    490EndLine               Moves the cursor to the end of the line
    491EraseLine             Deletes the entire line
    492ExecLine              Executes or accepts a line
    493Ins                   Toggles insert / overstrike mode
    494Left                * Moves the cursor or scrolls the display left
    495NormalKey           * Deassigns a key
    496Right               * Moves the cursor or scrolls the display right
    497Up                  * Moves the cursor or scrolls the display up
    498WordLeft              Moves the cursor left one word
    499WordRight             Moves the cursor right one word

Command-Line Editing Keys

    511AddFile             * Keeps filename completion entry and adds another
    513CommandEscape       * Allows direct entry of a keystroke
    514DelHistory            Deletes a history list entry
    531DirWinOpen            Opens the directory history window
    515EndHistory            Displays the last entry in the history list
    516Help                  Invokes this help system
    532HistWinOpen           Opens the command history window
    517LFNToggle             Switches filename completion between LFN and SFN
    518LineToEnd             Copies the current line to the end of the history
    519NextFile            * Gets the next matching filename
    520NextHistory           Recalls the next command from the history
    521NormalEditKey       * Deassigns a command-line editing key
    522PopFile             * Opens the filename completion window
    523PrevFile            * Gets the previous matching filename
    524PrevHistory           Recalls the previous command from the history
    527RepeatFile            Repeats the just-matched filename
    525SaveHistory           Saves the command line without executing it

Popup Window Keys

    533NormalPopupKey      * Deassigns a popup window key
    534PopupWinBegin         Moves to the first line of the popup window
    535PopupWinDel           Deletes a line from within the popup window
    536PopupWinEdit          Moves a line from the popup window to the prompt
    537PopupWinEnd           Moves to the last line of the popup window
    538PopupWinExec          Executes the selected line in the popup window

LIST Keys

    526ListContinue          Continues LIST
    539ListExit              Exits the current file
    540ListFind              Prompts and searches for a string
    541ListFindReverse       Prompts and searches backward for a string
    542ListHex               Toggles hexadecimal display mode
    543ListHighBit           Toggles LIST's "strip high bit" option
    544ListInfo              Displays information about the current file
    545ListNext              Finds the next matching string
    546ListPrevious          Finds the previous matching string
    547ListPrint             Prints the file on LPT1
    548ListWrap              Toggles LIST's wrap option
    549NormalListKey       * Deassigns a LIST key

See Also:

    561ClearKeyMap           Clear default key mappings


Using Key Mapping Directives

Using a key mapping directive allows you to assign a different or
additional key to perform the function described.  For example, to use
function key F3 to invoke the HELP facility (normally invoked with
F1):

     Help = F3

Any directive can be used multiple times to assign multiple keys to the
same function.  For example:

     ListFind = F        ; F does a find in LIST
     ListFind = F5       ; F5 also does a find in LIST

Use some care when you reassign keystrokes.  If you assign a default key to
a different function, it will no longer be available for its original
use.  For example, if you assign F1 to the AddFile directive (a part of
filename completion), the F1 key will no longer invoke the help system,
so you will probably want to assign a different key to Help.

See 893Keys and Key Names before using the key mapping directives.

Key assignments are processed before looking for keystroke aliases.  For
example, if you assign Shift-F1 to HELP and also assign Shift-F1 to
a key alias, the key alias will be ignored.

Assigning a new keystroke for a function does not deassign the default
keystroke for the same function.  If you want to deassign one of the
default keys, use the 495NormalKey directive for general input keys, or
the corresponding directive for keys in the other key groups
(521NormalEditKey, 533NormalPopupKey, or 549NormalListKey).

  All of the key-mapping directives may be dynamically reassigned at the
command line using the 648OPTION //optname=value syntax.  There is no
provision for remapping keys in the interactive 648OPTION dialogs.
;---------------------------------------------------------------------------
;Key mapping directives -- General Input -------------------------------
;---------------------------------------------------------------------------
!TOPIC 482 Backspace
!NOINDEX
!TTY

Backspace = Key  (Bksp):  Deletes the character to the left of the cursor.
;---------------------------------------------------------------------------
!TOPIC 483 BeginLine
!NOINDEX
!TTY

BeginLine = Key  (Home):  Moves the cursor to the beginning of the line.
;---------------------------------------------------------------------------
!TOPIC 484 Del
!NOINDEX

Del = Key  (Del):  Deletes the character at the cursor.
;---------------------------------------------------------------------------
!TOPIC 485 DelToBeginning
!NOINDEX
!TTY

DelToBeginning = Key  (Ctrl-Home):  Deletes from the cursor to the start
of the line.
;---------------------------------------------------------------------------
!TOPIC 486 DelToEnd
!NOINDEX
!TTY

DelToEnd = Key  (Ctrl-End):  Deletes from the cursor to the end of the
line.
;---------------------------------------------------------------------------
!TOPIC 487 DelWordLeft
!NOINDEX
!TTY

DelWordLeft = Key  (Ctrl-L):  Deletes the word to the left of the
cursor.
;---------------------------------------------------------------------------
!TOPIC 488 DelWordRight
!NOINDEX
!TTY

DelWordRight = Key  (Ctrl-R, Ctrl-Bksp):  Deletes the word to the right
of the cursor.  See 561ClearKeyMap if you need to remove the default
mapping of Ctrl-Bksp to this function.
;---------------------------------------------------------------------------
!TOPIC 489 Down
!NOINDEX
!TTY

Down = Key  (Down):  Scrolls the display down one line in LIST; moves
the cursor down one line in 662SELECT and in the command-line
history, directory history, or 318%@SELECT window.  (Scrolling down
through the command history at the prompt is controlled by
520NextHistory, not by this directive.)
;---------------------------------------------------------------------------
!TOPIC 490 EndLine
!NOINDEX
!TTY

EndLine = Key  (End):  Moves the cursor to the end of the line.
;---------------------------------------------------------------------------
!TOPIC 491 EraseLine
!NOINDEX
!TTY

EraseLine = Key  (Esc):  Deletes the entire line.
;---------------------------------------------------------------------------
!TOPIC 492 ExecLine
!NOINDEX
!TTY

ExecLine = Key  (Enter):  Executes or accepts a line.
;---------------------------------------------------------------------------
!TOPIC 493 Ins
!NOINDEX
!TTY

Ins = Key  (Ins):  Toggles insert / overstrike mode during line editing.
;---------------------------------------------------------------------------
!TOPIC 494 Left
!NOINDEX
!TTY

Left = Key  (Left):  Moves the cursor left one character on the input
line; scrolls the display left 8 columns in LIST; scrolls the display left 4
columns in the command-line, directory history, or 318%@SELECT window.
;---------------------------------------------------------------------------
!TOPIC 495 NormalKey
!NOINDEX
!TTY

NormalKey = Key:  Deassigns a general input key in order to disable the
usual meaning of the key within 4DOS and/or make it available for keystroke
aliases.  This will make the keystroke operate as a "normal" key with no
special function.  For example:

     NormalKey = Ctrl-End

will disable Ctrl-End, which is the standard "delete to end of line"
key.  Ctrl-End could then be assigned to a keystroke alias.  Another key
could be assigned the "delete to end of line" function with the
486DelToEnd directive.
;---------------------------------------------------------------------------
!TOPIC 496 Right
!NOINDEX
!TTY

Right = Key  (Right):  Moves the cursor right one character on the input
line; scrolls the display right 8 columns in 640LIST; scrolls the display
right 4 columns in the command-line history, directory history, or
318%@SELECT window.
;---------------------------------------------------------------------------
!TOPIC 497 Up
!NOINDEX
!TTY

Up = Key  (Up):  Scrolls the display up one line in 640LIST; moves
the cursor up one line in 662SELECT and in the command-line
history, directory history, or 318%@SELECT window.  (Scrolling up
through the command history at the prompt is controlled by
524PrevHistory, not by this directive.)
;---------------------------------------------------------------------------
!TOPIC 498 WordLeft
!NOINDEX
!TTY

WordLeft = Key  (Ctrl-Left):  Moves the cursor left one word; scrolls
the display left 40 columns in 640LIST.
;---------------------------------------------------------------------------
!TOPIC 499 WordRight
!NOINDEX
!TTY

WordRight = Key  (Ctrl-Right):  Moves the cursor right one word;
scrolls the display right 40 columns in 640LIST.
;---------------------------------------------------------------------------
;Key mapping directives -- Command Line Editing --------------------------
;---------------------------------------------------------------------------
!TOPIC 511 AddFile
!NOINDEX
!TTY

AddFile = Key  (F10):  Keeps the current filename completion entry and
inserts the next matching name.
;---------------------------------------------------------------------------
!TOPIC 512 AliasExpand
!NOINDEX
!TTY

AliasExpand = Key  (Ctrl-F):  Expands all aliases in the current command
line without executing them.
;---------------------------------------------------------------------------
!TOPIC 513 CommandEscape
!NOINDEX
!TTY

CommandEscape = Key  (Alt-255):  Allows direct entry of a keystroke
that would normally be handled by the command line editor (e.g. Tab
or Ctrl-D).
;---------------------------------------------------------------------------
!TOPIC 514 DelHistory
!NOINDEX
!TTY

DelHistory = Key  (Ctrl-D):  Deletes the displayed history list entry
and displays the previous entry.
;---------------------------------------------------------------------------
!TOPIC 515 EndHistory
!NOINDEX
!TTY

EndHistory = Key  (Ctrl-E):  Displays the last entry in the history
list.
;---------------------------------------------------------------------------
!TOPIC 516 Help
!NOINDEX
!TTY

Help = Key  (F1):  Invokes the HELP facility.
;---------------------------------------------------------------------------
!TOPIC 517 LFNToggle
!NOINDEX
!TTY

LFNToggle = Key  (Ctrl-A):  Toggles filename completion between long
filename and short filename modes on LFN drives.
;---------------------------------------------------------------------------
!TOPIC 518 LineToEnd
!NOINDEX
!TTY

LineToEnd = Key  (Ctrl-Enter):  Copies the current command line to the end
of the history list, then executes it.
;---------------------------------------------------------------------------
!TOPIC 519 NextFile
!NOINDEX
!TTY

NextFile = Key  (F9, Tab):  Gets the next matching filename.  See
561ClearKeyMap if you need to remove the default mapping of Tab
to this function.
;---------------------------------------------------------------------------
!TOPIC 520 NextHistory
!NOINDEX
!TTY

NextHistory = Key  (Down):  Recalls the next command from the command
history.
;---------------------------------------------------------------------------
!TOPIC 521 NormalEditKey
!NOINDEX
!TTY

NormalEditKey = Key:  Deassigns a command-line editing key in order to
disable the usual meaning of the key while editing a command line, and/or
make it available for keystroke aliases.  For additional details see
495NormalKey.
;---------------------------------------------------------------------------
!TOPIC 522 PopFile
!NOINDEX
!TTY

PopFile = Key  (F7, Ctrl-Tab):  Opens the filename completion window.  You
may not be able to use Ctrl-Tab, because not all systems recognize
it as a keystroke.  See 561ClearKeyMap if you need to remove the
default mapping of Ctrl-Tab to this function.
;---------------------------------------------------------------------------
!TOPIC 523 PrevFile
!NOINDEX
!TTY

PrevFile = Key  (F8, Shift-Tab):  Gets the previous matching filename.

See 561ClearKeyMap if you need to remove the default mapping of
Shift-Tab to this function.
;---------------------------------------------------------------------------
!TOPIC 524 PrevHistory
!NOINDEX
!TTY

PrevHistory = Key  (Up):  Recalls the previous command from the command
history.
;---------------------------------------------------------------------------
!TOPIC 527 RepeatFile
!NOINDEX
!TTY

RepeatFile = Key  (F12):  Repeats the previous matching filename during
filename completion.
;---------------------------------------------------------------------------
!TOPIC 525 SaveHistory
!NOINDEX
!TTY

SaveHistory = Key  (Ctrl-K):  Saves the command line in the command
history list without executing it.
;---------------------------------------------------------------------------
;Key mapping directives -- Popup --------------------------
;---------------------------------------------------------------------------
!TOPIC 531 DirWinOpen
!NOINDEX
!TTY

DirWinOpen = Key  (Ctrl-PgUp):  Opens the directory history window while
at the command line.
;---------------------------------------------------------------------------
!TOPIC 532 HistWinOpen
!NOINDEX
!TTY

HistWinOpen = Key  (PgUp):  Brings up the history window while at the
command line.
;---------------------------------------------------------------------------
!TOPIC 533 NormalPopupKey
!NOINDEX
!TTY

NormalPopupKey = Key:  Deassigns a popup window key in order to
disable the usual meaning of the key within the popup window.  For
additional details see 495NormalKey.
;---------------------------------------------------------------------------
!TOPIC 534 PopupWinBegin
!NOINDEX
!TTY

PopupWinBegin = Key  (Ctrl-PgUp):  Moves to the first item in the list
when in the popup window.
;---------------------------------------------------------------------------
!TOPIC 535 PopupWinDel
!NOINDEX
!TTY

PopupWinDel = Key  (Ctrl-D):  Deletes a line from within the command
history or directory history window.
;---------------------------------------------------------------------------
!TOPIC 536 PopupWinEdit
!NOINDEX
!TTY

PopupWinEdit = Key  (Ctrl-Enter):  Moves a line from the command history
or directory history window to the prompt for editing.
;---------------------------------------------------------------------------
!TOPIC 537 PopupWinEnd
!NOINDEX
!TTY

PopupWinEnd = Key  (Ctrl-PgDn):  Moves to the last item in the list when
in the popup window.
;---------------------------------------------------------------------------
!TOPIC 538 PopupWinExec
!NOINDEX
!TTY

PopupWinExec = Key  (Enter):  Selects the current item and closes the
window.
;---------------------------------------------------------------------------
;Key mapping directives -- LIST ------------------------------------
;---------------------------------------------------------------------------
!TOPIC 526 ListContinue
!NOINDEX
!TTY

ListContinue = Key  (C):  Continues LIST.
;---------------------------------------------------------------------------
!TOPIC 539 ListExit
!NOINDEX
!TTY

ListExit = Key  (Esc):  Exits from the LIST command.
;---------------------------------------------------------------------------
!TOPIC 540 ListFind
!NOINDEX
!TTY

ListFind = Key  (F):  Prompts and searches for a string.
;---------------------------------------------------------------------------
!TOPIC 541 ListFindReverse
!NOINDEX
!TTY

ListFindReverse = Key  (Ctrl-F):  Prompts and searches backward
for a string.
;---------------------------------------------------------------------------
!TOPIC 542 ListHex
!NOINDEX
!TTY

ListHex = Key  (X):  Toggles hexadecimal display mode.
;---------------------------------------------------------------------------
!TOPIC 543 ListHighBit
!NOINDEX
!TTY

ListHighBit = Key  (H):  Toggles LIST's "strip high bit" option, which
can aid in displaying files from certain word processors.
;---------------------------------------------------------------------------
!TOPIC 544 ListInfo
!NOINDEX
!TTY

ListInfo = Key  (I):  Displays information about the current file.
;---------------------------------------------------------------------------
!TOPIC 545 ListNext
!NOINDEX
!TTY

ListNext = Key  (N):  Finds the next matching string.
;---------------------------------------------------------------------------
!TOPIC 546 ListPrevious
!NOINDEX
!TTY

ListPrevious = Key  (Ctrl-N):  Finds the previous matching string.
;---------------------------------------------------------------------------
!TOPIC 547 ListPrint
!NOINDEX
!TTY

ListPrint = Key  (P):  Prints the file on LPT1.
;---------------------------------------------------------------------------
!TOPIC 548 ListWrap
!NOINDEX
!TTY

ListWrap = Key  (W):  Toggles LIST's wrap option on and off.  The wrap
option wraps text at the right margin.
;---------------------------------------------------------------------------
!TOPIC 549 NormalListKey
!NOINDEX
!TTY

NormalListKey = Key:  Deassigns a LIST key in order to disable the
usual meaning of the key within LIST.  For additional details see
495NormalKey.
;---------------------------------------------------------------------------
!TOPIC 550 Advanced Directives
!NOINDEX

     551ChangeTitle           Change OS/2 window title for external programs
    561ClearKeyMap           Clear default key mappings
     552CopyEA                Copy OS/2 Extended Attributes
     562CritFail              Automatic fail on critical errors
    563Debug                 Set debugging options
     564DiskReset             Reset disk drives on file commands
     553DRSets                Take over DR-DOS CONFIG.SYS environment
     565DVCleanup             Clean up on DESQview window close
     554FineSwap              Fine-grained disk swapping
     566FullINT2E             Full interrupt 2E support
     567Include               Include a file of .INI directives
     568Inherit               Inherit aliases, functions, and history
     555MaxLoadAddress        Shell load address control (NDIS etc.)
     569MessageServer         COMMAND.COM message server
     570NetWareNames          Novell NetWare support
     571NextINIFile           Set secondary shell .INI file name
     572OutputBIOS            Use BIOS instead of direct video output
     556Reduce                Control spawning of secondary shells
     557ReserveTPA            Control shell memory allocation
     573SDFlush               Control SMARTDRV write-behind buffers
     574StackSize             Internal stack size
     575SwapReopen            Reopen swap file if it is closed
     576UniqueSwapName        Use unique swap file name
    577Win95LFN              Disable long filename support


Directives marked with a  may be dynamically changed at the command line
using the 648OPTION //optname=value syntax.
;---------------------------------------------------------------------------
!TOPIC 551 ChangeTitle
!NOINDEX
!TTY

ChangeTitle = YES | No:  Determines whether 4DOS changes the OS/2
session title when running an external program from a DOS session
under OS/2 2.0 and above.  See also the 223_WINTITLE internal variable.
;---------------------------------------------------------------------------
!TOPIC 552 CopyEA
!NOINDEX
!TTY

CopyEA = YES | No:  Determines whether the
4DOS 606COPY and 646MOVE commands attempt to copy
Extended Attributes when running in a DOS session under
OS/2 1.x or above.
;---------------------------------------------------------------------------
!TOPIC 553 DRSets
!NOINDEX
!TTY

DRSets = YES | No:  When running under DR DOS 6.0 or above, 4DOS will
normally retrieve environment variables created by any SET commands
in the DR-DOS CONFIG.SYS file and place them in the 4DOS master
environment.  Set DRSets to No to disable this feature.  The default
is No on other systems.
;---------------------------------------------------------------------------
!TOPIC 554 FineSwap
!NOINDEX
!TTY

FineSwap = Yes | NO:  If you are using disk swapping and your system
hangs when exiting an application, Yes enables "fine-grained" checksums
during disk swapping.  This should be used only to diagnose unusual
swapping problems.
;---------------------------------------------------------------------------
!TOPIC 555 MaxLoadAddress
!NOINDEX
!TTY

MaxLoadAddress = nnn:  Specifies the maximum load address in order
to work around problems with some rare drivers not properly allocating
the memory they use (such as some 847NDIS network drivers.)  This
should be used only to solve unusual problems.
;---------------------------------------------------------------------------
!TOPIC 556 Reduce
!NOINDEX
!TTY

Reduce = YES | No:  Set to No, if you have unexplained problems
in starting secondary shells.
;---------------------------------------------------------------------------
!TOPIC 557 ReserveTPA
!NOINDEX
!TTY

ReserveTPA = YES | No:  Set to No for unusual memory allocation problems.
;---------------------------------------------------------------------------
!TOPIC 561 ClearKeyMap
!NOINDEX
!TTY

ClearKeyMap:  Clears all current 481key mappings.  ClearKeyMap is
a special directive which has no value or "=" after it.  Use ClearKeyMap to
make one of the keys in the default map (Tab, Shift-Tab, Ctrl-Tab,
or Ctrl-Bksp) available for a keystroke alias, or in the
[Secondary] section of 4DOS.INI to clear key mappings inherited from
the primary shell.  ClearKeyMap should appear before any key mapping
directives.  If you want to clear some but not all of the default mappings,
use ClearKeyMap, then recreate the mappings you want to retain (e.g., with
"NextFile=Tab", etc.).
;---------------------------------------------------------------------------
!TOPIC 562 CritFail
!NOINDEX
!TTY

CritFail = Yes | NO:  This is the same as /F on the SHELL= line in
CONFIG.SYS.  It intercepts all DOS critical errors and returns a Fail to
each.  We do not recommend this on most systems, because you will not
have a chance to react to a critical error and correct the problem that
caused it.  It is intended for use on bulletin boards or other systems
where unattended operation is required without user prompts.
;---------------------------------------------------------------------------
!TOPIC 563 Debug
!NOINDEX
!TTY

Debug = nnnn (0):  Controls certain debugging options which can assist you
in tracking down unusual problems.  Use the following values for Debug; to
select more than one option, add the values together:

!INDENT 8 5 5 5
     1  During the startup process, display the complete command tail
     passed to 4DOS, then wait for a keystroke.

     2  Include the product name with each error message displayed by
     4DOS.  This may be useful if you are unsure of the origin of a
     particular error message.
!INDENT 0

Also see the 112batch file debugger, a separate and unrelated facility
for stepping through batch files.
;---------------------------------------------------------------------------
!TOPIC 564 DiskReset
!NOINDEX
!TTY

DiskReset = Yes | NO:  Enables or disables disk resets after COPY,
DEL, DESCRIBE, MOVE, and REN, before DIR, and when starting 4DOS.  Set to
Yes if you have problems with disk change detection on non-standard or 
cached floppy disk drives, or with network software which doesn't always 
properly flush data to the disk.  Such problems are very rare, so normally
No is the best choice.  Setting DiskReset to Yes may increase the time 
required to start a secondary shell, and may reduce the performance of DIR, 
COPY, MOVE, and REN.
;---------------------------------------------------------------------------
!TOPIC 565 DVCleanup
!NOINDEX
!TTY

DVCleanup = YES | No.  Controls the cleanup of 4DOS resources (the
shell number and any disk swap file) when you close a 4DOS window from the
DESQview menu.  See 751Compatibility for more details.
;---------------------------------------------------------------------------
!TOPIC 566 FullINT2E
!NOINDEX
!TTY

FullINT2E = YES | No:  Enables full support for the COMMAND.COM "back
door" (interrupt 2E) which some programs use to execute commands.  Effective
only in a primary shell loaded via the SHELL= command in
CONFIG.SYS.  If this directive is set to No, INT 2E will return
immediately to the calling program without taking any action.  Setting
FullINT2E to No reduces the size of the primary shell's memory-resident
portion by about 100 bytes.

See 763Executing DOS Commands from Applications for more details on
when this directive may be needed.  Also, see 751Compatibility for
information on programs known to require this option.  The topic
798Technical Information for Programmers explains how a programmer can
use INT 2E to execute 4DOS commands from within a program.
;---------------------------------------------------------------------------
!TOPIC 567 Include
!NOINDEX
!TTY

Include = File:  Include the text from the named file at this
point in the processing of the current .INI file.  Use this option to share a
file of directives between several products.  The text in the named file is
processed just as if it were part of the original .INI file.  When the
include file is finished, processing resumes at the point where it left off
in the original file.  The included file may contain any valid directive for
the current section, but may not contain a section name.  Includes may be
nested up to three levels deep (counting the original file as level 1).

You must maintain include files manually -- the 648OPTION command
modifies the original .INI file only, and does not update included files.
;---------------------------------------------------------------------------
!TOPIC 568 Inherit
!NOINDEX
!TTY

Inherit = YES | No:  4DOS.INI data, aliases, functions, command history,
and directory history are normally passed to secondary shells
automatically.  No disables this feature.
;---------------------------------------------------------------------------
!TOPIC 569 MessageServer
!NOINDEX
!TTY

MessageServer = YES | No:  For compatibility with COMMAND.COM in MS-DOS
4.x and above, 4DOS includes a "message server" that retrieves error
message text for DOS external commands like DISKCOPY and FORMAT.  The
message server increases the size of the resident portion of 4DOS by about
200 bytes.  No disables the message server and saves this space, but
will cause more cryptic error messages such as "Parse error 3" or "Extended
error 7" from some DOS external commands.  The message server is
automatically enabled by 4DOS in the primary 4DOS shell loaded from
CONFIG.SYS when running under MS-DOS 4.x or above, and disabled elsewhere.
;---------------------------------------------------------------------------
!TOPIC 570 NetWareNames
!NOINDEX
!TTY

NetWareNames = Yes | NO.  Set to Yes to include strings in the
resident portion of 4DOS which Novell NetWare searches for when it loads.

NetWareNames should be Yes for NetWare systems to avoid problems with
destroyed environment variables during LOGIN.  Setting NetWareNames to
Yes increases 4DOS's low DOS memory usage by 112 bytes.
;---------------------------------------------------------------------------
!TOPIC 571 NextINIFile
!NOINDEX
!TTY

NextINIFile = File.  The full path and name of the file must be
specified.  All subsequent shells will read the specified .INI file, and
ignore any [Secondary] section in the original .INI file.  If you have
a diskless or floppy-based workstation, NextINIFile will allow you to shift
4DOS.INI to a network drive for secondary shells, and avoid all access to
the original boot drive.
;---------------------------------------------------------------------------
!TOPIC 572 OutputBIOS
!NOINDEX
!TTY

OutputBIOS = Yes | NO:  Determines whether 4DOS uses the BIOS for all
screen displays.  If set to No, 4DOS will use direct screen writes for
color-coded directories and the 616DRAWBOX, 617DRAWHLINE,
618DRAWVLINE, 640LIST, 662SELECT, 661SCRPUT, and
684VSCRPUT commands.  If set to Yes, 4DOS will perform these
commands using BIOS calls.  This directive is only needed for compatibility
with unusual display adapters, such as those used on Japanese systems
running DOS/V.  Setting OutputBIOS to Yes may substantially reduce the
speed of the affected commands.  When OutputBIOS is set to Yes you may
also need to set 442ScreenColumns appropriately.
;---------------------------------------------------------------------------
!TOPIC 573 SDFlush
!NOINDEX
!TTY

SDFlush = Yes | NO:  Determines whether 4DOS instructs Microsoft SMARTDRV
(and other SMARTDRV-compatible disk caching programs) to flush any
"write-behind" buffers to the disk before the 4DOS prompt is
displayed.  Setting SDFlush to Yes may decrease performance, but will
ensure that SMARTDRV is instructed to write all modified data to disk
before the prompt is displayed.

SDFlush does not take into account any changes in the design or behavior
of SMARTDRV after the release of 4DOS, or your SMARTDRV startup
options.  Therefore setting SDFlush to Yes does not guarantee that
write-behind data will be written to disk before the prompt is
displayed, only that SMARTDRV will be instructed to do so.
;---------------------------------------------------------------------------
!TOPIC 574 StackSize
!NOINDEX
!TTY

StackSize = nnnn (8192):  Set the 4DOS internal stack size.  The
allowable range of values is 8192 to 16384.

If you use complex combinations of "prefix" commands like 615DO,
623EXCEPT, 626FOR, 628GLOBAL, 633IF, 634IFF,
and 662SELECT on the same command line, and especially if you use
these commands in multiple nested batch files or 629GOSUBs, you may
encounter a "4DOS internal stack overflow" error.  If you do, you should
use this directive to increase the amount of stack space available.

For virtually all users, the default stack size will be sufficient.  If you
increase the stack size, you will increase the size of 4DOS's transient
portion in memory, and the size of the 4DOS swap area, by the amount of the
stack size increase.  Please note that you may receive "out of memory"
errors which prevent 4DOS from loading if you use large StackSize values
along with enlarged alias and/or history buffers.
;---------------------------------------------------------------------------
!TOPIC 575 SwapReopen
!NOINDEX
!TTY

SwapReopen = Yes | NO:  Set to Yes to enable reopening of the 4DOS
swap file if it is closed by another program.  This is required when
swapping 4DOS to Novell NetWare drives or when using other applications
which close 4DOS's swap file.  In all other circumstances, it is only
useful for diagnostic purposes.  Setting SwapReopen to Yes also
disables the reduced swapping size normally used in 4DOS secondary
shells (see also 391Swapping).
;---------------------------------------------------------------------------
!TOPIC 576 UniqueSwapName
!NOINDEX
!TTY

UniqueSwapName = Yes | No:  Set to Yes to change the disk swap file
name from 4DOSSWAP.nnn to a unique name generated by 4DOS, with an
extension of "4SW" (e.g., A1CD6B11.4SW).  This prevents conflicts between
swap files in different shells; it is only necessary when you are using
disk swapping with a COMMAND.COM primary shell or in an OS/2 2.x DOS
session.  The default is Yes in OS/2 DOS sessions, and under
Windows 95/98/ME when 4DOS is not loaded as the primary shell,
and No elsewhere.

UniqueSwapName only works in DOS 3.0 and above (including
Windows 95/98/ME), and in OS/2 DOS sessions, and applies
only to disk swapping.
;---------------------------------------------------------------------------
!TOPIC 577 Win95LFN
!NOINDEX
!TTY

Win95LFN= Yes | No:  Under Windows 95/98/ME the default is Yes.
Set Win95LFN to No to disable long filename support in these
environments.  This directive affects a wide range of internal
filename and file handling features, but does not prevent 4DOS from
detecting that it is running under Windows 95/98/ME.  It generally
should be used only for debugging or diagnostic purposes.

In other environments the default is No.  You can set Win95LFN to
Yes to force 4DOS to try to use long filenames in non-standard
environments (e.g., where a driver or memory-resident program
provides long filename support that is not built into the operating
system).  Setting Win95LFN to Yes does not guarantee that
non-standard LFN support will work with 4DOS, so you should do
some testing before using this method extensively or for critical
data or procedures.
;---------------------------------------------------------------------------
; Directive equates ----------------------------------------------------------
!TOPIC 456 =417 CDDWinLeft
!NOINDEX
!TOPIC 457 =440 PopupWinLeft
!NOINDEX
!TOPIC 578 =373 _Alias_
!NOINDEX
!TOPIC 579 =382 _History_
!NOINDEX
!TOPIC 580 =391 _Swapping_
!NOINDEX
!TOPIC 581 =412 _ANSI_
!NOINDEX
!TOPIC 582 =428 _EvalMin_
!NOINDEX
!TOPIC 583 =427 _EvalMax_
!NOINDEX
!TOPIC 584 =429 _FileCompletion_
!NOINDEX
!TOPIC 585 =376 _DirHistory_
!NOINDEX
!TOPIC 586 =377 _Environment_
!NOINDEX
!TOPIC 587 =379 _Function_
!NOINDEX
!TOPIC 880 =417 CDDWinTop
!NOINDEX
!TOPIC 881 =417 CDDWinWidth
!NOINDEX
!TOPIC 882 =417 CDDWinHeight
!NOINDEX
!TOPIC 883 =440 PopupWinTop
!NOINDEX
!TOPIC 884 =440 PopupWinWidth
!NOINDEX
!TOPIC 885 =440 PopupWinHeight
!NOINDEX
;---------------------------------------------------------------------------
!TOPIC 592 Commands by Category
!NOINDEX

The best way to learn the 4DOS commands is to use them and experiment with
them.  The lists below categorize the available commands by topic and will
help you find the ones that you need.

System configuration and status

     598BREAK         603CHCP          604CLS           605COLOR         776COUNTRY
     607CTTY          608DATE          613DIRHISTORY    627FREE          632HISTORY
     775IDLE          637KEYBD         639LH / LOADHIGH 643LOG           645MEMORY
     648OPTION        652PROMPT        656REBOOT        664SETDOS        668SWAPPING
     672TIME          768TITLE         681VER           682VERIFY        683VOL

File and directory management

     596ATTRIB        606COPY          609DEL / ERASE   611DESCRIBE      697HEAD
     640LIST          646MOVE          658REN / RENAME  662SELECT        698TAIL
     674TOUCH         676TRUENAME      677TYPE          685WHICH

Subdirectory management

     601CD / CHDIR    602CDD           612DIR           614DIRS          644MD / MKDIR
     651POPD          653PUSHD         655RD / RMDIR    675TREE

Input and output

     616DRAWBOX       617DRAWHLINE     618DRAWVLINE     619ECHO          689ECHOERR
     620ECHOS         690ECHOSERR      635INKEY         636INPUT         638KEYSTACK
     660SCREEN        661SCRPUT        671TEXT          684VSCRPUT

Commands primarily for use in or with batch files and aliases (some
work only in batch files; see the individual commands for details)

     595ALIAS         597BEEP          599CALL          600CANCEL        610DELAY
     714CLOSETRAY     615DO            715EJECTMEDIA    621ENDLOCAL      626FOR
     696FUNCTION      628GLOBAL        629GOSUB         630GOTO          633IF
     634IFF           687LFNFOR        641LOADBTM       647ON            650PAUSE
     654QUIT          657REM           659RETURN        827SETERROR      665SETLOCAL
     666SHIFT         669SWITCH        671TEXT          774TRANSIENT     678UNALIAS
     699UNFUNCTION

Environment and path commands

     622ESET          649PATH          663SET           680UNSET

Other commands

     594?             623EXCEPT        624EXIT          625FFIND         631HELP
     640LIST          667START         670TEE           673TIMER         686Y
;---------------------------------------------------------------------------
!TOPIC 593 Commands by Name
!NOINDEX
!NOWRAP
     594?             Display internal commands or prompt for a command.
     595ALIAS         Create aliases for new or existing commands.
     596ATTRIB        Change or view file and directory attributes.
     597BEEP          Beep the speaker or play simple music.
     598BREAK         Enable or disable Ctrl-C / Ctrl-Break checks.
     599CALL          Execute one batch file from within another.
     600CANCEL        Terminate batch file processing.
     601CD / CHDIR    Display or change the current directory.
     602CDD           Change the current disk drive and directory.
     603CHCP          Display or change the current system code page.
     601CHDIR / CD    Display or change the current directory.
     714CLOSETRAY     Close the tray of the specified drive(s).
     604CLS           Clear the video display and optionally change colors.
     605COLOR         Change the default display colors.
     606COPY          Copy data between directories, files, or devices.
     776COUNTRY       Display or change the current country.
     607CTTY          Change the default console device.
     608DATE          Display and optionally change the system date.
     609DEL / ERASE   Delete one or more files.
     610DELAY         Pause for a specified length of time.
     611DESCRIBE      Create, modify, or delete file descriptions.
     612DIR           Display information about files and directories.
     613DIRHISTORY    Display, add to, clear, or read the directory history.
     614DIRS          Display the current directory stack.
     615DO            Create loops in batch files.
     616DRAWBOX       Draw a box on the screen.
     617DRAWHLINE     Draw a horizontal line on the screen.
     618DRAWVLINE     Draw a vertical line on the screen.
     619ECHO          Display a message, or control command echoing.
     689ECHOERR       Display a message to standard error.
     620ECHOS         Display a message without a trailing CR/LF.
     690ECHOSERR      Display a message without a trailing CR/LF to std error.
     715EJECTMEDIA    Eject removable media in the specified drive(s).
     621ENDLOCAL      Restore the information saved by SETLOCAL.
     609ERASE / DEL   Delete one or more files.
     622ESET          Edit environment variables and aliases.
     623EXCEPT        Perform a command on all files except those specified.
     624EXIT          Exit from 4DOS.
     625FFIND         Search for files by name or contents.
     626FOR           Repeat a command for several values of a variable.
     627FREE          Display the disk space totals for one or more drives.
     696FUNCTION      Create a user-defined variable function.
     628GLOBAL        Execute a command across subdirectories.
     629GOSUB         Execute a subroutine in the current batch file.
     630GOTO          Branch inside the current batch file.
     697HEAD          Display the first part of a file.
     631HELP          Display help for internal and external commands.
     632HISTORY       Display, add to, clear, or read the history list.
     775IDLE          Turn dynamic idle detection on or off in DR DOS.
     633IF            Execute a command if specified conditions are true.
     634IFF           Perform IF / THEN / ELSE conditional execution.
     635INKEY         Get a single keystroke from the user.
     636INPUT         Get a string from the user.
     637KEYBD         Set the Caps Lock, Num Lock, and Scroll Lock state.
     638KEYSTACK      Feed keystrokes to a program or command automatically.
     687LFNFOR        Enable/disable LFN processing in FOR.
     639LH / LOADHIGH Load a memory-resident program into upper memory.
     640LIST          Display a file.
     641LOADBTM       Switch a batch file to or from BTM mode.
     639LOADHIGH / LH Load a memory-resident program into upper memory.
     642LOCK          Lock a drive for exclusive access in Windows 95/98/ME.
     643LOG           Save a log of commands to a disk file.
     644MD / MKDIR    Create a subdirectory.
     645MEMORY        Display the amount and status of system RAM.
     644MKDIR / MD    Create a subdirectory.
     646MOVE          Move files to a new directory and/or drive.
     647ON            Execute a command when a specific condition occurs.
     648OPTION        Modify the 4DOS confguration settings.
     649PATH          Display or change the system search path.
     650PAUSE         Suspend batch file or alias execution.
     651POPD          Return to the last directory saved by PUSHD.
     652PROMPT        Change the command-line prompt.
     653PUSHD         Save the current directory and change to a new directory.
     654QUIT          Terminate the current batch file.
     655RD / RMDIR    Remove one or more subdirectories.
     656REBOOT        Do a warm or cold system reboot or change power state.
     657REM           Put a comment in a batch file.
     658REN / RENAME  Rename files or subdirectories.
     659RETURN        Return from a GOSUB (subroutine) in a batch file.
     655RMDIR / RD    Remove one or more subdirectories.
     660SCREEN        Position the cursor on the screen and display a message.
     661SCRPUT        Position text on the screen and display it in color.
     662SELECT        Interactively select files for a command.
     663SET           Display, create, modify, or delete environment variables.
     664SETDOS        Modify some of the 4DOS configuration settings.
     827SETERROR      Set the ERRORLEVEL value and the DOS error code.
     665SETLOCAL      Save the directory, environment, aliases and other data.
     666SHIFT         Shift batch file arguments.
     667START         Start a program in another OS/2 session.
     668SWAPPING      Display or change the 4DOS swapping state.
     669SWITCH        Select a group of commands to execute in a batch file.
     698TAIL          Display the last part of a file.
     670TEE           Copy standard input to both standard output and a file.
     671TEXT          Display a block of text in a batch file.
     672TIME          Display or set the current system time.
     673TIMER         Start, stop, or display the value of a stopwatch.
     768TITLE         Set window title.
     674TOUCH         Change file dates and times.
     774TRANSIENT     Toggle shell transient mode.
     675TREE          Display the directory tree.
     676TRUENAME      Find the true path and file name for a file.
     677TYPE          Display the contents of the specified file(s).
     678UNALIAS       Remove aliases from the alias list.
     699UNFUNCTION    Remove user-defined variable functions.
     679UNLOCK        Unlock a disk drive under Windows 95/98/ME.
     680UNSET         Remove variables from the environment.
     681VER           Display the current 4DOS and DOS versions.
     682VERIFY        Display or change the disk write verification state.
     683VOL           Display disk volume label(s).
     684VSCRPUT       Display text vertically on the screen, in color.
     685WHICH         Show which command would be executed.
     686Y             Copy standard input and other files to standard output.
!WRAP
;---------------------------------------------------------------------------
!TOPIC 594 ?
!TTY

Purpose:  Display a list of internal commands or prompt for a command.

Format:   ? ["prompt" command]

          prompt:   Prompt text about whether to execute the command.
          command:  Command to be executed if user answers Y.
!TTY

Usage

? has two functions.  ? by itself displays a list of internal
commands.  For help with any individual command, see the 631HELP command.

If you have disabled a command with SETDOS /I, it will not appear in the list.

The second function of ? is to prompt the user before executing a specific
line in a batch file.  If you add a prompt and a command, ? will display
the prompt followed by "(Y/N)?" and wait for the user's response.  If the
user presses "Y" or "y", the line will be executed.  If the user presses "N"
or "n", the line will be ignored.

For example, the following command might be used in a batch file:

     ? "Load the network" call netstart.btm

When this command is executed, you will see the following prompt; if you
answer "Y", the CALL command will be executed:

     Load the network (Y/N)?
;---------------------------------------------------------------------------
!TOPIC 595 ALIAS
!TTY

Purpose:  Create new command names that execute one or more commands or
          redefine default options for existing commands; assign commands
          to keystrokes; load or display the list of defined alias names.

Format:   ALIAS [/P /R file...] [name[=][value]]

          file:   One or more files to read for alias definitions.
          name:   Name for an alias, or for the key to execute the
                  alias.
          value:  Text to be substituted for the alias name.

          /P(ause)                    /R(ead file)
!TTY

See also: 678UNALIAS.

Usage

The ALIAS command lets you create new command names or redefine internal
commands.  It also lets you assign one or more commands to a single
keystroke.  An alias is often used to execute a complex series of commands
with a few keystrokes or to create "in memory batch files" that run much
faster than disk-based batch files.

For example, to create a single-letter command D to display a wide directory,
instead of using the longer DIR /W, you could use the command:

     c:\> alias d = dir /w

Now when you type a single d as a command, it will be translated into a
DIR /W command.

If you define aliases for commonly used application programs, you can often
remove the directories they're stored in from the 138PATH.  For example, if
you use Quattro Pro and had the C:\QPRO directory in your path, you could
define the following alias:

     c:\> alias qpro = c:\qpro\q.exe

With this alias defined, you can probably remove C:\QPRO from your
PATH.  Quattro Pro will now load more quickly than it would if 4DOS had to
search the PATH for it.  In addition, the PATH can be shorter, which will
speed up searches for other programs.

If you apply this technique for each application program, you can often
reduce your PATH to just two or three directories containing utility
programs, and significantly reduce the time it takes to load most software
on your system.  Before removing a directory from the PATH, you will need
to define aliases for all the executable programs you commonly use which
are stored in that directory.

Aliases are stored in memory, and are not saved automatically when you turn
off your computer or end your current session.  See below for information
on saving and reloading your aliases.

Multiple Commands and Special Characters in Aliases

An alias can represent more than one command.  For example:

     c:\> alias letters = `cd \letters ^ text`

creates a new command called LETTERS.  The command first uses CD to change
to a subdirectory called \LETTERS and then runs a program called TEXT.  The
caret [^] is the 041command separator and indicates that the two
commands are distinct and should be executed sequentially.

When you type alias commands at the command line or in a batch file, you
must use back-quotes [`] around the definition if it contains
multiple commands, parameters (discussed below), environment variables,
redirection, or piping.  The back-quotes prevent premature expansion of
these arguments.  You may use back-quotes around other definitions, but
they are not required.  (You do not need back-quotes when your aliases are
loaded from an ALIAS /R file; see below for details.)  The examples above
and below include back-quotes only when they are required.

Nested Aliases

Aliases may invoke internal commands, external commands, or other
aliases.  (However, an alias may not invoke itself, except in special cases
where an IF or IFF command is used to prevent an infinite loop.)  The two
aliases below demonstrate alias nesting (one alias invoking another).  The
first line defines an alias which runs a program called WP.EXE that is in the
E:\WP60\ subdirectory.  The second alias changes directories with the PUSHD
command, runs the WP alias, and then returns to the original directory with
the POPD command:

     c:\> alias wp = e:\wp60\wp.exe
     c:\> alias w = `pushd c:\wp ^ wp ^ popd`

The second alias above could have included the full path and name of the
WP.EXE program instead of calling the WP alias.  However, writing two
aliases makes the second one easier to read and understand, and makes the
first alias available for independent use.  If you rename the WP.EXE
program or move it to a new directory, only the first alias needs to be
changed.

Temporarily Disabling Aliases

If you put an asterisk [*] immediately before a command in the value of
an alias definition (the part after the equal sign), it tells 4DOS not to
attempt to interpret that command as another (nested) alias.  An asterisk
used this way must be preceded by a space or the command separator and
followed immediately by an internal or external command name.

By using an asterisk, you can redefine the default options for any internal
or external command.  For example, suppose that you always want to use the
DIR command with the /2 (two column) and /P (pause at the end of each
page) options.  The following line will do just that:

     c:\> alias dir = *dir /2/p

If you didn't include the asterisk, the second DIR on the line would be the
name of the alias itself, and 4DOS would repeatedly re-invoke the DIR
alias, rather than running the DIR command.  This would cause an "Alias
loop" or "Command line too long" error.

An asterisk also helps you keep the names of internal commands from
conflicting with the names of external programs.  For example, suppose you
have a program called LIST.COM.  Normally, the internal LIST command will
run anytime you type LIST.  But two simple aliases will give you access to
both the LIST.COM program and the LIST command:

     c:\> alias list = c:\util\list.com
     c:\> alias display = *list

The first line above defines LIST as an alias for the LIST.COM program.  If
you stopped there, the external program would run every time you typed LIST
and you would not have easy access to the internal LIST command.  The
second line renames the internal LIST command as DISPLAY.  The asterisk is
needed in the second command to indicate that the following word means the
internal command LIST, not the LIST alias which runs your external program.

Another way to understand the asterisk is to remember that a command is
always checked for an alias first, then for an internal or external command,
or a batch file.  The asterisk at the beginning of a command name
simply skips over the usual check for aliases when processing that command,
and allows 4DOS to go straight to checking for an internal
command, external command, or batch file.

You can also use an asterisk before a command that you enter at the command
line or in a batch file.  If you do, that command won't be interpreted as
an alias.  This can be useful when you want to be sure you are running the
true, original command and not an alias with the same name, or temporarily
defeat the purpose of an alias which changes the meaning or behavior of a
command.

You can also disable aliases temporarily with the 664SETDOS /X command.

Partial Alias Names

You can also use an asterisk in the name of an alias.  When you do, the
characters following the asterisk are optional when you invoke the alias
command.  (Use of an asterisk in the alias name is unrelated to the use of
an asterisk in the alias value discussed above.)  For example, with this
alias:

     c:\> alias wher*eis = dir /sp

the new command, WHEREIS, can be invoked as WHER, WHERE, WHEREI, or
WHEREIS.  Now if you type:

     c:\> where myfile.txt

The WHEREIS alias will be expanded to the command:

     dir /sp myfile.txt

Keystroke Aliases

If you want to assign an alias to a keystroke, use the keyname on the left
side of the equal sign, preceded by an at sign [@].  For example, to
assign the command DIR /W to the F5 key, type

     c:\> alias @F5 = dir /w

See 893Keys and Key Names for a complete listing of key names and a
description of the key name format.

When you define keystroke aliases, the assignments will only be in effect
at the command line, not inside application programs.  Be careful not to
assign aliases to keys that are already used at the command line (like
F1 for Help).  The command-line meanings take precedence and the
keystroke alias will never be invoked.  If you want to use one of the
command-line keys for an alias instead of its normal meaning, you must
first disable its regular use with the 495NormalKey or
521NormalEditKey directives in 4DOS.INI.

If you define a keystroke alias with a single at sign as shown above, then,
when you press the F5 key, the value of the alias (DIR /W above) will
be placed on the command line for you.  You can type additional parameters
if you wish and then press Enter to execute the command.  With this
particular alias, you can define the files that you want to display after
pressing F5 and before pressing Enter to execute the command.

If you want the keystroke alias to take action automatically without
waiting for you to edit the command line or press Enter, you can begin
the definition with two at signs [@@].  4DOS will execute the alias
"silently," without displaying its text on the command line.  For example,
this command will assign an alias to the F6 key that uses the CDD
command to take you back to the previous default directory:

     c:\> alias @@f6 = cdd -

When you define keystroke aliases, the assignments will only be in effect at
the command line, not inside application programs.  Be careful not to assign
aliases to keys that are already used at the command line (like F1 for
Help).  The command-line meanings take precedence and the keystroke alias
will never be invoked.  If you want to use one of the command-line keys for
an alias instead of its normal meaning, you must first disable its regular
use with the 495NormalKey or 521NormalEditKey directives in your .INI
file.

You can also define a keystroke alias by using "@" or "@@" plus a scan
code for one of the permissible keys (see 911ASCII and Key Codes for
a list of scan codes).  In most cases it will be easier to use key
names.  Scan codes should only be used with unusual keyboards where a key
name is not available for the key you are using.

Note that it is possible for more than one keystroke alias to refer to the
same key.  For example, @F2, @@F2, @60, and @@60 are all valid aliases for
the F2 key.  If you have multiple aliases for the same key, the first
definition in the alias list will be used.

Displaying Aliases

If you want to see a list of all current ALIAS commands, type:

     c:\> alias

You can also view the definition of a single alias.  For example, if you
want to see the definition of the alias LIST, you can type:

     c:\> alias list

And you can view the definitions for all aliases matching a specific pattern
by specifying a single parameter containing 073wildcards.  For example:

     c:\> alias *win*

will display all aliases containing the string win.

Saving and Reloading Your Aliases

You can save your aliases to a file called ALIAS.LST this way:

     c:\> alias > alias.lst

You can then reload all the alias definitions in the file the next time you
boot up with the command:

     c:\> alias /r alias.lst

This is much faster than defining each alias individually in a batch file.  If
you keep your alias definitions in a separate file which you load when
your system starts, you can edit them with a text editor, reload the edited
file with ALIAS /R, and know that the same alias list will be loaded the
next time you boot your computer.

When you define aliases in a file that will be read with the ALIAS /R
command, you do not need back-quotes around the value, even if back-quotes
would normally be required when defining the same alias at the command line
or in a batch file.

To remove an alias, use the 678UNALIAS command.

Alias Parameters

Aliases can use command-line arguments or parameters like those in batch
files.  The command-line arguments are numbered from %0 to %255.  %0
contains the alias name.  It is up to the alias to determine the
meaning of the other parameters.  You can use quotation marks to pass
spaces, tabs, commas, and other special characters in an alias parameter;
see 118Argument Quoting for details.

Parameters that are referred to in an alias, but which are missing on the
command line, appear as empty strings inside the alias.  For example, if
you put two parameters on the command line, any reference in the alias to
%3 or any higher-numbered parameter will be interpreted as an empty
string.

The parameter %n& has a special meaning.  4DOS interprets it to mean
"the entire command line, from argument n to the end."  If n is not
specified, it has a default value of 1, so %& means "the entire command
line after the alias name."  The special parameter %# contains the number
of command-line arguments.  If you wish to use a symbol other than the
amperTION command.

You can also create, add to, and edit the .INI file "manually" with
any ASCII text editor.  4DOS reads its .INI file when it starts, and
configures itself accordingly.  The the following alias will change directories, perform a
command, and return to the original directory:

     c:\> alias in `pushd %1 ^ %2& ^ popd`

When this alias is invoked as:

     c:\> in c:\comm mycomm /zmodem /56K

the first parameter, %1, has the value c:\comm.  %2 is mycomm,
%3 is /zmodem, and %4 is /56K.  The command line expands into
these three separate commands:

     pushd c:\comm
     mycomm /zmodem /56K
     popd

This next example uses the IFF command to redefine the defaults for SET.  It
should be entered on one line:

     c:\> alias set = `iff %# == 0 then ^ *set /p ^ else ^ *set %& ^ endiff`

This modifies the SET command so that if SET is entered with no arguments,
it is replaced by SET /P (pause after displaying each page), but if SET is
followed by an argument, it behaves normally.  Note the use of asterisks
(*set) to prevent alias loops.

If an alias uses parameters, command-line arguments will be deleted up
to and including the highest referenced argument.  For example, if an alias
refers only to %1 and %4, then the first and fourth arguments will
be used, the second and third arguments will be discarded, and any
additional arguments beyond the fourth will be appended to the expanded
command (after the value portion of the alias).  If an alias uses no
parameters, all of the command-line arguments will be appended to the
expanded command.

Aliases also have full access to all variables in the environment,
internal variables, and variable functions.  For example, you can create a
simple command-line calculator this way:

     c:\> alias calc = `echo The answer is: %@eval[%&]`

Now, if you enter:

     c:\> calc 5 * 6

the alias will display:

     The answer is: 30

Expanding Aliases at the Prompt

You can expand an alias on the command line and view or edit the results by
pressing Ctrl-F after typing the alias name, but before the command is
executed.  This replaces the alias with its contents, and substitutes values
for each alias paramter, just as if you had pressed the Enter key.  However,
the command is not executed; it is simply redisplayed on the command line
for additional editing.

Ctrl-F is especially useful when you are developing and debugging a complex
alias, or if you want to make sure that an alias that you may have forgotten
won't change the effect of your command.

Local and Global Aliases

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

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

With a global alias list, all copies of 4DOS will share the same alias
list, and any changes made to the aliases in one copy will affect all other
copies.

You can control the type of alias list on the Startup page of the
648OPTION dialogs, with the 385LocalAliases directive in 4DOS.INI,
with the /L and /LA 352startup options, and with the /L and /LA
options of the 667START command.

Whenever you start a secondary shell which uses a local alias list, it
inherits a copy of the aliases from the previous shell.  However, any
changes to the aliases 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 alias list in both shells.

If you select a global alias list for 4DOS running under DOS, you can share
the aliases among all copies of 4DOS.  However, if you run 4DOS under OS/2,
global lists will apply within each DOS session, but will not allow you to
share aliases between different DOS sessions.

The UNKNOWN_CMD Alias

If you create an alias with the name UNKNOWN_CMD, it will be executed
any time 4DOS would normally issue an "Unknown command" error message.  This
allows you to define your own handler for unknown commands.  When the
UNKNOWN_CMD alias is executed, the command line which generated the
error is passed to the alias for possible processing.  For example, to
display the command that caused the error:

     alias unknown_cmd `echo Error in command "%&"`

If the UNKNOWN_CMD alias contains an unknown command, it will call itself
repeatedly.  If this occurs, 4DOS will loop up to 10 times,
then display an "UNKNOWN CMD loop" error.

Options

!INDENT 5 5 0 5
     /P:  (Pause) This option is only effective when ALIAS is used to
     display existing definitions.  It pauses the display after each page
     and waits for a keystroke before continuing (see 045Page
     and File Prompts).

     /R:  (Read file) This option loads an alias list from a file.  The
     format of the file is the same as that of the ALIAS display:
!INDENT 5 5 5 5

          name=value

     where name is the name of the alias and value is its
     value.  You can use an equal sign [=] or space to
     separate the name and value.  Back-quotes are not required
     around the value.  You can add comments to the file by
     starting each comment line with a colon [:].  You can
     load multiple files with one ALIAS /R command by placing the
     names on the command line, separated by spaces:

          c:\> alias /r alias1.lst alias2.lst

     Each definition in an ALIAS /R file can be up to 511 characters long.  The
     definitions can span multiple lines in the file if each line, except the
     last, is terminated with an 086escape character.  If there is no
     filename argument and input is redirected, ALIAS /R will read from
     stdin.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 596 ATTRIB
!TTY

Purpose:  Change or view file and subdirectory attributes.

Format:   ATTRIB [/A:[[+|-]rhsad] /D /E /I"text" /N /P /Q /S] [+|-[AHRS]]
          [@file] files ...

          files:  A file, directory, or list of files or directories on
                  which to operate.
          @file:  A text file containing the names of the files on which
                  to operate, one per line (see 057@file lists for
                  details).

          /A: (Attribute select)      /N(othing)
          /D(irectories)              /P(ause)
          /E (no error messages)      /Q(uiet)
          /I (match descriptions)     /S(ubdirectories)

          Attribute flags:

          +A Set the archive attribute    -A Clear the archive attribute
          +H Set the hidden attribute     -H Clear the hidden attribute
          +R Set the read-only attribute  -R Clear the read-only attribute
          +S Set the system attribute     -S Clear the system attribute
!TTY

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Use wildcards with caution on LFN volumes; see 081LFN File Searches for details.

Usage

Every file and subdirectory has four attributes that can be turned on (set)
or turned off (cleared):  Archive, Hidden, Read-only, and System.

The ATTRIB command lets you view, set, or clear attributes for any file,
group of files, or subdirectory.  You can view file attributes by entering
ATTRIB without specifying new attributes (i.e., without the [+|-[AHRS]] part
of the format) or with the DIR /T command.)

The primary use of ATTRIB is to set attributes.  For example, you can set
the read-only and hidden attributes for the file MEMO:

     c:\> attrib +rh memo

Attribute options apply to the file(s) that follow the options on the
ATTRIB command line.  The example below shows how to set different
attributes on different files with a single command.  It sets the archive
attribute for all .TXT files, then sets the system attribute and clears the
archive attribute for TEST.COM:

     c:\> attrib +a *.txt +s -a test.com

You must quote any file names which contain whitespace or special
characters.  See 945File Names for additional details.

To change directory attributes, use the /D switch.  If you give ATTRIB a
directory name instead of a file name, and omit /D, it will append "\*.*"
to the end of the name and act on all files in that directory, rather than
acting on the directory itself.

Your operating system also supports "D" (subdirectory) and "V" (volume
label) attributes.  These attributes cannot be altered with ATTRIB; they
are designed to be controlled only by the operating system itself.

ATTRIB will ignore underlines in the new attribute (the [+|-[AHRS]] part
of the command).  For example, ATTRIB sees these two commands as identical:

     c:\> attrib +a filename
     c:\> attrib +__A_ filename

This allows you to use a string of attributes from either the @ATTRIB
variable function or from ATTRIB itself (both of which use underscores to
represent attributes that are not set) and send that string back to ATTRIB
to set attributes for other files.  For example, to clear the attributes of
FILE2 and then set its attributes to match those of FILE1 (enter this on
one line):

     c:\> attrib -arhs file2 ^ attrib +%@attrib[file1] file2

If you include a +D / -D in the attribute list, it will set the /D
flag automatically.

Options

!INDENT 5 5 0 5
     /A::  (Attribute select) Select only those files that have the
     specified attribute(s) set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed at all (e.g., ATTRIB /A: ...), ATTRIB will
     select all files including hidden and system files.  If attributes are
     combined, all the specified attributes must match for a file to be
     selected.  For example, /A:RHS will select only those files with all
     three attributes set.

     The /A switch specifies which files to select, not which attributes
     to set.  For example, to remove the archive attribute from all hidden
     files, you could use this command:

          c:\> attrib /a:h -a *.*
!INDENT 5 5 0 5

     /D:  (Directories) If you use the /D option, ATTRIB will modify the
     attributes of subdirectories in addition to files (yes, you can have a
     hidden subdirectory):
!INDENT 5 5 5 5

          c:\> attrib /d +h c:\mydir

     In addition, the /D option will keep ATTRIB from appending "\*.*" to
     the end of a directory name and modifying the attributes of all the
     files in the subdirectory.

     If you use a directory name instead of a file name, and omit
     /D, ATTRIB will append "\*.*" to the end of the name and
     act on all files in that directory, rather than acting on
     the directory itself.

!INDENT 5 5 0 5
     /E:  (No error messages) Suppress all non-fatal error messages,
     such as "File not found."  Fatal error messages, such as "Drive not
     ready," will still be displayed.  This option is most useful in batch
     files and aliases.

     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /N:  (Nothing) Do everything except actually change attributes.  This
     option is useful for testing what the result of a complex ATTRIB
     command will be.

     /P:  (Pause) Wait for a key to be pressed after each screen page
     before continuing the display.  Your options at the prompt are
     explained in detail under 045Page and File Prompts.

     /Q:  (Quiet) This option turns off ATTRIB's normal screen output.  It
     is most useful in batch files.

     /S:  (Subdirectories) If you use the /S option, the ATTRIB
     command will be applied to all matching files in the current or
     named directory and all of its subdirectories.  Do not use /S
     with @file lists; see 057@file lists for details.  Unlike most
     4DOS commands, ATTRIB /S will search into subdirectories with the
     hidden or system attributes set.
!INDENT 0

For comparison with the external DOS ATTRIB command refer to
the 65535external DOS help system.
;---------------------------------------------------------------------------
!TOPIC 597 BEEP
!TTY

Purpose:  Beep the speaker or play simple music.

Format:   BEEP [frequency duration ...]

          frequency:  The beep frequency in Hertz (cycles per second).
          duration:   The beep length in 1/18th second intervals.
!TTY

See also:  415BeepFreq and 416BeepLength.

Usage

BEEP generates a sound through your computer's speaker.  It is normally
used in batch files to signal that an operation has been completed, or that
the computer needs attention.

Because BEEP allows you to specify the frequency and duration of the sound,
you can also use it to play simple music or to create different kinds of
signals for the user.

You can include as many frequency and duration pairs as you wish.  No sound
will be generated for frequencies less than 20 Hz, allowing you to use BEEP
as a way to create short delays.  The default value for frequency is 440 Hz;
the default value for duration is 2.

This batch file fragment runs a program called DEMO, then plays a few notes
and waits for you to press a key:

     demo ^ beep 440 4  600 2  1040 6
     pause Finished with the demo - hit a key...

The following table gives the frequency values for a five octave range
(middle C is 262 Hz):

               C       131   262   523   1046  2093
               C#/Db   139   277   554   1108  2217
               D       147   294   587   1174  2349
               D#/Eb   156   311   622   1244  2489
               E       165   330   659   1318  2637
               F       175   349   698   1397  2794
               F#/Gb   185   370   740   1480  2960
               G       196   392   784   1568  3136
               G#/Ab   208   415   831   1662  3322
               A       220   440   880   1760  3520
               A#/Bb   233   466   932   1864  3729
               B       248   494   988   1976  3951
;---------------------------------------------------------------------------
!TOPIC 598 BREAK
!TTY

Purpose:  Display, enable, or disable Ctrl-C and Ctrl-Break checking.

Format:   BREAK [ON | OFF]
!TTY

Usage

The Ctrl-C and Ctrl-Break keys are used by many programs (including 4DOS)
as a signal to interrupt the current operation.  BREAK controls how often
DOS checks to see if you've entered one of these keystrokes.

Normally, BREAK is turned off, and DOS only checks for Ctrl-C and
Ctrl-Break keystrokes during DOS input or output operations involving the
screen, keyboard, serial port, and printer.  However, many programs don't
use DOS for these operations, and it can be difficult to interrupt them.

When BREAK is turned on, DOS checks for Ctrl-C and Ctrl-Break every time a
program calls DOS.  Since most programs use DOS to access files and perform
other functions, turning BREAK on makes it much more likely that a Ctrl-C
or Ctrl-Break will be noticed.  If you turn BREAK on, programs will run
slightly slower than normal (the difference is not usually noticeable).

Turning BREAK on or off only affects when DOS detects Ctrl-C and Ctrl-Break
and notifies the program you're running.  Any program can choose to ignore
these signals.  Also, any program can change the BREAK setting on
its own.

Type BREAK plus ON or OFF to set the BREAK status, or BREAK by itself to
display the current BREAK status.

BREAK is off by default.  You can change the default by adding a BREAK=ON
command to your CONFIG.SYS file.  For more information on this command,
refer to the 65535external DOS help system.
;---------------------------------------------------------------------------
!TOPIC 599 CALL
!TTY

Purpose:  Execute one batch file from within another.

Format:   CALL file

          file:  The batch file to execute.
!TTY

See also: 600CANCEL and 654QUIT.

Usage

CALL allows batch files to call other batch files (batch file nesting).  The
calling batch file is suspended while the called (second) batch file
runs.  When the second batch file finishes, the original batch file resumes
execution at the next command.  If you execute a batch file from inside
another batch file without using CALL, the first batch file is terminated
before the second one starts.

The following batch file fragment compares an input line to "wp" and calls
another batch file if it matches:

     input  Enter your choice:  %%option
     if "%option" == "wp" call wp.bat

4DOS supports batch file nesting up to 16 levels deep.

The current ECHO state is inherited by a called batch file.

The called batch file should always either return (by executing its last
line, or using the QUIT command), or terminate batch file processing with
CANCEL.  Do not restart or CALL the original batch file from within the
called file as this may cause an infinite loop or a stack overflow.

CALL returns an exit code which matches the batch file return code.  You
can test this exit code with the 164%_? or 162%? environment
variable, and use it with 084conditional commands.
;---------------------------------------------------------------------------
!TOPIC 600 CANCEL
!TTY

Purpose:  Terminate batch file processing.

Format:   CANCEL  [value]

          value:  The numeric exit code to return to 4DOS.
!TTY

See also: 599CALL, 624EXIT, and 654QUIT.

Usage

The CANCEL command ends all batch file processing, regardless of the batch
file nesting level.  Use QUIT to end a nested batch file and return to the
previous batch file.

You can CANCEL at any point in a batch file.  If CANCEL is used from within
an alias it will end execution of both the alias and any batch files
which are running at the time.

If you specify a value, CANCEL will set the ERRORLEVEL or exit code to
that value (see the 633IF command, and the 162%? variable).
;---------------------------------------------------------------------------
!TOPIC 601 CD
!TTY

Purpose:  Display or change the current directory.

Format:   CD [/N] [ path | - ]
               or
          CHDIR [/N] [ path | - ]

          path:  The directory to change to, including an optional
                 drive name.

          /N(o extended search)
!TTY

See also: 602CDD, 644MD, 653PUSHD, 655RD, 049CDPATH,
and 047Directory Navigation.

Usage

CD and CHDIR are synonyms.  You can use either one.

CD lets you navigate through a drive's subdirectory structure by changing the
current working directory.  If you enter CD and a directory name, the named
directory becomes the new current directory.  For example, to change to the
subdirectory C:\FINANCE\MYFILES:

     c:\> cd \finance\myfiles
     c:\finance\myfiles>

Every disk drive on the system has its own current directory.  Specifying
both a drive and a directory in the CD command will change the current
directory on the specified drive, but will not change the default drive.
For example, to change the default directory on drive A:

     c:\> cd a:\utility
     c:\>

Notice that this command does not change to drive A:.  Use the CDD command
to change the current drive and directory at the same time.

You should quote the path name if it contains whitespace or special
characters.  See 945File Names for additional details.

You can change to the parent directory with CD ..; you can also go up
one additional directory level with each additional [.].  For example,
CD .... will go up three levels in the directory tree (see
072Extended Parent Directory Names).  You can move to a sibling
directory -- one that branches from the same parent directory as the
current subdirectory -- with a command like CD ..\newdir.

If you enter CD with no argument or with only a disk drive name, it will
display the current directory on the default or named drive.

If CD cannot change to the directory you have specified it will attempt
to search the 049CDPATH and the 048extended directory search
database in order to find a matching directory and switch to it.  You
can use wildcards in the path to force an extended directory search.
See 047Directory Navigation for complete details on these and other
directory navigation features.  To disable extended directory searches
for the current command (e.g. in a batch file) see the /N option
below.

CD saves the current directory before changing to a new directory.  You can
switch back to the previous directory by entering CD - (there must be
a space between the CD command and the hyphen).  You can switch back and
forth between two directories by repeatedly entering CD -.  The saved
directory is the same for both the CD and CDD commands.  Drive changes and
039automatic directory changes also modify the saved directory, so
you can use CD - to return to a directory that you exited with an
automatic directory change.

Directory changes made with CD are also recorded in the directory history
list and can be displayed in the 040directory history window, which allows
you to return quickly to a recently-used directory.

You can use CD . to save the current drive and directory to the directory
history without changing directories.  This might be useful if you use an
external program to navigate directories.  You could create an 595alias
using CD . to stash the current location before calling the external
utility, so you can return later using CDD - or the directory history
window.  For example, to save the current drive and directory before running
a program called ACD:

     alias acd=`cd . %+ c:\utility\acd.exe`

CD never changes the default drive.  If you change directories on one
drive, switch to another drive, and then enter CD -, the directory will
be restored on the first drive but the current drive will not be
changed.  You will probably find 602CDD - more useful than CD -.

Floating drives

Under DR DOS 3.31 - 6.0 (up to 1992 issues), 4DOS fully supports the
DR DOS CD / CHDIR "floating drive" syntax to implicitly specify
ASSIGN or SUBST drives on the fly as follows:

     cd d:=c:          cd d:=c:\path
       or                or
     chdir d:=c:       chdir d:=c:\path

Option

!INDENT 5 5 0 5
     /N:  (No extended search) This option prevents CD from searching
     the 048extended directory search database or displaying the
     related popup window.  If /N is used and the specified directory
     is not found via other methods (i.e. without an extended search),
     CD will display an error.  This option is primarily intended for
     use in batch files where you do not want CD to use "fuzzy"
     directory searching or display an extended search popup window.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 602 CDD
!TTY

Purpose:  Change the current disk drive and directory.

Format:   CDD [/A /D[drive...] /N /S[drive...] /U[drive...] [ path | - ]

          path:   The name of the directory (or drive and directory) to
                  change to.
          drive:  A drive or list of drives to include in the extended
                  directory search database.

          /A(ll drives)               /S (build tree)
          /D(elete from JPSTREE.IDX)  /U(pdate tree)
          /N(o extended search)
!TTY

See also: 601CD, 644MD, 653PUSHD, 655RD, 049CDPATH,
and 047Directory Navigation.

Usage

CDD is similar to the CD command, except that it also changes the default
disk drive if one is specified.  CDD will change to the directory and drive
you name.  To change from the root directory on drive A to the subdirectory
C:\WP:

     a:\> cdd c:\wp
     c:\wp>

You can change to the parent directory with CDD ..; you can also go up
one additional directory level with each additional [.].  For example,
CDD .... will go up three levels in the directory tree (see
072Extended Parent Directory Names).

You should quote the path name if it contains whitespace or special
characters.  See 945File Names for additional details.

If CDD cannot change to the directory you have specified it will attempt to
search the 049CDPATH and the 048extended directory search database in
order to find a matching directory and switch to it.  You can also
use wildcards in the path to force an extended directory search.  See
047Directory Navigation for complete details on these and other directory
navigation features.  To disable extended directory searches for the
current command (e.g. in a batch file) see the /N option below.

CDD saves the current drive and directory before changing to a new
directory.  You can switch back to the previous drive and directory by
entering CDD - (there must be a space between the CDD command and the
hyphen).  You can switch back and forth between two drives and directories
by repeatedly entering CDD -.  The saved directory is the same for both
the CD and CDD commands.  Drive changes and 039automatic directory
changes also modify the saved directory, so you can use CDD - to
return to a directory that you exited with a drive change or an automatic
directory change.

Directory changes made with CDD are also recorded in the directory history
list and can be displayed in the 040directory history window, which allows
you to return quickly to a recently-used directory.

CDD is also used to create and update the 048extended directory search
database (JPSTREE.IDX); see the /D /S and /U options for details.

Options

!INDENT 5 5 0 5
     /A:  (All drives) When CDD is used with this option, it displays the
     current directory on all drives from C: to the last drive in the
     system.  You cannot move to a new drive and directory and use /A in
     the same command.

     /D:  (Delete tree) remove the specified drives or directory trees from
     JPSTREE.IDX.

     /N:  (No extended search) This option prevents CDD from searching
     the 048extended directory search database or displaying the
     related popup window.  If /N is used and the specified directory
     is not found via other methods (i.e. without an extended search),
     CDD will display an error.  This option is primarily intended for
     use in batch files where you do not want CDD to use "fuzzy"
     directory searching or display an extended search popup window.

     /S:  (Search tree) Builds or rebuilds the
     048extended directory search database, JPSTREE.IDX, with the
     specified drives and/or directories.  You cannot
     move to a new drive and directory and use /S in the same command.
!INDENT 5 5 5 5
     To include all local hard drives in the database use the command:

          cdd /s

     To limit or add to the list of drives included in the database, list
     the drives and network volume names (and optionally subdirectory paths)
     after the /S switch.  For example, to include drives C, D, E, and the
     network volume \\server\dir1 in the database, use this command:

          cdd /s cde \\server\dir1

     All non-hidden directories on the listed drives will be indexed;
     you cannot restrict the database to certain directories within a
     drive.  Each time you use /S, everything in the previous directory
     database is replaced by the new database that is created.  If you
     set the 472CompleteHidden directive, CDD will index hidden
     subdirectories as well.

!INDENT 5 5 0 5
     /U:  (Update tree) Updates JPSTREE.IDX with the specified
     drives and/or directories.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 603 CHCP
!TTY

Purpose:  Display or change the current system code page.

Format:   CHCP [n]

          n:  A system code page number.
!TTY

Usage

Code page switching allows you to select different character sets for
language support.  To use code page switching, you must have an EGA or VGA
display and be running under MS-DOS or PC DOS 3.3 or above, DR DOS
3.41 or later, or OS/2.

If you enter CHCP without a number, the current code page is displayed.

If you enter CHCP plus a code page number, the system code page is
changed.  For example, to set the code page to multilingual:

     c:\> chcp 850

Before using CHCP, you must first load the device drivers (in CONFIG.SYS),
make sure the information file (COUNTRY.SYS) is available, load national
language support (using the NLSFUNC command), and prepare the
specified code page for the devices (using the MODE command with
the CODEPAGE PREPARE option).

CHCP accepts one of the prepared system code pages.  An error message is
displayed if a code page is selected that has not been prepared for the
system.

See your 65535DOS or OS/2 documentation for more information on CHCP,
NLSFUNC, and MODE.
;---------------------------------------------------------------------------
!TOPIC 714 CLOSETRAY
!TTY

Purpose:  Close the tray of the specified drive(s).

Format:   CLOSETRAY [drive: ...]

          drive:  The drive or list of drives whose tray to close.
!TTY

See also: 715EJECTMEDIA.

Usage

CLOSETRAY will close the trays of CD-ROMs, DVDs, etc.

If no drives are specified, 4DOS will attempt to close the tray of the first
CD-ROM (DVD) drive.

Note:  DOS kernels don't support CD-ROMs or DVDs directly; a CD-ROM driver
and CD extensions must be installed or the CLOSETRAY command will not work.
Windows 95/98/ME and OS/2 version 3.x and above don't need them; they have
its own CD-ROM driver and support.

Note 2: This command is called LOADMEDIA in 0204NT.
;---------------------------------------------------------------------------
!TOPIC 604 CLS
!TTY

Purpose:  Clear the video display and move the cursor to the upper left
          corner; optionally change the default display and border colors.

Format:   CLS [[BRIght] [BLInk] fg ON [BRIght] bg] [BORder bc]

          fg:  The new foreground color.
          bg:  The new background color.
          bc:  The new border color.
!TTY

Usage

CLS can be used to clear the screen without changing colors, or to clear
the screen and change the screen colors simultaneously.  These three
examples show how to clear the screen to the default colors, to bright
white letters on a blue background, and to bright yellow letters on a
magenta background with a blue border:

     c:\> cls
     c:\> cls bright white on blue
     c:\> cls bri yel on mag bor blu

CLS is often used in batch files to clear the screen before displaying
text.

See 892Colors and Color Names for details about colors and notes on
the use of bright background colors.

If 842ANSI.SYS or a compatible driver is not loaded, the colors will not
be "sticky" -- you may lose them after you run an application.  If your
display accommodates more than 25 rows by 80 columns and CLS doesn't clear
the whole screen, your ANSI driver probably does not support the large
display properly.
;---------------------------------------------------------------------------
!TOPIC 605 COLOR
!TTY

Purpose:  Change the default display colors.

Format:   COLOR [BRIght] [BLInk] fg ON [BRIght] bg [BORder bc]

          fg:  The new foreground color.
          bg:  The new background color.
          bc:  The new border color.
!TTY

See also: 604CLS, and 892Colors and Color Names for details about
using colors.

Usage

COLOR is normally used in batch files before displaying text.  For example,
to set screen colors to bright white on blue, you can use this command:

     c:\> color bright white on blue

If you have an ANSI driver (such as 842ANSI.SYS) installed, COLOR will
not change anything on the screen.  It will only set the default colors for
subsequent screen displays.  If you are not using an ANSI driver, COLOR
will change the display colors of every character on the screen.  However,
the colors will not be "sticky" -- you may lose them after you run an
application.

If you see odd characters like "[44;37m" when you try to set the screen
colors, 4DOS probably thinks you have an ANSI driver loaded when you
don't.  Use 664SETDOS /A2, the Display page of the 648OPTION dialogs,
or 412ANSI = No in 4DOS.INI, to tell 4DOS you have no ANSI driver.
;---------------------------------------------------------------------------
!TOPIC 606 COPY
!TTY

Purpose:  Copy data between disks, directories, files, or physical
          hardware devices (such as your printer or serial port).

Format:   COPY [/A:[[+|-]rhsad] /C /E /G /H /I"text" /K /M /N /O /P /Q /R /S
          /T /U /V /X /Z] [@file] source[+] ... [/A /B] destination

          source:       File or list of files or a device to copy from.
          destination:  File, directory, or device to copy to.
          @file:        Text file containing the names of the source
                        files, one per line (see 057@file lists for
                        details).

          /A(SCII)                    /O (copy if not exist)
          /A: (Attribute select)      /P(rompt)
          /B(inary)                   /Q(uiet)
          /C(hanged)                  /R(eplace)
          /E (no error messages)      /S(ubdirectories)
          /G (display percent)        /T(otals)
          /H(idden)                   /U(pdate)
          /I (match description)      /V(erify)
          /K(eep attributes)          /X (clear archive)
          /M(odified)                 /Z (overwrite)
          /N(othing)
!TTY

See also: 596ATTRIB, 646MOVE, and 658REN.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.  074Date, time, size, or 078exclude
ranges anywhere on the line apply to all source files.

Use extended wildcards with caution on LFN volumes; see
081LFN File Searches for details.

Usage

The COPY command accepts all traditional syntax and options and adds
many new features.

The simplest use of COPY is to make a copy of a file, like this example
which makes a copy of a file called FILE1.ABC:

     c:\> copy file1.abc file2.def

You can also copy a file to another drive and/or directory.  The following
command copies FILE1 to the \MYDIR directory on drive E:

     c:\> copy file1 e:\mydir

Copying Files

You must quote any file names which contain whitespace or special
characters.  See 945File Names for additional details.

You can copy several files at once by using 073wildcards:

     c:\> copy *.txt e:\mydir

You can also list several source files in one command.  The following
command copies 3 files from the current directory to the \MYDIR directory
on drive E:

     c:\> copy file1 file2 file3 e:\mydir

COPY also understands 080include lists, so you can specify several
different kinds of files in the same command.  This command copies the
.TXT, .DOC, and .BAT files from the E:\MYDIR directory to the root directory
of drive A:

     c:\> copy e:\mydir\*.txt;*.doc;*.bat a:\

If there is only one argument on the line, COPY assumes it is the source,
and uses the current drive and directory as the destination.  For example,
the following command copies all the .DAT files on drive A to the current
directory on drive C:

     c:\data> copy a:*.dat

If there are two or more arguments on the line, separated by spaces,
then COPY assumes that the last argument is the destination and
copies all source files to this new location.  If the destination is a
drive, directory, or device name then the source files are copied
individually to the new location.  If the destination is a file name, the
first source file is copied to the destination, and any additional source
files are then appended to the new destination file.

For example, the first of these commands copies the .DAT files from the
current directory on drive A individually to C:\MYDIR (which must already
exist as a directory); the second appends all the .DAT files together into
one large file called C:\DATA (assuming C:\DATA is not a directory):

     c:>\ copy a:*.dat c:\mydir\
     c:>\ copy a:*.dat c:\data

When you copy to a directory, if you add a backslash [\] to the end of
the name as shown in the first example above, COPY will display an error
message if the name does not refer to an existing directory.  You can use
this feature to keep COPY from treating a mistyped destination directory
name as a file name and attempting to append all your source files to a
destination file, when you really meant to copy them individually to a
destination directory.

To copy a file to a device such as the printer, use the device name as the
destination, for example:

     c:\> copy schedule.txt prn

To copy text to or from the clipboard use CLIP: as the device name.  Using
CLIP: with non-text data will produce unpredictable results.  See
051Redirection for additional information on CLIP:, including on when you
can use the clipboard under 4DOS.

Appending Files

A plus [+] tells COPY to append two or more files to a single
destination file.  If you list several source files separated with [+]
and don't specify a destination, COPY will use the name of the first source
file as the destination, and append each subsequent file to the first file.

For example, the following command will append the contents of C:\MEMO2 and
C:\MEMO3 to C:\MEMO1 and leave the combined contents in the file named
C:\MEMO1:

     c:\> copy memo1+memo2+memo3

To append the same three files but store the result in BIGMEMO:

     c:\> copy memo1+memo2+memo3 bigmemo

If no destination is specified, the destination file will always be created
in the current directory even if the first source file is in another
directory or on another drive.  For example, this command will append
C:\MEM\MEMO2 and C:\MEM\MEMO3 to D:\DATA\MEMO1, and leave the result in
C:\MEM\MEMO1:

     c:\mem> copy d:\data\memo1+memo2+memo3

You cannot append files to a device (such as a printer); if you try to
do so, COPY will ignore the [+] signs and copy the files individually.  If
you attempt to append several source files to a destination directory or
disk, COPY will append the files and place the copy in the new location
with the same name as the first source file.

Advanced Features

If your destination has wildcards in it, COPY will attempt to match them
with the source names.  For example, this command copies the .DAT files
from drive A to C:\MYDIR and gives the new copies the extension .DX:

     c:\> copy a:*.dat c:\mydir\*.dx

This feature can give you unexpected results if you use it with multiple
source file names.  For example, suppose that drive A contains XYZ.DAT and
XYZ.TXT.  The command:

     c:\> copy a:\*.dat a:\*.txt c:\mydir\*.dx

will copy A:XYZ.DAT to C:\MYDIR\XYZ.DX.  Then it will copy A:XYZ.TXT to
C:\MYDIR\XYZ.DX, overwriting the first file it copied.

COPY also understands 080Include Lists, so you can specify several
different kinds of files in the same command.  This command copies the
.TXT, .DOC, and .BAT files from the E:\MYDIR directory to the root
directory of drive A:

     c:\> copy e:\mydir\*.txt;*.doc;*.bat a:\

You can use 074Date, Time, and Size Ranges to further define the
files that you want to copy.  This example copies every file in the
E:\MYDIR directory, which was created or modified yesterday, and which is
also 10,000 bytes or smaller in size, to the root directory of drive A:

     c:\> copy /[d-1] /[s0,10000] e:\mydir\*.* a:\

You can also use file 078exclusion ranges to restrict the list of files
that would normally be selected with wildcards.  This example copies every
file in the E:\MYDIR directory except backup (.BAK or .BK!) files:

     c:\> copy /[!*.bak;*.bk!] e:\mydir\*.* a:\

COPY will normally process source files which do not have the hidden or
system attribute, and will ignore the read-only and archive attributes.  It
will always set the archive attribute and clear the read-only attribute of
destination files.  In addition, if the destination is an existing file with
the read-only attribute, COPY will generate an "Access Denied" error and
refuse to overwrite the file.  You can alter some of these behaviors with
switches:

!INDENT 10 5 5 5
     /A:  Forces COPY to process source files with the attributes you
     specify after the ":", or to process all source files regardless
     of attributes (if /A: is used by itself).

     /H   Forces COPY to process hidden and system source files, as well
     as normal files.  The hidden and system attributes from each source
     file will be preserved when creating the destination files.

     /K   Retains the read-only attribute from each source file when
     creating the destination file.  See /K below for a special note if
     you are running under Novell NetWare.

     /Z   Forces COPY to overwrite an existing read-only destination file.
!INDENT 0

Use caution with /A:, /H, or /K when both the source and destination
directories contain file descriptions.  If the source file specification
matches the description file name (normally DESCRIPT.ION), and you use a
switch which tells COPY to process hidden files, the DESCRIPT.ION file
itself will be copied, overwriting any existing file descriptions in the
destination directory.  For example, if the \DATA directory contains file
descriptions this command would overwrite any existing descriptions in the
\SAVE directory:

     c:\data> copy /h d*.* \save\

If you remove the hidden attribute from the DESCRIPT.ION file the same
caution applies even if you do not use /A:, /H, or /K, as DESCRIPT.ION
is then treated like any other file.  You can use an 078exclusion range
to prevent the descriptions file from being copied:

     c:\data> copy /[!%192_dname] /h d*.* \save\

If you are using 4DOS in an OS/2 DOS session, COPY will copy OS/2 extended
attributes from the source to the destination, if the file system on the
destination drive supports them.

Under Windows 95/98/ME, if you COPY files with long filenames to a volume which
does not support them, 4DOS will store the destination files with their short,
FAT-compatible names.  You can view the short names before executing the
COPY with the 612DIR /X command.  See 945File Names for additional
details.

Options

The /A(SCII) and /B(inary) options apply to the preceding filename and
to all subsequent filenames on the command line until the file name
preceding the next /A or /B, if any.  The other options (/A:, /C,
/E, /H, /K, /M, /N, /P, /Q, /R, /S, /T, /U, /V,
/X, /Z) apply to all filenames on the command line, no matter where you
put them.  For example, either of the following commands could be used to
copy a font file to the printer in binary mode:

     c:\> copy /b myfont.dat prn
     c:\> copy myfont.dat /b prn

Some options do not make sense in certain contexts, in which case COPY will
ignore them.  For example, you cannot prompt before replacing an existing
file when the destination is a device such as the printer -- there's no such
thing as an "existing file" on the printer.  If you use conflicting output
options, like /Q and /P, COPY will generally take a "conservative"
approach and give priority to the option which generates more prompts or
more information.

!INDENT 5 5 0 5
     /A:  (ASCII) If you use /A with a source filename, the file will
     be copied up to, but not including, the first Ctrl-Z (Control-Z or 
     ASCII 26) character in the file.  (Some old applications use the 
     Ctrl-Z to mark the end of a file).  If you use /A with a destination 
     filename, a Ctrl-Z will be added to the end of the file.  /A is the 
     default when appending files, or when the destination is a device 
     like NUL or PRN, rather than a disk file.  Also see /B.

     /A:: (Attribute select) Select only those files that have the specified
     attribute(s) set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      S  System
          H  Hidden         A  Archive

     If no attributes are listed at all (e.g., COPY /A: ...), COPY will
     select all files including hidden and system files (this is
     equivalent to COPY /H).  If attributes are combined, all the specified
     attributes must match for a file to be selected.  For example, /A:RHS
     will select only those files with all three attributes set.

     You must include the colon with this option to distinguish it from the
     /A(SCII) switch, above.

     See the cautionary note under Advanced Features above before using
     /A: when both source and destination directories contain file
     descriptions.
!INDENT 5 5 0 5

     /B:  (Binary) If you use /B with a source filename, the entire
     file is copied; Ctrl-Z characters in the file do not affect
     the copy operation.  Using /B with a destination
     filename prevents addition of a Ctrl-Z to the end of the
     destination file.  /B is the default for normal file
     copies.  Also see /A.

     /C:  (Changed files) Copy files only if the destination file
     exists and is older than the source (see also /U).  This option
     is useful for updating the files in one directory from those in 
     another without copying any newly created files.  (Before using
     /C in a network environment be sure to read the note under /U.)

     /E:  (No Error messages) Suppress all non-fatal error messages, such
     as "File not found."  Fatal error messages, such as "Drive not ready,"
     will still be displayed.  This option is most useful in batch files and
     aliases.

     /G:  Displays the percent copied.  This is useful when copying large
     files across a network to ensure the copy is proceeding.

     /H:  (Hidden) Copy all matching files including those with the hidden
     and/or system attribute set.  See the cautionary note under Advanced
     Features above before using /H when both source and destination
     directories contain file descriptions.

     /I"text":  Select source files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /K:  (Keep attributes) To maintain compatibility with COMMAND.COM
     and NetWare, COPY normally maintains the hidden and system attributes,
     sets the archive attribute, and removes the read-only attribute on the
     target file.  /K tells COPY to also maintain the read-only attribute
     on the destination file.  However, if the destination is on a Novell
     NetWare volume, this option will fail to maintain the read-only
     attribute.  This is due to the way NetWare handles file attributes, and
     is not a problem in COPY.

     /M:  (Modified) Copy only those files with the archive attribute set,
     i.e., those which have been modified since the last backup.
     The archive attribute of the source file will not be cleared after
     copying; to clear it use the /X switch or use 596ATTRIB.

     /N:  (Nothing) Do everything except actually perform the copy.  This
     option is useful for testing what the result of a complex
     COPY command will be.  /N does not prevent creation of destination
     subdirectories when it is used with /S.

     /O:  Only copy the source file if the target file doesn't exist.

     /P:  (Prompt) Ask the user to confirm each source file.  Your options
     at the prompt are explained in detail under 045Page and File Prompts.

     /Q:  (Quiet) Don't display filenames or the total number of files copied.
     This option is most often used in batch files.  See also
     /T.

     /R:  (Replace) Prompt the user before overwriting an existing
     file.  Your options at the prompt are explained in detail under
     045Page and File Prompts.  See also the 4DOS.INI 450CopyPrompt
     directive.

     /S:  (Subdirectories) Copy the subdirectory tree starting with the
     files in the source directory plus each subdirectory below that.  The
     destination must be a directory; if it doesn't exist, COPY will attempt
     to create it.  COPY will also attempt to create needed subdirectories
     on the tree below the destination, including empty source
     directories.  If COPY /S creates one or more destination directories,
     they will be added automatically to the 048Extended Directory Search
     database.

!INDENT 5 5 5 5
     If you attempt to use COPY /S to copy a subdirectory tree into part
     of itself, COPY will detect the resulting infinite loop, display an
     error message, and exit.

     Do not use /S with @file lists; see 057@file lists for details.

     Note that COPY /S will not search into subdirectories with the hidden
     or system attributes set unless you also specify /A: or /H.
!INDENT 5 5 0 5

     /T:  (Totals) Turns off the display of filenames, like /Q, but does
     display the total number of files copied.

     /U:  (Update) Copy each source file only if it is newer than a matching
     destination file or if a matching destination file does not
     exist (see also /C).  This option is useful for keeping
     one directory matched with another with a minimum of
     copying.

!INDENT 5 5 5 5
     The time comparisons used with /U may not always work
     reliably across a network, due to differences in time zone and
     in the file time storage method between the local and remote
     systems.  Be sure to do some non-destructive testing (e.g. with
     /N) before depending on this option to yield the results you
     want in a network environment.
!INDENT 5 5 0 5

     /V:  (Verify) Verify each disk write.  This is the same as executing
     the 682VERIFY ON command, but is only active during
     the COPY.  /V does not read back the file and compare its contents
     with what was written; it only verifies that the data written to disk
     is physically readable.

     /X:  (Clear Archive) Clear the archive attribute from the source
     file after a successful copy.  This option is most useful if you are
     using COPY to maintain a set of backup files.

     /Z:  (Overwrite) Overwrite read-only destination files.  Without
     this option, COPY will fail with an "Access denied" error if the
     destination file has its read-only attribute set.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 776 COUNTRY
!TTY

Purpose:  Display or change the current country.

Format:   COUNTRY [n]

          n:  A country code.
!TTY

Usage

COUNTRY can change "on the fly" the current country-specific DOS conventions
for displaying times, dates and currency, for determining the order by which
characters are sorted, and for determing which characters can be used in
filenames.  It affects all DOS programs and not just 4DOS.  It can configure
them to recognize the punctuation conventions observed when using a language
supported by the currently running version of DOS.

Country settings are usually set by a COUNTRY= directive in your CONFIG.SYS
file.  To change the current country settings using the COUNTRY command of
4DOS without a reboot, you must be running MS-DOS or PC DOS 3.0 or later.

If you enter COUNTRY without a country code, the current country code is
displayed.

If you enter COUNTRY plus a country code, the country settings are
changed.  For example, to set the country settings to those for Germany:

     c:\> country 49

The country codes supported by MS-DOS 6.22 are shown bellow in the table
below.  Note that the older DOS versions support only a subset of these
codes.  PC DOS 2000 supports only a subset of these codes too, but supports
also a few additional ones.  For the actual country codes supported by your
version of DOS, see 65535its documentation.  The leading zero(s) may be
omitted.

Albania. . . . . . 355     Germany. . . . . . 049     PR of China. . . . 086
Arabic Countries . 785     Greece . . . . . . 030     Poland . . . . . . 048
Argentina. . . . . 054     Hong Kong. . . . . 852     Portugal . . . . . 351
Australia. . . . . 061     Hungary. . . . . . 036     Romania. . . . . . 040
Austria. . . . . . 043     Iceland. . . . . . 354     Russia . . . . . . 007
Belgium. . . . . . 032     India. . . . . . . 091     Serbia/Montenegro. 381
Bosnia/Herzegovina 387     Internat. English. 061     Singapore. . . . . 065
Brazil . . . . . . 055     Ireland. . . . . . 353     Slovakia . . . . . 421
Bulgaria . . . . . 035|359 Israel . . . . . . 972     Slovenia . . . . . 386
Canada French. . . 002     Italy. . . . . . . 039     South Africa . . . 027
Canada English . . 004     Japan. . . . . . . 081     Spain. . . . . . . 034
Chile. . . . . . . 056     Korea. . . . . . . 082     Sweden . . . . . . 046
Colombia . . . . . 057     Latin America. . . 003     Switzerland. . . . 041
Croatia. . . . . . 384     Macedonia [FYR of] 389     Taiwan [Ch.Taipei] 886
Czech Republic . . 042     Malaysia . . . . . 060     Turkey . . . . . . 090
Denmark. . . . . . 045     Mexico . . . . . . 052     United Kingdom . . 044
Ecuador. . . . . . 593     Netherlands. . . . 031     United States. . . 001
Finland. . . . . . 358     New Zealand. . . . 064     Venezuela. . . . . 058
France . . . . . . 033     Norway . . . . . . 047     Yugoslavia . . . . 038

Before using COUNTRY, you must make sure the information file (COUNTRY.SYS)
is available and load national language support (using the NLSFUNC command).
See your 65535DOS documentation for more information on NLSFUNC.
;---------------------------------------------------------------------------
!TOPIC 607 CTTY
!TTY

Purpose:  Change the default console device.

Format:   CTTY device

          device:  The new console device.
!TTY

Usage

Normally, 4DOS uses the keyboard as the standard input device and the
display as the standard output device.  Together, the keyboard and display
are known as the console or CON.  The CTTY command allows you to substitute
another device that can perform standard character I/O for the console.

For example to change the console to the first serial port:

     c:\> ctty com1

Change the console back to the standard keyboard and display (this command
must be entered from the current console, e.g., a terminal attached to
COM1, or from a batch file):

     c:\> ctty con

CTTY works only for programs and commands that use standard DOS input and
output functions.  This includes all 4DOS internal commands except
616DRAWBOX, 617DRAWHLINE, 618DRAWVLINE, 640LIST,
660SCREEN, 661SCRPUT, 662SELECT, and 684VSCRPUT.  In addition,
if you use color-coded directories you should disable them
with 612DIR /D when using CTTY.  Otherwise, directories will not be
displayed correctly.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 608 DATE
!TTY

Purpose:  Display and optionally change the system date.

Format:   DATE [/T] [mm-dd-yy]

          /T:  (Display only)
          mm:  The month (1 - 12).
          dd:  The day (1 - 31).
          yy:  The year (00 - 99, or a 4-digit year).
!TTY

See also: 672TIME.

Usage

If you simply type DATE without any parameters, you will see the current
system date and time, and be prompted for a new date.  Press ENTER if you
don't wish to change the date.  If you type a new date, it will become the
current system date, which is included in the directory entry for each file
as it is created or altered:

     c:\> date
     Mon  June 19, 2000  9:30:06
     Enter new date (mm-dd-yy):

You can also enter a new system date by typing the DATE command plus the
new date on the command line:

     c:\> date 6-19-2000

You can use hyphens, slashes, or periods to separate the month, day, and year
entries.  The year can be entered as a 2-digit or 4-digit value.  Two-digit
years between 80 and 99 are interpreted as 1980 - 1999; values between 00 and
79 are interpreted as 2000 - 2079.

DATE adjusts the format it expects depending on your country settings.
When entering the date, use the correct format for the country setting
currently in effect on your system.

You can also use the ISO 8601 international date format "yyyy-mm-dd",
the ISO 8601 week date format "yyyy-Www-d", where yyyy = year, ww = week,
d = week day, or the ISO 8601 ordinal date format "yyyy-ddd", where
yyyy = year, ddd = day of the year.

Options

!INDENT 5 5 0 5
     /T:  (Display only)  Displays the current date but does not prompt
     you for a new date.  If a new date is specified in the same command
     as /T, the new date will be ignored.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 609 DEL
!TTY

Purpose:  Erase one file, a group of files, or entire subdirectories.

Format:   DEL [/A:[[+|-]rhsad] /E /F /I"text" /N /P /Q /S /T /W /X /Y /Z]
          [@file] file...
               or
          ERASE [/A:[[+|-]rhsad] /E /F /I"text" /N /P /Q /S /T /W /X /Y /Z]
          [@file] file...

          file:   The file, subdirectory, or list of files or
                  subdirectories to erase.
          @file:  A text file containing the names of the files or
                  directories to delete, one per line (see 057@file lists
                  for details).

          /A: (Attribute select)      /S(ubdirectories)
          /E (no error messages)      /T(otal)
          /F(orce delete)             /W(ipe)
          /I (match descriptions)     /X (remove empty subdirectories)
          /N(othing)                  /Y(es to all prompts)
          /P(rompt)                   /Z(ap hidden and read-only files)
          /Q(uiet)
!TTY

File Selection

Supports extended 073wildcards, 074ranges (see below for
conditions), 079multiple file names, and 080include lists.

Use wildcards with caution on LFN volumes; see 081LFN File Searches for
details.

Usage

DEL and ERASE are synonyms, you can use either one.

Use the DEL and ERASE commands with caution; the files and
subdirectories that you erase may be impossible to recover without
specialized utilities and a lot of work.

To erase a single file, simply enter the file name:

     c:\> del letters.txt

You can also erase multiple files in a single command.  For example, to
erase all the files in the current directory with a .BAK or .PRN extension:

     c:\> del *.bak *.prn

You must quote any file names which contain whitespace or special
characters.  See 945File Names for additional details.

To exclude files from a DEL command, use a 078file exclusion range.  For
example, to delete all files in the current directory except those whose
extension is .TXT, use a command like this:

     c:\> del /[!*.TXT] *.*

When using exclusion ranges or other more complex options you may want to use
the /N switch first, to preview the effects of the DEL without actually
deleting any files.

If you enter a subdirectory name, or a filename composed only of wildcards
(* and / or ?), DEL asks for confirmation (Y or N) unless you
specified the /Y option.  If you respond with a Y, DEL will delete
all the files in that subdirectory (hidden, system, and read-only files are
only deleted if you use the /Z option).

DEL displays the amount of disk space recovered, unless the /Q option
is used (see below).  It does so by comparing the amount of free disk space
before and after the DEL command is executed.  This amount may be incorrect
if you are using a deletion tracking system which stores deleted files in a
hidden directory, or if, under a multitasking system, another program
performs a file operation while the DEL command is executing.

Remember that DEL removes file descriptions along with files.  Most
deletion tracking systems will not be able to save or recover a file's
description, even if they can save or recover the data in a file.

Use caution when using wildcards with DEL under Windows 95/98/ME.  For
compatibility with COMMAND.COM, 4DOS's wildcard matching will match both
short and long filenames.  This can delete files you did not expect; see
081LFN File Searches for additional details.

When a file is deleted, its disk space is returned to the operating system
for use by other files.  However, the contents of the file remain on the
disk until they are overwritten by another file.  If you wish to obliterate
a file or wipe its contents clean, use DEL /W, which overwrites the file
with zeros before deleting it.  Use this option with caution once a file is
obliterated, it is impossible to recover.

DEL returns a non-zero exit code if no files are deleted, or if another
error occurs.  You can test this exit code with the 162%_? environment
variable, and use it with 084conditional commands) (&& and ||).

Options

!INDENT 5 5 0 5
     /A::  (Attribute select) Delete only those files that have the specified
     attribute(s) set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      S  System
          H  Hidden         A  Archive

     If no attributes are listed at all (e.g., DEL /A: ...), DEL will
     delete all files including hidden and system files.  If attributes
     are combined, all the specified attributes must match for a file
     to be selected for deletion.  For example, /A:RHS will select only
     those files with all three attributes set.
!INDENT 5 5 0 5

     /E:  (No error messages):  Suppress all non-fatal error messages,
     such as "File not found."  Fatal error messages, such as "Drive not
     ready," will still be displayed.  This option is most useful in batch
     files and aliases.

     /F:  (Force delete) This option is only for use when running 4DOS in
     an OS/2 2.1 or later DOS session.  It forces deletion of the
     file without saving it to the DELDIR directory (if DELDIR is
     not in use, /F has no effect).

     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /N:  (Nothing) Do everything except actually delete the file(s).  This
     is useful for testing what the result of a DEL would be.

     /P:  (Prompt) Prompt the user to confirm each erasure.  Your options
     at the prompt are explained in detail under 045Page and
     File Prompts.

     /Q:  (Quiet) Don't display filenames as they are deleted, or the number
     of files deleted or bytes freed.  When running 4DOS under
     DOS, DEL will run fastest if you specify the /Q option
     and the filename doesn't use the extended 4DOS wildcards.  When running
     4DOS under OS/2, /Q will have little or no
     effect on DEL's speed.  See also /T.

     /S:  (Subdirectories) Delete the specified files in this directory
     and all of its subdirectories.  This is can be used to delete all the
     files in a subdirectory tree or even a whole disk.  It should be used
     with caution! Do not use /S with 057@file lists.  Note that DEL
     /S will not search into subdirectories with the hidden or system
     attributes set unless you also specify /A: or /Z.

     /T:  (Total) Don't display filenames as they are deleted, but display
     the total number of files deleted plus the amount of free disk
     space recovered.  Unlike /Q, the /T option will not
     speed up deletions under DOS.

     /W:  (Wipe) Clear the file to zeros before deleting it.  Use this
     option to completely obliterate a file's contents from your disk.  Once
     you have used this option it is impossible to recover the file even if
     you are using an undelete utility, because the contents of the file are
     destroyed before it is deleted.  /W overwrites the file only once; it
     does not adhere to security standards which require multiple
     overwrites with varying data when destroying sensitive information.

     /X:  (Remove subdirectories) Remove empty subdirectories
     after deleting (only useful when used with /S).  If DEL deletes
     one or more directories, they will be removed automatically from the
     048extended directory search.

     /Y:  (Yes) The reverse of /P -- it assumes a Y response to
     everything, including deleting an entire subdirectory tree.  4DOS
     normally prompts before deleting files when the name
     consists only of wildcards or a subdirectory name (see
     above); /Y overrides this protection, and should be used
     with extreme caution!

     /Z:  (Zap) Delete read-only, hidden, and system files as well as
     normal files.  Files with the read-only, hidden, or system
     attribute set are normally protected from deletion; /Z
     overrides this protection, and should be used with caution.  Because
     623EXCEPT works by hiding files, /Z will
     override an EXCEPT command.  However, files specified in a
     078file exclusion range will not be deleted by DEL /Z.
!INDENT 5 5 5 5

     For example, to delete the entire subdirectory tree starting
     with C:\UTIL, including hidden and read-only files, without
     prompting (use this command with CAUTION!):

          c:\> del /sxyz c:\util\
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 610 DELAY
!TTY

Purpose:  Pause for a specified length of time.

Format:   DELAY [/B /M time]

          time:  The number of seconds or milliseconds to delay.

          /B(reak enabled)       /M(illiseconds)
!TTY

Usage

DELAY is useful in batch file loops while waiting for something to occur.
To wait for 10 seconds:

     delay 10

DELAY is most useful when you need to wait a specific amount of time for an
external event, or check a system condition periodically.  For example, this
batch file checks the battery status (as reported by your Advanced Power
Management drivers) every 15 seconds, and gives a warning when battery life
falls below 30%:

     do forever
        iff %_apmlife lt 30 then
           beep 440 4 880 4 440 4 880 4
           echo Low Battery!!
        endiff
        delay 15
     enddo

The time value can be as large as 1,073,741,823 seconds (over 34 years!).
If you don't enter a time, the default is 1 second.

4DOS uses the minimum possible processor time during a DELAY,
in order to allow other applications full use of system resources.

You can cancel a delay by pressing Ctrl-C or Ctrl-Break.

Options

!INDENT 5 5 0 5
     /B:  (Break)  Allows terminating a DELAY by pressing a key.

;!INDENT 5 5 5 5
     /M:  (Milliseconds)  Count by milliseconds instead of seconds.
     Normally only used for delays of less than 1 second.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 611 DESCRIBE
!TTY

Purpose:  Create, modify, or delete file and subdirectory descriptions.

Format:   DESCRIBE [/A:[[+|-]rhsad] /I"text"][@file] file [[/D]"desc"]

          file:           The file, directory, or list of files and
                          directories to operate on.
          @file:          A text file containing the names of the files to
                          describe, one per line (see 057@file lists for
                          details).
          "desc":         The description to attach to the file.

          /A: (Attribute select)        /I (Match descriptions)
          /D(escription follows)
!TTY

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Use wildcards with caution on LFN volumes; see 081LFN File Searches for
details.

Usage

DESCRIBE adds descriptions to files and subdirectories.  The descriptions
can be displayed by 612DIR in single-column mode, and by
662SELECT.  Descriptions let you identify your files in much more
meaningful ways than you can in an eight-character filename.

You enter a description on the command line by typing the DESCRIBE command,
the filename, and the description in quotation marks, like this:

     c:\> describe memo.txt "Memo to Bob about party"

If you don't put a description on the command line, DESCRIBE will prompt
you for it:

     c:\> describe memo.txt
     Describe "memo.txt" : Memo to Bob about party

If you use wildcards or multiple filenames with the DESCRIBE command and
don't include the description text, you will be prompted to enter a
description for each file.  If you do include the description on the
command line, all matching files will be given the same description.

You must quote the file name if it contains whitespace or special
characters.  See 945File Names for additional details.

If you enter a quoted description on the command line, and the text matches
the name of a file in the current directory, 4DOS will
treat the string as a quoted file name, not as description text as you
intended.  To resolve this problem use the /D switch immediately prior
to the quoted description (with no intervening spaces).  For example, if
the current directory contains the files DATA.TST and "Test File", the
first of these commands will work as intended, but the second will not
(in the second example the string "test file" will be treated as a
second file name, when it is intended to be description text):

     c:\> describe data.tst /D"test file"
     c:\> describe data.tst "test file"

On drives which support long file names you will not see file descriptions
in a normal DIR display, because DIR must leave space for the long
filenames.  To view the descriptions, use DIR /Z to display the directory
in FAT format.  See 945File Names and the 612DIR command for
more details.

Each description can be up to 511 characters long.  You can change this
limit with the 422DescriptionMax directive in 4DOS.INI.  In order to fit
your descriptions on a single line in a standard DIR display, keep them to
39 characters or less (longer descriptions are wrapped in the DIR output).
DESCRIBE can edit descriptions longer than DescriptionMax (up to 511
characters), but will not allow you to lengthen the existing text.

The descriptions are stored in each directory in a hidden file called
DESCRIPT.ION.  Use the 596ATTRIB command to remove the hidden attribute
from this file if you need to copy or delete it.  DESCRIPT.ION is always
created as a hidden file, but will not be re-hidden by 4DOS if you remove the
hidden attribute.

You can change the description file name with the 664SETDOS /D command,
or the 423DescriptionName directive in 4DOS.INI, and
retrieve it with the %192_DNAME internal variable.  Use caution when
changing the description file name, as changing the name from the default
will make it difficult to transfer file descriptions to another system.

The description file is modified appropriately whenever you perform an
internal command which affects it (such as 606COPY, 646MOVE,
609DEL, or 658REN), but not if you use an external
program (such as XCOPY or a visual shell).  You can disable description
processing on the Options 1 page of the 648OPTION dialogs, with the
424Descriptions directive in 4DOS.INI, or with 664SETDOS /D.

When you COPY or MOVE files between two directories, both of which have
descriptions, and you use switches which enable processing of hidden files
(or you have removed the hidden attribute from DESCRIPT.ION), you must use
caution to avoid overwriting existing file descriptions in the destination
directory with the DESCRIPT.ION file from the source directory.  See the
notes under the Advanced Features sections of 606COPY and 646MOVE
for additional details.

Options

!INDENT 5 5 0 5
     /A::  (Attribute select) Select only those files that have the specified
     attribute(s) set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed at all (e.g., DESCRIBE /A: ...), DESCRIBE will select
     all files and subdirectories including hidden and system files.  If
     attributes are combined, all the specified attributes must match for a
     file to be selected.  For example, /A:RHS will select only those
     files with all three attributes set.
!INDENT 5 5 0 5

     /D:  (Description follows) The quoted string immediately
     following this switch is a description, not a file name.  Use /D
     to avoid any ambiguity in the meaning of quoted strings.  See the
     Usage section above for details.

     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 612 DIR
!TTY

Purpose:  Display information about files and subdirectories.

!NOWRAP
Format:   DIR [/1 /2 /4 /A[[:][+|-]rhsad] /B /C[HP] /D /E /F /G /H /I"text"
          /J /K /L /M /N /O[[:][-]acdeginrsu] /P /R /S /T[:acw] /U[1|2] /V
          /W /X /Z] [file...]
!WRAP

          file:  The file, directory, or list of files or directories
                 to display.

          /1 (one column)             /L(ower case)
          /2 (two columns)            /M (suppress footer)
          /4 (four columns)           /N(ormal display)
          /A (Attribute select)       /O(rder)
          /B(are)                     /P(ause)
          /C[HP] (Compression)        /R (disable wRap)
          /D(isable color)            /S(ubdirectories)
          /E (use upper case)         /T (aTtribute)
          /F(ull path)                /U (sUmmary information)
          /G (allocated size)         /V(ertical sort)
          /H(ide dots)                /W(ide)
          /I (match descriptions)     /X (display short names)
          /J(ustify names)            /Z (use FAT format)
          /K (suppress header)
!TTY

See also: 596ATTRIB, 611DESCRIBE, 662SELECT, and 664SETDOS.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Usage

DIR can be used to display information about files from one or more of your
disk directories, in a wide range of formats.  Depending on the options
chosen, you can display the file name, attributes, and size; the time and
date of the last change to the file; the file description; and the file's
compression ratio.  You can also display information in 1, 2, 4, 5, or more
columns, sort the files several different ways, use color to distinguish
file types, and pause after each full screen.

The various DIR displays are controlled through options or switches. The
best way to learn how to use the many options available with the DIR
command is to experiment.  You will soon know which options you want to use
regularly.  You can select those options permanently by using the 595ALIAS
command.  You can override aliases by prefixing a switch with a - to
disable it.

For example, to display all the files in the current directory, in 2
columns, sorted vertically (down one column then down the next), and with a
pause at the end of each page:

     c:\> dir /2/p/v

To set up this format as the default, using an alias:

     c:\> alias dir=*dir /2/p/v

You must quote any file names which contain whitespace or special
characters.  See 945File Names for additional details.

The following sections group DIR's features together in several
categories.  Many of the sections move from a general discussion to more
technical material.  If you find some of the information in a category too
detailed for your needs, feel free to skip to the beginning of the next
section.  The sections are:

     Selecting Files
     Default DIR Output Format
     Switching Formats
     Multiple Column Displays
     Color-Coded Directories
     Redirected Output
     Other Notes
     Options


Selecting Files

DIR can display information about a single file or about several, dozens,
hundreds, or thousands of files at once.  To display information about a
single file, just add the name of the file to the DIR command line:

     c:\> dir january.wks

The simplest way to view information about several files at once is to use
073wildcards.  DIR can work with traditional wildcard characters (* and
?) and extended wildcards.  For example to display all of the .WKS files in
the current directory:

     c:\> dir *.wks

To display all .TXT files whose names begin with A, B, or C:

     c:\> dir [abc]*.txt

If you don't specify a filename, DIR defaults to *.* on traditional FAT
drives, and * on LFN drives.  This default displays all non-hidden
files and subdirectories in the current directory.  If you specify a
filename for a non-LFN drive which includes some wildcards, and does not
include an extension, DIR will append .* to it to match all extensions.

If you link two or more filenames together with spaces, DIR will display all
of the files that match the first name and then all of the files that match
the second name.  You may use a different drive and path for each
filename.  This example lists all of the .WKS and then all of the .WK1 files
in the current directory:

     c:\> dir *.wks *.wk1

If you use an 080include list to link multiple filenames, DIR will
display the matching filenames in a single listing.  Only the first filename
in an include list can have a path; the other files must be in the same
path.  This example displays the same files as the previous example, but the
.WKS and .WK1 files are intermixed:

     c:\> dir *.wks;*.wk1

You can include files in the current or named directory plus all of its
subdirectories by using the /S option.  This example displays all of the
.WKS and .WK1 files in the D:\DATA directory and each of its subdirectories:

     c:\> dir /s d:\data\*.wks;*.wk1

You can also select files by their attributes by using the /A option.  For
example, this command displays the names of all of the subdirectories of the
current directory:

     c:\> dir /a:d

Finally, with the /I option, DIR can select files to display based on their
descriptions (see the 611DESCRIBE command for more information on file
descriptions).  DIR will display a file if its description matches the text
after the /I switch.  The search is not case sensitive.  You can use
wildcards and extended wildcards as part of the text.  For example, to
display any file described as a "Test File" you can use this command:

     c:\> dir /i"test file"

If you want to display files that include the words "test file" anywhere in
their descriptions, use extended wildcards like this:

     c:\> dir /i"*test file*"

To display only those files which do not have descriptions, use:

     c:\> dir /I"[]"

In addition, you can use 074ranges to select or exclude specific sets of
files.  For example, to display all files modified in the last week, all
files except those with a .BAK extension, and all files over 500 KB in size:

     c:\> dir /[d-7]
     c:\> dir /[!*.bak]
     c:\> dir /[s500K]

You can, of course, mix any of these file selection techniques in whatever
ways suit your needs.

Default DIR Output Format

DIR's output varies based on the type of volume or drive on which the
files are stored.  If the volume supports long file names (VFAT volumes
under Windows 95/98/ME), the default DIR format contains 4 columns:  the date
of the last file modification or write, the time of last write, the file size
in bytes, and the file name.  The name is displayed as it is stored on the
disk, in upper, lower, or mixed case.  DIR will wrap filenames from one line
to the next if they are too long to fit the width of the display.  The
standard output format is:

       Volume in drive C is C - BOOTUP     Serial number is ....:....
       Directory of  C:\4DOS\*.*

     12-08-2002  12:17         <DIR>    .
     12-08-2002  12:17         <DIR>    ..
      1-04-2003  16:21         <DIR>    Test
      1-10-2003  18:59             995  4dos7.pif
      1-06-2003   7:50         273,406  4DOS.COM
      1-09-2003  10:03              45  4DOS.INI

(See Switching Formats below for information on changing the standard long
filename format to allow room for file descriptions.)

On FAT volumes which do not support long file names, the default DIR format
contains 5 columns: the file name, the file size in bytes, the date of the
last write, the time of the last write, and the files description.  File
names are listed in lower-case; directory names in upper case:

       Volume in drive C is C - BOOTUP    Serial number is ....:....
       Directory of  C:\4DOS\*.*

     .            <DIR>     12-08-02  12:17 C:\4DOS
     ..           <DIR>     12-08-02  12:17 C:\
     TEST         <DIR>     01-04-03  16:21
     4dos7.pif         995  01-10-03  18:59 4DOS PIF file
     4dos.com       273406  01-06-03   7:50 4DOS executable ...
     4dos.ini           45  01-09-03  10:03 4DOS configuration ...

DIR's output is normally sorted by name, with directories listed first.  You
can change the sort order with the /O option.  For example, these two
commands sort the output by date: the first command lists the oldest file
first; the second command lists the oldest file last:

     c:\> dir /o:d
     c:\> dir /o:-d

When displaying file descriptions, DIR wraps long lines to fit on the
screen.  DIR displays a maximum of 39 characters of text in each line of a
description, unless your screen width allows a wider display.  If you
disable description wrapping with the /R option, the description is
truncated at the right edge of the screen, and a right arrow [] is added at
the end of the line to alert you to the existence of additional description
text.

Regardless of the volume type, DIR's default output is sorted.  It displays
directory names first, with "<DIR>" inserted instead of a file size, and then
filenames.  DIR assumes that sequences of digits should be sorted numerically
(for example, the file DRAW2 is listed before DRAW03 because 2 is numerically
smaller than 03), rather than strictly alphabetically (where DRAW2 would come
second because "2" is after "0" in alphanumeric order).  You can change the
sort order with the /O option.  When DIR displays file names in a
multi-column format, it sorts file names horizontally unless you use the
/V option to display vertically sorted output.

DIR's display can be modified in many ways to meet different needs.  Most of
the following sections describes the various ways you can change DIR's
output format.

Switching Formats

On volumes which support long file names, you can force DIR to use a FAT-like
format (file name first, followed by file information) with the /Z
option.  If necessary, DIR /Z truncates long file names on LFN drives, and
adds a right arrow [] to show that the name contains additional characters.

The standard LFN output format does not provide enough space to show
descriptions along with file names.  Therefore, if you wish to view file
descriptions as part of the DIR listing on a volume which supports long file
names, you must use the /Z option.

4DOS will display the alternate, short file names for files with long file
names if you use the /X option.  Used alone, /X causes DIR to display
names in 2 columns after the size, time, and date:  one column for alternate
or short file names and the other for long file names.  If a file does not
have a short or alternate name which is different from the long filename,
the first filename column is empty.

If you use /X and /Z together under 4DOS, DIR will display the short or
alternate file names in the FAT-style display format.

If you use the /B option, DIR displays just file names and omits the file
size, time stamp, and description for each file, for example:

     c:\> dir w* /b

     WINDOWS
     WINNT
     win311
     WINALIAS
     WINENV.BTM
     .....

There are several ways to modify the display produced by /B.  The /F
option is similar to /B, but displays the full path and name of each file,
instead of just its name.  To view the same information for a directory and
its subdirectories use /B /S or /F /S.  You can use /B /X to
display the short name of each file, with no additional information.  To
display the short version of both the path and file name for each file, use
/F /X.  For example:

     c:\> dir /x/f/s *.pif

     C:\MACH64\INSTALL.PIF
     C:\PROGRA~1\WINZIP\WZ.PIF
     C:\WINDOWS\DOSPRMPT.PIF
     C:\WINDOWS\STARTM~1\APPS&U~1\INFOSE~1.PIF
     C:\WINDOWS\STARTM~1\PROMPTS\4DOS.PIF
     C:\WINDOWS\STARTM~1\PROMPTS\TOCP.PIF
     C:\WINDOWS\STARTM~1\PROMPTS\SPECIAL\4DOS(R~1.PIF
     .....

Multiple Column Displays

DIR has three options, /2, /4, and /W, that create multi-column
displays.

The /2 option creates a 2-column display.  On drives which support long
filenames, only the name of each file is displayed, with directory names
placed in square brackets to distinguish them from file names.  On drives
which do not support long filenames, or when /Z or /X is used (see
below), the display includes the name, file size, and time stamp for each
file.

The /4 option is similar to /2, but displays directory information in 4
columns.  On drives which do not support long filenames, or when the /Z
or /X is used (see below), the display shows the file name and the file
size in kilobytes (KB), megabytes (MB) or gigabytes (GB), with "<D>" in the
size column for directories.

The /W option displays directory information in 5 or more columns,
depending on your screen width.  Each entry in a DIR /W display contains
either the name of a file or the name of a directory.  Directory names are
placed in square brackets to distinguish them from file names.

If you use one of these options on a drive that supports long file names,
and do not select an alternate display format with /Z or /X, the actual
number of columns will be based on the longest name to be
displayed and your screen width, and may be less than the number you
requested (for example, you might see only three columns even though you
used /4).  If the longest name is too long to fit in on a single line the
display will be reduced to one column, and each name will be wrapped,
with "extra" blank lines added so that each name takes the same number of
lines.

On LFN drives you can use /Z with any of the multi-column options to create
a traditional FAT-format display, with long names truncated to fit in the
available space.  If you use /X, the traditional FAT-format display is
also used, but short names are displayed (rather than truncated long
names).  The following table summarizes the effects of different options on
LFN drives:

!NOWRAP
            Ŀ
                                  Display Columns                      
   Ĵ
    Format  Normal             /2 or /4           /W                
   Ĵ
    Normal  1 column, long     2 - 4 columns,     No. of columns    
            names plus size,   long names only    based on longest  
            date, time                            name, long names  
                                                  only              
   Ĵ
    /Z      1 column,          2 - 4 columns,     5+ columns,       
            truncated long     truncated long     truncated long    
            names plus size,   names plus other   names only        
            date, time         info                                 
   Ĵ
    /X      1 column, both     2 - 4 columns,     5+ columns,       
            names plus size,   short names        short names       
            date, time         plus other info    only              
   Ĵ
    /Z /X   1 column, short    (Same as /X        (Same as /X       
            names plus size,   alone)             alone)            
            date, time                                              
   
!WRAP

Color-Coded Directories

The DIR command can display each file name and the associated file
information in a different color, depending on the file's extension.

To choose the display colors, you must either use the 663SET command to
create an environment variable called 133COLORDIR, or use the Commands
page of the 648OPTION dialogs or a text editor to set the 463ColorDir
directive in your .INI file.  If you do not use the COLORDIR variable or the
ColorDir directive, DIR will use the default screen colors for all files.

If you use both the COLORDIR variable and the ColorDir directive, the
environment variable will override the settings in your .INI file.  You may
find it useful to use the COLORDIR variable for experimenting, then to set
permanent directory colors with the ColorDir directive.

The format for both the COLORDIR environment variable and the ColorDir
directive in the .INI file is:

     ext ... :ColorName; ...

where "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

and "ColorName" is any valid color name (see 892Colors and Color Names).

Unlike most color specifications, the background portion of the color name
may be omitted for directory colors.  If you don't specify a background
color, DIR will use the current screen background color.

For example, to display the .COM and .EXE files in red on the current
background, the .C and .ASM files in bright cyan on the current background,
and the read-only files in blinking green on white (this should be entered
on one line):

     c:\> set colordir=com exe:red; c asm:bright cyan;
          rdonly:blink green on white

Extended 073wildcards can be used in directory color specifications.  For
example, to display .BAK, .BAX, and .BAC files in red:

     c:\> set colordir=BA[KXC]:red

Redirected Output

The output of the DIR command, like that of most other internal commands, can
be redirected to a file, printer, serial port, or other device.  However, you
may need to take certain DIR command options into account when you redirect
DIR's output.

DIR wraps both long file names and file descriptions at the width of your
display.  Its redirected output will also wrap at the screen width.  Use the
/R option if you wish to disable wrapping of long descriptions.

If you redirect a color-coded directory to a file, DIR will remove the color
data as it sends the directory information to a file.  It will usually do the
same if you redirect output to a character device such as a printer or serial
port.  However, it is not always possible for DIR to tell whether or not a
device is a character device.  If you notice that non-colored lines are being
sent to the output device and colored lines are appearing on your screen, you
can use the /D option to temporarily disable color-coding when you redirect
DIR's output.

To redirect DIR output to the clipboard, use CLIP: as the output device name,
for example:

     c:\> dir *.exe > clip:

Other Notes

If you have selected a specific country code for your system, DIR will
display the date in the format for that country.  The default date format is
U.S. (mm-dd-yy).  The separator character in the file time will also be
affected by the country code.  Thousands and decimal separators in numeric
displays are affected by the country code, and by the 445ThousandsChar
and 421DecimalChar settings selected on the Options 1 page of the
648OPTION dialogs, or in the .INI file.

DIR can generally display any file date between January 1, 1980 and
December 31, 2099 if the date is supplied properly by the operating
system.

If you are using a disk compression program, you can use the /C
switch to view the amount of compression achieved for each file.  When you
do, the compression ratio is displayed instead of the file's
description.  You can also sort the display by compression ratios with
the /O:c switch.  Details for both switches are in the Options section,
below.  Only the compression programs distributed with MS-DOS and
Windows 95/98/ME (DRVSPACE and DBLSPACE) are supported.  /C and /O:c
will be ignored for other compression programs, and on uncompressed drives.
/C will not display compression ratios on LFN drives unless you also
use /Z to switch to the traditional short filename format.

DIR can handle directories of any size, limited only by available
memory.  Each short filename requires 64 bytes of memory, plus the
size of the description (if any).  For example, a system with just 128K of
free memory can display up to about 2,000 files per directory.  Long
filenames require additional space roughly equal to the length of the long
names to be displayed.  Additional space is also required when using DIR /S,
particularly on LFN drives with long directory names and/or deeply-nested
directories.

DOS networks with large server volumes (over 2 GB) may report incorrect free
disk space values at the end of the DIR display.  If this occurs, it is
because the network software does not report proper or usable values to 4DOS.

Options

Options on the command line apply only to the filenames which follow the
option, and options at the end of the line apply to the preceding filename
only.  This allows you to specify different options for different groups of
files, yet retains compatibility with the traditional DIR command when a
single filename is specified.

!INDENT 5 5 0 5
     /1:  (Single column)  Display the filename, size, date,
     and time; also displays the description on drives which do not
     support long filenames.  This is the default.  If /T is used the
     attributes are displayed instead of the description; if
     /C or /O:c is used the compression ratio is displayed
     instead of the description.  This option is most useful if you wish
     to override a default /2, /4, or /W setting stored in an alias.

     /2:  (Two columns) Display just the name (on LFN drives), or display
     the filename, size, date, and time on other drives.  See Multiple
     Column Displays above for more details.

     /4:  (Four columns) Display just the name (on LFN drives), or display
     the filename and size, in K (kilobytes), M (megabytes) or G (gigabytes)
     on other drives, with files between 1 and 9.9 megabytes and files over
     1 gigabyte in size displayed in tenths (i.e. "2.4M").  See Multiple
     Column Displays above for more details.

     /A:  (Attribute select) Display only those files that have the
     specified attribute(s) set.  The colon [:] after /A is optional.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed at all (e.g., DIR /A ...), DIR
     will display all files and subdirectories including hidden
     and system files.  If attributes are combined, all the
     specified attributes must match for a file to be included in
     the listing.  For example, /A:RHS will display only
     those files with all three attributes set.

!INDENT 5 5 0 5
     /B:  (Bare) Suppress the header and summary lines, and display file
     or subdirectory names only, in a single column.  This option
     is most useful when you want to redirect a list of names to
     a file or another program.  If you use /B with /S,
     DIR will show the full path of each file (the same display as /F)
     instead of simply its name and extension.  If you use /B with /X on
     an LFN drive, DIR will display the short name of each file instead of
     the long name.

     /C:  (Compression) Display per-file and total compression ratio on
     compressed drives.  The compression ratio is displayed
     instead of the file description or attributes.  The ratio is
     left blank for directories and files with a length of 0
     bytes, and for files on non-compressed drives.  /C only
     works in single-column mode; it is ignored if /2,
     /4, or /W is used.  The compression ratios will not be visible on
     LFN drives unless you use /Z to switch to the traditional short
     filename format.

!INDENT 5 5 5 5
     Only the compression programs distributed with MS-DOS and
     Windows 95/98/ME (DRVSPACE and DBLSPACE) are supported.

     The numerator of the displayed compression ratio is the amount of space
     which would be allocated to the file if the compression utility were
     not in use, based on the compressed drive's cluster size (usually 8K
     bytes).  The denominator is the space actually allocated for the
     compressed file.  For example, if a file is allocated 6,144 bytes when
     compressed, and would require 8,192 bytes if uncompressed, the
     displayed compression ratio would be 8,192/6,144, or 1.3 to 1.

     Using /CH displays compression ratios like /C, but
     bases the calculation on the host drive's cluster size.  This
     gives a more accurate picture of the space saved
     through compression than is given by /C.  This option
     will occasionally display compression ratios slightly less
     than 1.0 for files which have actually expanded when
     stored on the compressed drive.

     If /CP is used instead of /C, the compression is
     displayed as a percentage (e.g., 33%) instead of a ratio
     (e.g., 3 to 1).  If /CHP is used instead of /CH, the
     host compression is displayed as a percentage.  The /CHP
     option must be entered as shown; you can not use
     /CPH.

!INDENT 5 5 0 5
     /D:  (Disable color coding) Temporarily disable directory color
     coding.  May be required when color-coded directories are
     used and DIR output is redirected to a character device like
     the printer (e.g., PRN or LPT1 to 3) or serial port (e.g., AUX
     or COM1 to 4).  /D is not required when DIR output is redirected
     to a file.

     /E:  (Case) Display filenames in the traditional upper case; also see
     664SETDOS /U and the 446UpperCase directive in 4DOS.INI.

     /F:  (Full path) Display each filename with its drive letter and
     path in a single column, without other information.  If you use /F
     with /X on a volume which supports long filenames, the "short"
     version of the entire path is displayed.

     /G:  Display the allocated disk space instead of the
     actual size of each file.

     /H:  (Hide dots) Suppress the display of the "." and ".." directories.

     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

!INDENT 5 5 5 5
     The /I option may be used to select files even if descriptions are not
     displayed (for example, if /2 is used).  However, /I will be
     ignored if /C or /O:c is used.

!INDENT 5 5 0 5
     /J:  (Justify names) Align filename extensions and display
     them in the traditional format.

     /K:  (Suppress header) Suppress the disk and directory name display.

     /L:  (Lower case) Display file and directory names in lower case; also
     see 664SETDOS /U and the 446UpperCase directive in 4DOS.INI.

     /M:  (Suppress footer) Suppress the file and byte count totals display.

     /N:  (Normal) Reset the DIR options to the default values.  This is
     useful when you want to display some files in one format, and then
     change back to the defaults for another set of files.

     /O:  (Order) Set the sorting order.  You may use any combination of the
     following sorting options; if multiple options are used, the
     listing will be sorted with the first sort option as the
     primary key, the next as the secondary key, and so on:

!INDENT 5 5 5 5
          -  Reverse the sort order for the next option.
          a  Sort names and extensions in standard ASCII order, rather
             than sorting numerically when digits are included in the
             name or extension.
          c  Sort by compression ratio (the least compressed file in
             the list will be displayed first).  For single-column
             directory displays in the traditional short filename
             format, the compression ratios will be used as the basis
             of the sort and will also be displayed.  For wider
             displays (/2, /4, and /W) and displays in LFN format,
             the compression ratios will be used to determine the order
             but will not be displayed.  If /O:c is used with /CH or
             /CHP, the sort will be based on the host-drive
             compression ratios.  For information on supported
             compression systems, see /C above.
          d  Sort by date and time (oldest first); for drives which
             support long filenames, also see /T.
          e  Sort by extension.
          g  Group subdirectories first, then files.
          i  Sort by the file description (ignored if /C or /O:c is
             also used).
          n  Sort by filename (this is the default).
          r  Reverse the sort order for all options.
          s  Sort by size.
          u  Unsorted.
!INDENT 5 5 0 5

     /P:  (Pause) Wait for a key to be pressed after each screen page
     before continuing the display.  Your options at the prompt are
     explained in detail under 045Page and File Prompts.

     /R:  (Disable Wrap) Forces long descriptions to be displayed on a
     single line, rather than wrapped onto two or more lines.  Use
     /R when output is redirected to a character device,
     such as a serial port or the printer; or when you want
     descriptions truncated, rather than wrapped, in the on-screen display.

     /S:  (Subdirectories) Display file information from the current
     directory and all of its subdirectories.  DIR will only
     display headers and summaries for those directories which
     contain files that match the filename(s), ranges, and attributes
     that you specify.  Note that DIR /S will not search into
     subdirectories with the hidden or system attributes set unless you
     also specify /A:.

     /T:  (Attribute display) Display the filenames and attributes.  /T
     is ignored if /C or /O:c is also used.  The attributes are
     displayed in the format RHDSA, with the following meanings:

!INDENT 5 5 5 5
     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     On drives which support long file names, if you wish to add another
     option after /T, you must start the next option with a forward
     slash.  If you dont, 4DOS will interpret the /T as
     the /T:acw time display switch (see below) and the following
     character as a time selector.  For example:

          c:\> dir /tz           incorrect, will display error
          c:\> dir /t/z          correct

!INDENT 5 5 0 5
     /T:acw  (Time display) Specify which of the date and time fields
     on an LFN drive should be displayed and used for sorting:

!INDENT 5 5 5 5
          a  Last access date (access time is not saved).
          c  Creation date and time.
          w  Last write date and time (default).

!INDENT 5 5 0 5
     /U:  (Summary information) Only display the number of files, the total
     file size, and the total amount of disk space used.  There are two
     additional /U options:

!INDENT 5 5 5 5
          /U1  Display summaries for each directory, but no total
               for each parent directory.
          /U2  Display grand total only.
!INDENT 5 5 0 5

     /V:  (Vertical sort) Display the filenames sorted vertically rather
     than horizontally (use with the /2, /4, or /W options).

     /W:  (Wide) Display filenames only, horizontally across the
     screen.  On drives which do not support long filenames, or when used
     with /Z or /X under 4DOS, /W displays as many columns as it can
     fit into 4DOS window, using 16 characters in each
     column.  Otherwise (i.e., when long filenames are displayed) the number
     of columns depends on the width of the longest name in the listing.  See
     Multiple Column Display above for more details.

     /X:  Display both the short name (8-character name plus 3-character
     extension) and the long name of each file on an LFN.  In normal
     single-column output the short name is displayed first, followed by the
     long name.  The short name column is left blank if the short name and
     long name are the same.  /X also selects short filenames in the /2,
     /4, /B, /W, and /Z displays, and short file and path names in
     the /F display.

     /Z:  Display filenames on LFN drives in the traditional FAT format,
     with the short filename at the left and the description at the right.
     Long names will be truncated to 12 characters unless /X is also used;
     if the name is longer than 12 characters, it will be followed by a right
     arrow [] to show that one or more characters have been truncated.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 613 DIRHISTORY
!TTY

Purpose:  Display, add to, clear, or read the directory history list.

Format:   DIRHISTORY [/A directory /F /P /R filename]

          directory:  The name of a directory to be added to the
                      directory history.
          filename:   The name of a file containing entries to be
                      added to the directory history.

          /A(dd)                      /P(ause)
          /F(ree)                     /R(ead)
!TTY

See also: 632HISTORY.

Usage

Every time you change to a new directory or drive, 4DOS record the current
directory in an internal directory history list.  See
040Directory History for information on directory history window, which
allows you to use the list to return to a previous directory.  Also see
047Directory Navigation.

The DIRHISTORY command lets you view and manipulate the directory history
list directly.  If no parameters are entered, DIRHISTORY will display the
current directory history list:

     c:\> dirhistory

With the options explained below, you can clear the list, add new directories
to the list without changing to them, save the list in a file, or read a new
list from a file.

The number of directories saved in the directory history list depends on the
length of each directory name.  The list size can be specified at startup
from 256 to 2048 characters by using the 376DirHistory directive in
4DOS.INI.  The default size is 256 characters.

Your directory history list can be stored either locally (a separate history
list for each copy of 4DOS) or globally (all copies of 4DOS share the same
list).  See 040Directory History for a
discussion of local and global directory history lists.

You can save the directory history list by redirecting the output of
DIRHISTORY to a file.  This example saves the history to a file called
DIRHIST and reads it back again:

     c:\> dirhistory > dirhist
         .....
     c:\> dirhistory /r dirhist

Because the directory history stores each name only once, you don't have to
delete its contents before reading back the file unless you want to delete
the directories that were visited by the intervening commands.

If you need to save your directory history at the end of each day's work, you
might use commands like this in your AUTOEXEC.BAT or other startup file:

     if exist c:\dirhist dirhistory /r c:\dirhist

     alias shut*down `dirhistory > c:\dirhist`

This restores the previous history list if it exists, then defines an alias
which will allow you to save the history before shutting off the system.

Options

!INDENT 5 5 0 5
     /A:  (Add) Add a directory to the directory history list.

     /F:  (Free) Erase all entries in the directory history list.

     /P:  (Prompt) Wait for a key after displaying each page of the
     list.  Your options at the prompt are explained in detail in
     045Page and File Prompts.

     /R:  (Read) Read the directory history from the specified
     file and append it to the list currently held in memory.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 614 DIRS
!TTY

Purpose:  Display the current directory stack.

Format:   DIRS
!TTY

See also: 653PUSHD, 651POPD, and 047Directory Navigation.

Usage

The PUSHD command adds the current default drive and directory to the
directory stack, a list that 4DOS maintains in memory.  The POPD command
removes the top entry of the directory stack and makes that drive and
directory the new default.  The DIRS command displays the contents of the
directory stack, with the most recent entries last (i.e., the next POPD
will retrieve the last entry that DIRS displays).

The directory stack holds 511 characters, enough for 20 to 40 typical drive
and directory entries.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 615 DO
!TTY

Purpose:  Create loops in batch files.

Format:   DO [n | FOREVER]
               or
          DO varname = start TO end [BY n]
               or
          DO [WHILE | UNTIL] condition
               or
          DO varname IN [range /A:[[+|-]rhsad] /I"text" /L] [@]fileset
              commands
          [ITERATE]
          [LEAVE]
              commands
          ENDDO
!TTY

          varname:        The environment variable that will hold the
                          loop counter, filename, or line from a file.
          n, start, end:  Integers between 0 and 2,147,483,647 inclusive,
                          or an internal variables or variable function that
                          evaluates to such a value.
          condition:      A test to determine if the loop should be
                          executed.
          fileset:        A list of wildcard patterns to match, or (if /L
                          is specified) literal values to process.
          commands:       One or more commands to execute each time
                          through the loop.  If you use multiple commands,
                          they must be separated by command separators or be
                          placed on separate lines.
!TTY

          /A: (Attribute select)      /I (match descriptions)
          /L(iteral arguments)
!TTY

File Selection

Supports extended 073wildcards, 074ranges, and 080include lists for
the fileset.  Date, time, or size ranges must appear immediately following
the IN keyword (not after the command itself, as with most 4DOS commands!)

Use wildcards with caution on LFN volumes; see 081LFN File Searches for
details.

Usage

DO can only be used in batch files.  It cannot be used in aliases.

DO can be used to create four different kinds of loops.  The first,
introduced by DO n, is a counted loop.  The batch file lines between DO and
ENDDO are repeated n times.  For example:

     do 5
        beep
     enddo

You can also specify "forever" for n if you wish to create an endless loop
(you can use LEAVE or 630GOTO to exit such a loop; see below for details).


The second type of loop is similar to a "for loop" in programming languages
like BASIC.  DO creates an environment variable, varname, and sets it equal
to the value start (if varname already exists in the environment, it will
be overwritten).  DO then begins the loop process by comparing the value of
varname with the value of end.  If varname is less than or equal to end, DO
executes the batch file lines up to the ENDDO.  Next, DO adds 1 to the
value of varname, or adds the value n if BY n is specified, and repeats the
compare and execute process until varname is greater than end.  This
example displays the even numbers from 2 through 20:

     do i = 2 to 20 by 2
        echo %i
     enddo

DO can also count down, rather than up.  If n is negative, varname will
decrease by n with each loop, and the loop will stop when varname is
less than end.  For example, to display the even numbers from 2 through
20 in reverse order, replace the first line of the example above with:

     do i = 20 to 2 by -2


The third type of loop is called a "WHILE loop" or "UNTIL loop."  DO
evaluates the condition, which can be any of the tests supported by the
633IF command, and executes the lines between DO and ENDDO according to
the result.  A WHILE loop ends when the condition becomes false; an UNTIL
loop ends when the condition becomes true.

WHILE tests the condition at the start of the loop.  Therefore, if the
condition is false when the loop starts, the statements within the loop will
never be executed, and the batch file will continue with the statement after
the ENDDO.

UNTIL tests the condition at the end of the loop.  Therefore, the statements
within the loop will always be executed at least once.


The fourth type of loop executes the lines between DO and ENDDO once for
every filename in the fileset, or once for each argument (if you use the
/L option).  For example:

     do x in *.txt

will execute the loop once for every .TXT file in the current directory;
each time through the loop the variable x will be set to the name of the
next file that matches the file specification.

If, between DO and ENDDO, you create a new file that could be included in
the list of files, it may or may not appear in an iteration of the DO
loop.  Whether the new file appears depends on its physical location in the
directory structure, a condition over which 4DOS has no control.

You can also execute the loop once for each line of text in a file by placing
an [@] in front of the file name.  If you have a file called DRIVES.TXT
that contains a list of drives on your computer, one drive name per line,
you can execute the loop once for each drive this way:

     do x in @drives.txt

To execute the loop once for each line of text in the clipboard, use CLIP:
as the file name (e.g. DO X IN @CLIP:).  CLIP: will not return any data
unless the clipboard contains text.  See 051redirection for additional
information on CLIP:, including details on when you can use the clipboard
under 4DOS.


Two special commands, ITERATE and LEAVE, can be used inside a DO /
ENDDO loop.  ITERATE ignores the remaining lines inside the loop and
returns to the beginning of loop for another iteration (unless DO
determines that the loop is finished).  LEAVE exits from the current DO
loop and continues with the line following ENDDO.  Both ITERATE and LEAVE
are most often used in an 633IF or 634IFF command:

     do while "%var" != "%var1"
        ...
        if "%var" == "%val2" leave
     enddo

You can nest DO loops up to 15 levels deep.

The DO and ENDDO commands must be on separate lines, and cannot be placed
within a 085command group, or on the same line as other commands (this is
the reason DO cannot be used in aliases).  However, commands within the DO
loop can use command groups or the 041command separator in the normal way.

If you receive a stack overflow error when using DO in complex, nested
command sequences, see the 574StackSize directive.

You can exit from all DO / ENDDO loops by using GOTO to a line past
the last ENDDO.  However, be sure to read the cautionary notes about GOTO
and DO under the 630GOTO command before using a GOTO in any other way
inside any DO loop.

You cannot use 659RETURN to return from a 629GOSUB while
inside a DO loop.

Options

!INDENT 5 5 0 5
     /A:: (Attribute select) Process only those files that have the
     specified attribute(s) set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed (e.g., DO I IN /A: *.*), DO will
     process all matching files and subdirectories, including any with the
     hidden or system attribute set.  If attributes are combined, all the
     specified attributes must match for a file to be included.  For
     example, /A:RHS will include only those files with all three
     attributes set.
!INDENT 5 5 0 5

     /I"text":  Select filenames by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not
     have a description with /I"[]".

     /L:  Specifies that the arguments in a DO x IN ... statement are
     literal text, not filenames.  The arguments will be assigned (left to
     right) to the DO variable on each pass through the loop.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 616 DRAWBOX
!TTY

Purpose:  Draw a box on the screen.

Format:   DRAWBOX ulrow ulcol lrrow lrcol style [BRIght] [BLInk]
          fg ON [BRIght] bg [FILl [BRIght] bgfill] [ZOOm] [SHAdow]

          ulrow:   Row for upper left corner.
          ulcol:   Column for upper left corner.
          lrrow:   Row for lower right corner.
          lrcol:   Column for lower right corner.
          style:   Box drawing style:
                      0  No lines (box is drawn with blanks).
                      1  Single line.
                      2  Double line.
                      3  Single line top and bottom, double on sides.
                      4  Double line top and bottom, single on sides.
          fg:      Foreground character color.
          bg:      Background character color.
          bgfill:  Background fill color (for the inside of the box).
!TTY

See also: 617DRAWHLINE and 618DRAWVLINE.

Usage

DRAWBOX is useful for creating attractive screen displays in batch files.

For example, to draw a box around the edge of an 80x25 window with bright
white lines on a blue background:

     drawbox 0 0 24 79 1 bri whi on blu fill blu

See 892Colors and Color Names for details about colors and notes on
the use of bright background colors.

If you use ZOOM, the box appears to grow in steps to its final size.  The
speed of the zoom operation depends on the speed of your computer and video
system.

If you use SHADOW, a drop shadow is created by changing the characters in
the row under the box and the 2 columns to the right of the box to normal
intensity text with a black background (this will make characters displayed
in black disappear entirely).

The row and column values are zero-based, so on a standard 25 line by 80
column display, valid rows are 0 - 24 and valid columns are 0 - 79.

If ulrow is set to 999, lrrow is assumed to be the desired height, and the
box will be centered vertically.  If ulcol is set to 999, lrcol is assumed
to be the desired width, and the box will be centered horizontally.

Unlike DRAWHLINE and DRAWVLINE, DRAWBOX does not automatically connect
boxes to existing lines on the screen with the proper connector
characters.  If you want to draw lines inside a box and have the proper
connectors drawn automatically, draw the box first, then use DRAWHLINE and
DRAWVLINE to draw the lines.

DRAWBOX uses the standard line and box drawing characters in the U.S. English
extended ASCII character set.  If your system is configured for a different
country or language, or a font which does not include these characters, the
box may not appear on your screen as you expect.

DRAWBOX normally writes text directly to the screen.  If you have an
unusual display adapter which does not support direct video output, see the
572OutputBIOS directive.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 617 DRAWHLINE
!TTY

Purpose:  Draw a horizontal line on the screen.

Format:   DRAWHLINE row column len style [BRIght] [BLInk] fg ON [BRIght] bg

          row:     Starting row.
          column:  Starting column.
          len:     Length of line.
          style:   Line drawing style:
                      1  Single line.
                      2  Double line.
          fg:      Foreground character color.
          bg:      Background character color.
!TTY

See also: 616DRAWBOX and 618DRAWVLINE.

Usage

DRAWHLINE is useful for creating attractive screen displays in batch
files.  It detects other lines and boxes on the display, and creates the
appropriate connector characters when possible (not all types of lines can
be connected with the available characters).

For example, the following command draws a double line along the top row of
the display with green characters on a blue background:

     drawhline 0 0 80 2 green on blue

The row and column values are zero-based, so on a standard 25 line by 80
column display, valid rows are 0 - 24 and valid columns are 0 - 79.

If row is set to 999, the line will be centered vertically.  If column is
set to 999, the line will be centered horizontally.

See 892Colors and Color Names for details about colors and notes on
the use of bright background colors.

DRAWHLINE uses the standard line and box drawing characters in the
U.S. English extended ASCII character set.  If your system is configured
for a different country or language, or a font which does not include these
characters, the box may not appear on your screen as you expect.

DRAWHLINE normally writes text directly to the screen.  If you have an
unusual display adapter which does not support direct video output, see the
572OutputBIOS directive.
;---------------------------------------------------------------------------
!TOPIC 618 DRAWVLINE
!TTY

Purpose:  Draw a vertical line on the screen.

Format:   DRAWVLINE row col len style [BRIght] [BLInk] fg ON [BRIght] bg

          row:     Starting row.
          col:     Starting column.
          len:     Length of line.
          style:   Line drawing style:
                      1  Single line.
                      2  Double line.
          fg:      Foreground character color.
          bg:      Background character color.
!TTY

See also: 616DRAWBOX and 617DRAWHLINE.

Usage

DRAWVLINE is useful for creating attractive screen displays in batch
files.  It detects other lines and boxes on the display, and creates the
appropriate connector characters when possible (not all types of lines can
be connected with the available characters).

For example, to draw a double width line along the left margin of the
display with bright red characters on a black background:

     drawvline 0 0 25 2 bright red on black

The row and column values are zero-based, so on a standard 25 line by 80
column display, valid rows are 0 - 24 and valid columns are 0 - 79.

If row is set to 999, the line will be centered vertically.  If column is
set to 999, the line will be centered horizontally.

See 892Colors and Color Names for details about colors and notes on
the use of bright background colors.

DRAWVLINE uses the standard line and box drawing characters in the
U.S. English extended ASCII character set.  If your system is configured
for a different country or language, or a font which does not include these
characters, the box may not appear on your screen as you expect.

DRAWVLINE normally writes text directly to the screen.  If you have an
unusual display adapter which does not support direct video output, see the
572OutputBIOS directive.
;---------------------------------------------------------------------------
!TOPIC 619 ECHO
!TTY

Purpose:  Enable or disable command echoing, or display the current
          status; display a message.

Format:   ECHO [ON | OFF | message]

          message:  Text to display.
!TTY

See also: 620ECHOS, 689ECHOERR, 690ECHOSERR, 660SCREEN,
661SCRPUT, 664SETDOS and 671TEXT.

Usage

The ECHO command has two separate functions.  The first is to change or
display the current command-echo state.  The second, more common use is
to display a message on the screen.

4DOS has a separate echo capability for batch files and for the command
line.  The command-line ECHO state is independent of the batch file ECHO
state; changing ECHO in a batch file has no effect on the display at the
command prompt, and vice versa.

To see the current echo state, use the ECHO command with no arguments.  This
displays either the batch file or command-line echo state, depending on
where the ECHO command is performed.

In a batch file, if you turn ECHO on, each line of the file is displayed
before it is executed.  If you turn ECHO off, each line is executed without
being displayed.  Regardless of the ECHO state, a batch file line that
begins with the [@] character will not be displayed.  To turn off batch
file echoing without displaying the ECHO command, use this line:

     @echo off

ECHO defaults to ON in batch files.  The current ECHO state is inherited by
called batch files.  You can change the default setting to ECHO OFF with
the 664SETDOS /V0 command, the Options 1 page of the 648OPTION
dialogs, or the 414BatchEcho directive in 4DOS.INI.  See 104Echoing in
Batch Files for details.

ECHO defaults to OFF at the command line.  If you turn the command-line
ECHO on, each command will be displayed before it is executed.  This will
let you see the command line after expansion of aliases and variables.  The
command-line ECHO is most useful when you are learning how to use advanced
features.  This example will turn command-line echoing on:

     c:\> echo on

If the ECHO command is followed by anything other than ON or OFF, ECHO will
treat it as a message to be displayed.  This is most often used in
102batch files and 101aliases, but it can even be useful at the prompt
to display the values of 161internal variables, 241functions, and so
on.  For example, a batch file might display a simple message to let the
user know what's going on:

     echo Processing your print files...

An alias might use ECHO to report the value of a variable or function:

     595alias chkbat=`@echo Battery level %172_apmlife%%%`

Note that this second use of the ECHO command is independent of the
first.  You can use ECHO to display a message regardless of the current
command-echo state.

The message is actually sent to standard output (stdout).  Normally this
is the screen, but it can be redirected with the usual 055operators.  You
could, for example, use ECHO to append a line to a text file:

     echo Starting backup at %230_isodate %219_time >>! c:\runlog.txt

To include the 418command separator character [^] or the
050redirection and piping symbols [<>|] in an ECHO message, enclose
them in quotes (see 118Argument Quoting) or precede them with the
086escape character.

Trailing spaces in the message are normally ignored.  To display trailing
spaces, enclose them in back-quotes:

     echo Five spaces follow:`     `

If you want to echo a blank line, or a line containing only the word ON or
OFF, put a period immediately after the ECHO with no space between:

     echo.
     echo.on
     echo.off

If you are writing a batch file and you want to display several lines or
strings containing troublesome characters, or to display text without
expanding variables and functions, consider using the 671TEXT command
instead.
;---------------------------------------------------------------------------
!TOPIC 689 ECHOERR
!TTY

Purpose:  Display a message to the standard error device.

Format:   ECHOERR message

          message:  Text to display.
!TTY

See also: 619ECHO, 620ECHOS, 690ECHOSERR, 660SCREEN,
661SCRPUT and 671TEXT.

Usage

ECHOERR displays a message like ECHO, but sends its output to the standard
error device stderr (usually the screen) instead of the standard output
device.  If the standard output of a batch file is redirected to a file or
another device with > or >>, ECHOERR will still generate a screen
message.  You can redirect ECHOERR's output using redirection operators
like >& and >&>, which affect stderr.  See 050Redirection and Piping
for more information about the standard output and standard error devices and
redirection.

To include the 418command separator character [^] or the
050redirection and piping symbols [<>|] in an ECHOERR message, enclose
them in quotes (see 118Argument Quoting) or precede them with the
086escape character.

Trailing spaces in the message are normally ignored.  To display trailing
spaces, enclose them in back-quotes:

     echoerr Five spaces follow:`     `

ECHOERR can not be used to change or display the current command-echo
state.  Use 619ECHO to control echoing of commands in a batch file or
at the prompt.
;---------------------------------------------------------------------------
!TOPIC 620 ECHOS
!TTY

Purpose:  Display a message without a trailing carriage return and line
          feed.

Format:   ECHOS message

          message:  Text to display.
!TTY

See also: 619ECHO, 689ECHOERR, 690ECHOSERR, 660SCREEN,
661SCRPUT, 671TEXT, and 684VSCRPUT.

Usage

ECHOS is useful for text output when you don't want to add a carriage
return and line feed at the end of the line.  For example, you can use
ECHOS when you need to redirect control sequences to your printer; this
example sends the sequence Esc P to the printer on LPT1:

     c:\> echos eP > lpt1:

To include the 418command separator character [^] or the
050redirection and piping symbols [<>|] in an ECHOS message, enclose
them in quotes (see 118Argument Quoting) or precede them with the
086escape character.

If you want to embed a carriage return or other control character in the
message, you can use the 246@CHAR function or an escape sequence.  For
instance, you might wish to print a carriage return at the start of your
message to move the cursor to the start of the line, so you can overwrite
text already on the screen.  Use @CHAR[13] or %=r to print a carriage
return:

     615do i = 100 to 0 by -1
        echos %=r%i` `
        610delay /m 1
     enddo

ECHOS does not translate or modify the message text.  For example,
carriage return characters are not translated to CR/LF pairs.  ECHOS sends
only the characters you specify.  The only character you cannot put into
an ECHOS message is the NUL character (ASCII 0).

To include the 418command separator character [^] or the
050redirection and piping symbols [<>|] in an ECHOS message, enclose
them in quotes (see 118Argument Quoting) or precede them with the
086escape character.

Trailing spaces in the message are normally ignored.  To display trailing
spaces, enclose them in back-quotes, as in the example above.

ECHOS can not be used to change or display the current command-echo
state.  Use 619ECHO to control echoing of commands in a batch file or
at the prompt.
;---------------------------------------------------------------------------
!TOPIC 690 ECHOSERR
!TTY

Purpose:  Display a message to the standard error device, without a
          trailing carriage return and line feed.

Format:   ECHOSERR message

          message:  Text to display.
!TTY

See also: 619ECHO, 620ECHOS, 689ECHOERR, 660SCREEN,
661SCRPUT and 671TEXT.

Usage

ECHOSERR acts like ECHOS but sends its output to the standard error device
stderr (usually the screen) instead of the standard output device.  If the
standard output of a batch file is redirected to a file or another device
with > or >>, ECHOSERR will still generate a screen message.  You can
redirect ECHOSERR's output using redirection operators like >& and >&>,
which affect stderr.  See 050Redirection and Piping for more information
about the standard output and standard error devices and redirection.

If you want to embed a carriage return or other control character in the
message, you can use the 246@CHAR function or an escape sequence.  For
instance, you might wish to print a carriage return at the start of your
message to move the cursor to the start of the line, so you can overwrite
text already on the screen.  Use @CHAR[13] or %=r to print a carriage
return:

     615do i = 100 to 0 by -1
        echoserr %=r%i` `
        610delay /m 1
     enddo

ECHOSERR does not translate or modify the message text.  For example,
carriage return characters are not translated to CR/LF pairs.  ECHOSERR sends
only the characters you specify.  The only character you cannot put into
an ECHOSERR message is the NUL character (ASCII 0).

To include the 418command separator character [^] or the
050redirection and piping symbols [<>|] in an ECHOSERR message, enclose
them in quotes (see 118Argument Quoting) or precede them with the
086escape character.

Trailing spaces in the message are normally ignored.  To display trailing
spaces, enclose them in back-quotes, as in the example above.

ECHOSERR can not be used to change or display the current command-echo
state.  Use 619ECHO to control echoing of commands in a batch file or
at the prompt.
;---------------------------------------------------------------------------
!TOPIC 715 EJECTMEDIA
!TTY

Purpose:  Eject removable media in the specified drive(s).

Format:   EJECTMEDIA [drive: ...]

          drive:  The drive or list of drives whose media to eject.
!TTY

See also: 714CLOSETRAY.

Usage

EJECTMEDIA will eject removable media, such as CD-ROMs, DVDs, etc.

If no drives are specified, 4DOS will attempt to eject the media of the first
CD-ROM (DVD) drive.

Note:  DOS kernels don't support CD-ROMs or DVDs directly; a CD-ROM driver
and CD extensions must be installed or the EJECTMEDIA command will not work.
Windows 95/98/ME and OS/2 version 3.x and above don't need them; they have
its own CD-ROM driver and support.
;---------------------------------------------------------------------------
!TOPIC 621 ENDLOCAL
!TTY

Purpose:  Restore the saved disk drive, directory, environment, alias
          list, and special characters.

Format:   ENDLOCAL [exportvar]
!TTY

See also: 665SETLOCAL.

Usage

The SETLOCAL command in a batch file saves the current disk drive, default
directory, all environment variables, the alias list, and the command
separator, escape character, parameter character, decimal separator, and
thousands separator.  ENDLOCAL restores everything that was saved by the
previous SETLOCAL command.

For example, this batch file fragment saves everything, removes all aliases
so that user aliases will not affect batch file commands, changes the disk
and directory, changes the command separator, runs a program, and then
restores the original values:

     setlocal
     unalias *
     cdd d:\test
     setdos /c~
     program ~ echo Done!
     endlocal

SETLOCAL and ENDLOCAL are nestable up to 8 levels deep within a batch file.
You cannot use SETLOCAL and ENDLOCAL in an alias or at the command line.

You can "export" environment variables from inside a SETLOCAL by specifying
the variable names to be preserved following the ENDLOCAL.  For example:

     setlocal
     set test=abcd
     endlocal test

An ENDLOCAL is performed automatically at the end of a batch file if you
forget to do so.  If you invoke one batch file from another without using
CALL, the first batch file is terminated, and an automatic ENDLOCAL is
performed; the second batch file inherits the settings as they were prior
to any SETLOCAL.
;---------------------------------------------------------------------------
!TOPIC 622 ESET
!TTY

Purpose:  Edit environment variables and aliases.

Format:   ESET [/A /F /M] variable name...

          variable name:  The name of an environment variable, alias, or
                          function to edit.

          /A(lias)        /M(aster environment)
          /F(unctions)
!TTY

See also: 595ALIAS, 678UNALIAS, 663SET, and 680UNSET.

Usage

ESET allows you to edit environment variables and aliases using line
editing commands (see 032Command-Line Editing).

For example, to edit the executable file search path use ESET PATH;
to edit the alias D, use ESET D.

ESET will search for environment variables first and then aliases.  If you
have an environment variable and an alias with the same name, ESET will
edit the environment variable and ignore the alias unless you use the
/A option.

Environment variable and alias names are normally limited to 80
characters, and the name and value together normally cannot be longer
than 511 characters.  ESET can edit any variable provided the variable
contains no more than 511 characters of text.

If you have enabled global aliases (see 595ALIAS), any changes made
to an alias with ESET will immediately affect all other copies of 4DOS
which are using the same alias list.

Options

!INDENT 5 5 0 5
     /A:  (Alias) Edit the named alias even if an environment variable of
     the same name exists.  If you have an alias and an
     environment variable with the same name, you must use this
     switch to be able to edit the alias.

     /F:  (Functions) Edit the named user-defined function.

     /M:  (Master environment) Edit an environment variable in the master
     environment rather than the local environment.  This option
     is only useful from a secondary command shell (for example,
     when an application has "shelled to DOS").  /M only
     works for environment variables; it cannot be used to edit
     the primary shell's aliases.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 623 EXCEPT
!TTY

Purpose:  Perform a command on all available files except those specified.

Format:   EXCEPT [/I"text"] (@file) (file) command

          file:     The file or files to exclude from the command.
          @file:    A text file containing the names of the
                    files to exclude, one per line (see 057@file lists
                    for details).
          command:  The command to execute, including all appropriate
                    arguments and switches.

          /I:       (match description)

!TTY

See also: 596ATTRIB and 078File Exclusion Ranges.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.  Date, time, size, or file exclusion
ranges must appear immediately after the EXCEPT keyword.

Use wildcards with caution on LFN volumes; see 081LFN File Searches
for details.

Usage

EXCEPT provides a means of executing a command on a group of files and/or
subdirectories, and excluding a subgroup from the operation.  EXCEPT is
intended primarily as a helper for external utilities which do not offer
exclusion ranges or any similar capability.  The command may also be an
internal command, alias or batch file.  However, an 078exclusion range
will generally be the preferable method for excluding files when using
internal commands.

You may use wildcards to specify the files to exclude from the command.  The
first example erases all the files in the current directory except
those beginning with MEMO, and those whose extension is .WKS.  The second
example copies all the files and subdirectories on drive C to drive D
except those in C:\MSC and C:\DOS, using the COPY command:

     c:\> except (memo*.* *.wks) erase *.*
     c:\> except (c:\msc c:\dos) copy c:\*.* d:\ /s

Note that in the second example, EXCEPT is used to hide subdirectories,
not files.  Because COPY /S does not recurse into hidden directories by
default, this prevents the contents of the specified subdirectories from
being copied.  Using EXCEPT to hide files from COPY /S would be less
successful:

     c:\> except (*.tmp *.bak) copy c:\*.* d:\ /s      Wrong!

This command would temporarily hide all .TMP and .BAK files in the current
directory before performing the COPY -- probably not what was intended!

You must quote any file names inside the parentheses which contain
whitespace or special characters (see 945File Names for details).  For
example, to copy all files except those in the "Program Files" directory
to drive E:\:

     c:\> except ("Program Files") copy /s *.* e:\

EXCEPT will assume that the files to be excluded are in the current
directory, unless another directory is specified explicitly.

EXCEPT prevents operations on the specified file(s) by setting the
hidden attribute, performing the command, and then clearing the hidden
attribute.  If the command is aborted in an unusual way, you may need to
use the ATTRIB command to remove the hidden attribute from the file(s).

Caution:  EXCEPT will not work with programs or commands that ignore the
hidden attribute or which work explicitly with hidden files, including
609DEL /Z, and the /H (process hidden files) switch available
in some 4DOS file processing commands.

078File exclusion ranges provide a faster and more flexible method
of excluding files from internal commands, and do not manipulate file
attributes, as EXCEPT does.  However, exclusion ranges can only be used with
4DOS internal commands; you must use EXCEPT for external commands.

074Date, time, and size ranges can be used immediately after the word
EXCEPT to further qualify which files should be excluded from the
command.  If the command is an internal command that supports ranges, an
independent range can also be used in the command itself.  You can also use a
file exclusion range within the EXCEPT command; however, this will select
files to be excluded from EXCEPT, and therefore included in execution of
the command.

You can use 085command grouping to execute multiple commands with
a single EXCEPT.  For example, the following command copies all files in
the current directory whose extensions begin with .DA, except the .DAT
files, to the D:\SAVE directory, then changes the first two characters of
the extension of the copied files to .SA:

     c:\data> except (*.dat) (copy *.da* d:\save ^ ren *.da* *.sa*)

If you use 035filename completion to enter the filenames inside
the parentheses, type a space after the open parenthesis before
entering a partial filename or pressing Tab.  Otherwise, the
command-line editor will treat the open parenthesis as the first
character of the filename to be completed.

Options

!INDENT 5 5 0 5
     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 624 EXIT
!TTY

Purpose:  Return from 4DOS.

Format:   EXIT [value]

          value:  The numeric exit code to return.
!TTY

See also: 600CANCEL and 654QUIT.

Usage

EXIT terminates the current copy of 4DOS.  Use it to return to an
application when you have "shelled out" to work at the prompt, or to end a
command-line session under Windows or OS/2.

To close the session, or to return to the application that started 4DOS,
type:

     c:\> exit

If you specify a value, EXIT will return that value to the program that
started 4DOS.  For example:

     c:\> exit 255

The value is a number you can use to inform the program of some result,
such as the success or failure of a batch file and it can range from
0 - 255.  This feature is most useful for systems which use batch files to
automate their operation, such as bulletin boards, or custom application
programs like databases that shell to 4DOS to perform certain tasks.

You cannot EXIT from the primary 4DOS shell under DOS.  If EXIT does not
seem to have any effect, you are probably in the primary shell.

Before exiting, 4DOS will execute the contents of any 1094EXIT batch
file.
;---------------------------------------------------------------------------
!TOPIC 625 FFIND
!TTY

Purpose:  Search for files by name or contents.

Format:   FFIND [/A[[:][+|-]rhsad] /B /C /D[list] /E /F /I /I"text" /K /L
          /M /N /O[[:][-]acdeginrsu] /P /R /S /[T|X]"xx" /U /V /Y] file...

          list:  A list of disk drive letters (without colons).
          file:  The file, directory, or list of files or directories to
                 display.

          /A (Attribute select)        /N(ot)
          /B(are)                      /O(rder)
          /C(ase sensitive)            /P(ause)
          /D(rive)                     /R(everse)
          /E (upper case display)      /S(ubdirectories)
          /F (stop after match)        /T"xx" (text search string)
          /I(gnore wildcards)          /U (summary only)
          /I"text" (match description) /V(erbose)
          /K (no headers)              /X["xx"] (hex display/search string)
          /L(ine numbers)              /Y (prompt to continue after match)
          /M (no footers)

!TTY

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Usage

FFIND is a flexible search command that looks for files based on their names
and their contents. Depending on the options you choose, FFIND can display
filenames, matching text, or a combination of both in a variety of formats.

If you want to search for files by name, FFIND works much like the DIR
command.  For example, to generate a list of all the .BTM files in the
current directory, you could use the command

     c:\> ffind *.btm

The output from this command is a list of full pathnames, followed by the
number of files found.

If you want to limit the output to a list of .BTM files which contain the
string color, you could use this command instead:

     c:\> ffind /t"color" *.btm

The output from this command is a list of files that contain the
string "color" along with the first line in each file that contains that
string.  By default, FFIND uses a case-insensitve search, so the command
above will include files that contain "COLOR", "Color", "color", or any
other combination of upper-case and lower-case letters.

If you would rather see the last line of each file that contains the search
string, use the /R option, which forces FFIND to search from the end of
each file to the beginning.  This option will also speed up searches
somewhat if you are looking for text that will normally be at the end of a
file, such as a signature line:

     c:\> ffind /r /t"Sincerely," *.txt

You can use extended wildcards in the search string to increase the
flexibility of FFIND's search.  For example, the following command will find
.TXT files which contain either the string "June" or "July" (it will also find
"Juny" and "Jule").  The /C option makes the search case-sensitive:

     c:\> ffind /c /t"Ju[nl][ey]" *.txt

If you want to search for text that contains wildcard characters (*, ?,
[, or ]), you can use the /I option to force FFIND to interpret these
as normal characters instead of wildcards.  The following command, for
example, finds all .TXT files that contain a question mark:

     c:\> ffind /i /t"?" *.txt

At times, you may need to search for data that cannot be represented by ASCII
characters.  You can use FFIND's /X option to represent the search string
in hexadecimal format (this option also changes the output to show hexadecimal
offsets rather than text lines).  With /X the search must be represented
by pairs of hexadecimal digits separated by spaces; a search of this type is
always case-sensitive (in the example below, 41 63 65 is the hex code for
"Ace"):

     c:\> ffind /x"41 63 65" *.txt

You can use FFIND's other options to further specify the files for which you
are searching and to modify the way in which the output is displayed.

You must quote any file names which contain whitespace or special
characters.  See 945File Names for additional details.

Options

!INDENT 5 5 0 5
     /A:  (Attribute select) Find only those files that have the
     specified attribute(s) set.  The colon [:] after /A is optional.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select files
     that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed at all (e.g., FFIND /A ...), FFIND will
     display all files and subdirectories including hidden and system
     files.  If attributes are combined, all the specified attributes must
     match for a file to be selected. For example, /A:RHS will select only
     those files with all three attributes set.
!INDENT 5 5 0 5

     /B:  (Bare) Display file names only and omit the text that matches
     the search.  This option is only useful in combination with /T or /X,
     which normally force FFIND to display file names and matching text.

     /C:  (Case sensitive) Perform a case-sensitive search.  This option
     is only valid with /T, which defaults to a case-insensitive search.  It
     is not needed with a /X hexadecimal search, which is always
     case-sensitive.

     /D:  (Drive)  Search all files on one or more drives.  If you use /D
     without a list of drives, FFIND will search the drives specified in the
     list of files.  If no drive letters are listed, FFIND will search
     all of the current drive.  You can include a list of drives or a range
     of drives to search as part of the /D option.  For example, to search
     drives C:, D:, E:, and G:, you can use either of these commands:

          c:\> ffind /dcdeg ...
          c:\> ffind /dc-eg ...

!INDENT 5 5 5 5
     Drive letters listed after /D will be ignored when processing file
     names which also include a drive letter.  For example, this command
     displays all the .BTM files on C: and E:, but only the .BAT files on D:

          c:\> ffind /s /dce *.btm d:\*.bat
!INDENT 5 5 0 5

     /E:  (Upper case) Display filenames in the traditional upper case; also
     see 664SETDOS /U and the 446UpperCase directive in 4DOS.INI.

     /F:  (First) Stops the search after the first match.

     /I:  (Ignore wildcards) Only meaningful when used in conjunction with
     the /T"xx" option.  Suppresses the recognition of wildcard characters
     in the search text.  This option is useful if you need to search for
     characters that would normally be interpreted as wildcards: *, ?,
     [, and ].

     /I"text":  Select filenames by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /K:  (No headers) Suppress the display of the header or filename for
     each matching text line.

     /L:  (Line numbers) Include the line number for each text line
     displayed.  FFIND numbers lines beginning with 1, unless
     475ListRowStart is set to 0 in 4DOS.INI.  A new line is counted
     for every CR or LF character (FFIND determines automatically which
     character is used for line breaks in each file), or when line
     length reaches 511 characters, whichever comes first.

     /M:  (No footers) Suppress the footer (the number of files and number
     of matches) at the end of FFIND's display.

     /N:  (Not) Reverse the meaning of the search.  /N will also set /B;
     i.e. searches are on a file-by-file basis.

     /O:  (Order) Set the sort order for the files that FFIND
     displays.  You may use any combination of the following sorting
     options; if multiple options are used, the listing will be sorted with
     the first sort option as the primary key, the next as the secondary
     key, and so on:

!INDENT 5 5 5 5
          -  Reverse the sort order for the next option
          a  Sort names and extensions in standard ASCII order, rather
             than sorting numerically when digits are included in the
             name or extension.
          c  Sort by compression ratio (the least compressed file in
             the list will be displayed first).
          d  Sort by date and time (oldest first); for LFN drives,
             also see /T.
          e  Sort by extension.
          g  Group subdirectories first, then files.
          i  Sort by the file description (ignored if /C or /O:c is
             also used).
          n  Sort by filename (this is the default).
          r  Reverse the sort order for all options.
          s  Sort by size.
          u  Unsorted.
!INDENT 5 5 0 5

     /P:  (Pause) Wait for a key to be pressed after each screen page
     before continuing the display.  Your options at the prompt are
     explained in detail under 045Page and File Prompts.

     /R:  (Reverse) Only meaningful when used in conjuction with the
     /T"xx" or /X options.  Searches each file from the end backwards to
     the beginning.  This option is useful if you want to display the last
     occurrence of the search string in each file instead of the first (the
     default).  It can also speed up searches for information that is
     normally at the end of a file, such as a signature.

     /S:  (Subdirectories) Display matches from the current directory and
     all of its subdirectories.  Note that FFIND /S will not search into
     subdirectories with the hidden or system attributes set unless you also
     specify /A:.

     /T"xx":  (Text search) Specify the text search string.  /T must be
     followed by a text string in double quotes (e.g., /t"color").  FFIND
     will perform a case-insensitive search unless you also use the /C
     option.  For a hexadecimal search and/or hexadecimal display of the
     location where the search string is found, see /X.  You can specify
     a search string with either /T or /X, but not both.

     /U:  (Summary) Only displays the summary line.

     /V:  (Verbose) Show every matching line.  FFIND's default
     behavior is to show only the first matching line then and then go on to
     the next file.  This option is only valid with /T or /X.

     /X["xx xx ..."]:  (Hexadecimal display / search) Specify hexadecimal display
     and an optional hexadecimal search string.

!INDENT 5 5 5 5
     If /X is followed by one or more pairs of hexadecimal digits in quotes
     (e.g., /x"44 63 65"), FFIND will search for that exact sequence of
     characters or data bytes without regard to the meaning of those bytes
     as text.  If those bytes are found, the offset is displayed (in
     both decimal and hexadecimal).  A search of this type will always be
     case-sensitive.

     If /X is not followed by a hexadecimal search string it must be used
     in conjunction with /T, and will change the output format to display
     offsets (in both decimal and hexadecimal) rather than actual text lines
     when the search string is found.  For example, this command uses /T
     to display the first line in each .BTM file containing the word "hello":

          c:\> ffind /t"hello" *.btm
          --- c:\test.btm:
          echo hello

     If you use the same command with /X, the offset is displayed instead
     of the text:

          c:\> ffind /t"hello" /x *.btm
          --- c:\test.btm:
          Offset: 26 (1Ah)

     You can specify a search string with either /T or /X, but not both.
!INDENT 5 5 0 5

     /Y:  (Prompt) Prompt to stop searching after each match.  This option is
     most useful when you are using FFIND to search for one specific file, and
     don't want to display all files which include a particular search string.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 626 FOR
!TTY

Purpose:  Repeat a command for several values of a variable.

Format:   FOR [/A:[[+|-]rhsad] /D /F ["options"] /H /I"text" /L /R [path]]
          %var IN ([@]set | start, step, end) [DO] command ...

          options:  Parsing options for a "file parsing" FOR.
          path:     The starting directory for a "recursive" FOR.
          %var:     The variable to be used in the command ("FOR
                    variable").
          set:      A set of values for the variable.
          start:    The starting value for a "counted" FOR.
          step:     The increment value for a "counted" FOR.
          end:      The limit value for a "counted" FOR.
          command:  A command or group of commands to be executed for
                    each value of the variable.

          /A: (Attribute select)      /I (match descriptions)
          /D(isable "/")              /L (counted loop)
          /F(ile parsing)             /R(ecursive)
          /H(ide dots)
!TTY

See also: 687LFNFOR.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.  Date, time, or size ranges must
appear immediately after the FOR keyword.

Use extended wildcards with caution on LFN volumes; see
081LFN File Searches for details.

Usage

FOR begins by creating a set.  It then executes a command for every member
of the set.  The command can be an internal command, an alias, an external
command, or a batch file.  The members of the set can be a list of file
names, text strings, a group of numeric values, or text read from a list of
files.

When the set is made up of text or several separate file names (not an
include list), the elements must be separated by spaces, tabs, commas, or
the switch character (normally a slash [/]).

FOR includes a large number of options, some of which duplicate functions
available in other 4DOS commands, and/or do not follow conventions you may
find in our other commands.  Most of these extra options are included for
compatibility with CMD.EXE in the 25Windows NT line.  However, we make
them available in 4DOS, 0204NT, and Take Command so that aliases
and batch files which use them can work under all three products.

The first three sections below ("Working with Files", "Working with Text", and
"Retrieving Text from Files") describe the traditional FOR command and the
enhancements to it which are part of 4DOS.  The sections on "Parsing Text
from Files" and "Counted FOR Loops" describe features added for compatibility
with CMD.EXE.  The section entitled "Other Notes" contains information you 
may need if you use any aspect of the FOR command extensively.

Working with Files

Normally, the set is a list of files specified with wildcards.  For
example, if you use this line in a batch file:

     for %x in (*.txt) do list %x

then LIST will be executed once for each file in the current directory with
the extension .TXT.  The FOR variable %x is set equal to each of the file
names in turn, then the 640LIST command is executed for each file.  (You
could do the same thing more easily with a simple LIST *.TXT.  We used FOR
here so you could get a feel for how it operates, using a simple
example.  Many of the examples in this section are constructed in the same
way.)

The set can include multiple files or an include list, like this:

     for %x in (d:\*.txt;*.doc;*.asc) do type %x

FOR supports 073wildcards and extended wildcards, as well as
072extended parent directory names (e.g., ...\*.txt to process all of
the .TXT files that are contained in the directory 2 levels above the
current directory).

You must quote any file names within the set which contain whitespace or
special characters.  The same restriction applies to names returned in the
FOR variable, if you pass them to 4DOS internal commands, or other commands
which require quoting filenames with whitespace.  FOR does not quote returned
names automatically, even if you included quotes in the set.  See
945File Names for additional details on file name quoting.

If the set includes filenames, the file list can be further refined by
using 074date, time, size and 078file exclusion ranges.  The range
or ranges must be placed immediately after the word FOR.  Ranges will be
ignored if no wildcards are used inside the parentheses.  For example, this
set is made up of all of the .TXT files that were created or updated on
July 1, 2000:

     for /[d7-1-2000,+0] %x in (*.txt) do ...

If the command is an internal command that supports ranges, an independent
range can also be used in the command itself.

You can also refine the list by limiting it with the /A: option to select
only files that have specific attributes.

By default, FOR works only with files in the current directory or a specified
directory.  With the /R option, FOR will also search for files in
subdirectories.  For example, to work with all of the .TXT files in the
current directory and its subdirectories:

     for /r %x in (*.txt) do ...

If you specify a directory name immediately after /R, FOR will start in
that directory and then search each of its subdirectories.  This example
works with all of the .BAK files on drive D:

     for /r d:\ %x in (*.bak) do ...

When you use wildcards to specify the set, FOR scans the directory and finds
each file which matches the wildcard name(s) you specified.  If, during the
processing of the FOR command, you create a file that could be included in
the set, it may or may not appear in a future iteration of the same FOR
command.  Whether the new file appears depends on its physical location in
the directory structure.  For example, if you use FOR to execute a command
for all .TXT files, and the command also creates one or more new .TXT files,
those new files may or may not be processed during the current FOR command,
depending on where they are placed in the physical structure of the
directory.  This is an operating system constraint over which 4DOS has no
control.  Therefore, in order to achieve consistent results you should
construct FOR commands which do not create files that could become part of
the set for the current command.

Working with Text

The set can also be made up of text instead of file names.  For example, to
create three files named file1, file2, and file3, each containing a blank
line:

     for %suffix in (1 2 3) do echo. > file%suffix

You could also use the names of environment variables as the text.  This
example displays the name and content of several variables from the
environment (see 131Using the Environment for details on the use of
square brackets when expanding environment variables).  Enter this on one
line:

     for %var in (path prompt comspec) do echo %var=%[%var]

Retrieving Text from Files

FOR can extract text from files in two different ways.  The first method
extracts each line from each file in the set and places it in the
variable.  To use this method, place an [@] at the beginning of the set,
in front of the file name or names.

For example, if you have a file called DRIVES.TXT that contains a list of
drives on your computer, one drive name per line (with a ":" after each
drive letter), you can print the free space on each drive this way:

     for %d in (@drives.txt) do free %d > prn

Because the [@] is also a valid filename character, FOR first checks
to see if the file exists with the [@] in its name (i.e., a file named
@DRIVES.TXT).  If so, the filename is treated as a normal argument.  If it
doesn't exist, FOR uses the filename (without the [@]) as the file
from which to retrieve text.

If you use @CON as the filename, FOR will read from standard input (a
redirected input file) or a pipe; see 050Redirection and Piping for more
information).  If you use @CLIP: as the filename, FOR will read any text
available from the Windows clipboard (see 051Redirection for details on
when you can use the clipboard under 4DOS).

Parsing Text from Files

The second method of working with text from files is to have FOR parse each
line of each file for you.  To begin a "file-parsing" FOR, you must use the
/F option and then include one or more file names in the set.  When you
use this form of FOR, the variable must be a single letter, for example, %a.

This method of parsing, included for compatibility with CMD.EXE, can be 
cumbersome and inflexible.  For a more powerful method, use FOR with
"@filename" as the set to retrieve each line from the file, as described
in the previous section.  Then use variable functions like 291@INSTR,
294@LEFT, 316@RIGHT, and 329@WORD to parse the line.

By default, FOR will extract the first word or token from each line and
return it in the variable.  For example, to display the first word on each
line in the file FLIST.TXT:

     for /f %a in (flist.txt) do echo %a

You can control the way FOR /F parses each line by specifying one or more
parsing options in a quoted string immediately after the /F.  The available
options are:

!INDENT 5 5 5 5
     skip=n:  FOR /F will skip "n" lines at the beginning of each
     file before parsing the remainder of the file.

     tokens=n, m, ...:  By default, FOR /F returns just the first word or
     "token" from each parsed line in the variable you named.  You can have
     it return more than one token in the variable, or return tokens in
     several variables, with this option.

     This option is followed by a list of numbers separated by commas.  The
     first number tells FOR /F which token to return in the first variable,
     the second number tells it which to return in the second variable,
     etc.  The variables follow each other alphabetically starting with the
     variable you name on the FOR command line.  This example returns the
     first word of each line in each text file in %d, the second in %e,
     and the third in %f:

          for /f "tokens=1,2,3" %d in (*.txt) do ...

     You can also indicate a range of tokens by separating the numbers with
     a hyphen [-].  This example returns the first word of each line in
     %p, the second through fifth words in %q, and the eighth word in %r:

          for /f "tokens=1,2-5,8" %p in (*.txt) do ...

     eol=c:  If FOR /F finds the character "c" in the line, it will assume
     that the character and any text following it are part of a comment and
     ignore the rest of the line.

     delims=xxx...:  By default, FOR /F sees spaces and tabs as word or
     token delimiters.  This option replaces those delimiters with all of
     the characters following the equal sign to the end of the string.  This
     option must therefore be the last one used in the quoted options string.
!INDENT 0

You can also use FOR /F to parse a single string instead of each line
of a file by using the string, in quotes, as the set.  For example, this
command will assign variable A to the string "this", B to "is", etc., then
display "this" (enter the command on one line):

     for /f "tokens=1,2,3,4" %a in ("this is a test") do echo %a

"Counted" FOR Loop

The "counted FOR" loop is included only for compatibility with CMD.EXE.
In most cases, you will find the 615DO command more useful for
performing counted loops.

In a counted FOR command, the set is made up of numeric values instead of
text or file names.  To begin a counted FOR command, you must use the /L
option and then include three values, separated by commas, in the set.  These
are the start, step, and end values.  During the first iteration of the FOR
loop, the variable is set equal to the start value.  Before each iteration,
the variable is increased by the step value.  The loop ends when the
variable exceeds the end value.  This example will print the numbers from 1
to 10:

     for /l %val in (1,1,10) do echo %val

This example will print the odd numbers from 1 to 10 (1, 3, 5, 7, and 9):

     for /l %val in (1,2,10) do echo %val

The step value can be negative.  If it is, the loop will end when the
variable is less than the end value.

Other Notes

You can use either % or %% in front of the variable name.  Either form
will work, whether the FOR command is typed from the command line or is
part of an alias or batch file (some of the traditional command processors
require a single % if FOR is used at the command line, but require %% if FOR
is used in a batch file).  The variable name can be up to 80 characters long.
The word DO is optional.

If you use a single-character FOR variable name, that name is given
priority over any environment variable which starts with the same letter,
in order to maintain compatibility with the traditional FOR command.  For
example, the following command tries to add a: and b: to the end of the
PATH, but will not work as intended:

     c:\> for %p in (a: b:) do path %path;%p

The "%p" in "%path" will be interpreted as the FOR variable %p
followed by the text "ath", which is not what was intended.  To get around
this, use a different letter or a longer name for the FOR variable, or use
square brackets around the variable name (see 131Using the Environment).

FOR variables can be referenced like normal environment variables,
but are not stored in the same way, and cannot be modified with the
663SET, 622ESET, or 680UNSET commands.

The following example uses FOR with variable functions to delete the
.BAK files for which a corresponding .TXT file exists in the current
directory:

     c:\docs> for %file in (*.txt) do del %@name[%file].bak

The above command would not work properly on an LFN drive, because the
returned FILE variable might contain whitespace.  To correct this
problem, you would need two sets of quotes, one for DEL and one for %@NAME:

     c:\docs> for %file in (*.txt) do del "%@name["%file"].bak"

You can use 085command grouping to execute multiple commands for
each element in the set.  For example, the following command copies each
.WKQ file in the current directory to the D:\WKSAVE directory, then changes
the extension of each file in the current directory to .SAV.  This should
be entered on one line:

     c:\text> for %file in (*.wkq) do (copy "%file"
              d:\wksave\ ^ ren "%file" *.sav)

In a batch file you can use GOSUB to execute a subroutine for every
element in the set.  Within the subroutine, the FOR variable can be used
just like any environment variable.  This is a convenient way to execute a
complex sequence of commands for every element in the set without CALLing
another batch file.

One unusual use of FOR is to execute a collection of batch files or
other commands with the same parameter.  For example, you might want to
have three batch files all operate on the same data file.  The FOR command
could look like this:

     c:\> for %cmd in (filetest fileform fileprnt) do %cmd datafile

     This line will expand to three separate commands:

          filetest datafile
          fileform datafile
          fileprnt datafile

The variable that FOR uses (the %CMD in the example above) is
created in the environment and then erased when the FOR command is
done.  (For compatibility with COMMAND.COM, a single-character FOR variable
is created in a special way that does not overwrite an existing environment
variable with the same name.)  When using a multi-character variable name
you must be careful not to use the name of one of your environment variables
as a FOR variable.  For example, a command that begins

     c:\> for %path in ...

will write over your current path setting, then erase the path variable
completely when FOR is done.

FOR statements can be nested; the permissible nesting level depends on
the amount of free space in 4DOS's internal stack.  If you receive a stack
overflow error when using FOR in complex, nested command sequences, see the
notes under the 574StackSize directive.

Options

!INDENT 5 5 0 5
     /A:: (Attribute select) Process only those files that have the
     specified attribute(s) set.  /A: will be used only when
     processing wildcard file names in the set.  It will be
     ignored for filenames without wildcards or other items in
     the set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed (e.g., FOR /A: IN (*.*) DO ...), FOR
     will process all files and subdirectories including hidden and
     system files.  If attributes are combined, all the specified attributes
     must match for a file to be included.  For example, /A:RHS
     will include only those files with all three attributes set.

     For example, to process only those files with the archive
     attribute set:

          for /a:a %f in (*.*) echo %f needs a backup!

!INDENT 5 5 0 5
     /D:  (Disable "/") Disables the special processing of the forward
     slash [/] character in the FOR set.  For compatibility with certain
     versions of COMMAND.COM (those prior to Windows 95/98/ME), 4DOS
     normally treats a forward slash inside the set as an "escape"
     character, discard the slash, and return the character after the
     slash, followed by the remainder of the string.  This behavior can
     be used in batch files to separate a string into individual
     characters (although 4DOS provides a much easier method with the
     291@INSTR and 294@LEFT variable functions).
!INDENT 5 5 5 5

     The /D option must follow the FOR keyword and come before the
     variable name.  These examples show the effects of /D:

          c:\> for %s in (/abcdef) do echo %s
          a
          bcdef

          c:\> for /d %s in (/abcdef) do echo %s
          /abcdef
!INDENT 5 5 0 5

     /F:  (File parsing) Return one or more words or tokens from each line
     of each file in the set.  The /F option can be followed by one or
     more options in a quoted string which control how the parsing is
     performed.  See the details under "Parsing Text From Files", above.

     /H:  (Hide dots) Suppress the assignment of the "." and ".."
     directories to FOR variable.

     /I"text":  Select filenames by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /L:  (counted loop) Interpret the three values in the set as the
     start, step, and end values of a counted loop.  See the details under
     "Counted FOR Loop", above.

     /R:  (Recursive) Look in the current directory and all of its
     subdirectories for files in the set.  If the /R is followed by a
     directory name, look for files in that directory and all of its
     subdirectories.  Note that FOR /R will not search into subdirectories
     with the hidden or system attributes set.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 627 FREE
!TTY

Purpose:  Display the total disk space, total bytes used, total bytes
          free, and the percent used on the specified (or default) drive(s).

Format:   FREE [drive: ...]

          drive:  One or more drives to include in the report.
!TTY

See also: 645MEMORY.

Usage

FREE provides the same disk information as the external command
CHKDSK, but without the wait, since it does not check the
integrity of the file and directory structure of the disk.

A colon [:] is required after each drive letter.  This example displays
the status of drives A and C:

     c:\> free a: c:

If the volume serial number is available, it will appear after the drive
label or name.
;---------------------------------------------------------------------------
!TOPIC 696 FUNCTION
!TTY

Purpose:  Create a user-defined variable function.

Format:   FUNCTION [/P /R file...] [name[=][value]]

          file:   One or more files to read for function definitions.
          name:   The name of the function you want to display or set.
          value:  Variable function to be substituted for the variable name.

          /P(ause)                   /R(ead file)
!TTY

See also: 699UNFUNCTION.

Usage

FUNCTION allows you to create or display user-defined variable functions
that can be used everywhere 241variable functions are used.

If you invoke FUNCTION with no parameters, it will display the current
function list.  If you include a name, with no equals sign or value,
FUNCTION will display the current definition of that function.  The name
may include 073wildcards, in which case FUNCTION will display the
current values, if any, of all functions matching that name.  For example

     function *dx*

will display all functions which contain dx in their name.

If you include the equals sign and value, FUNCTION will create or update the
function referred to by name.

Parameters to the function are numbered from %0 to %255, and are replaced
with the matching argument when the function is called.  %1 is the first
argument, %2 is the second, and so on.  %0 is the function name.  %n&
contains all of the function's arguments starting with the nth; %&
contains all arguments.  If you wish to use a symbol other than the
amperTION command.

You can also create, add to, and edit the .INI file "manually" with
any ASCII text editor.  4DOS reads its .INI file when it starts, and
configures itself accordingly.  The the function:

     function leftmost=`%@left[1,%1]`

will return the leftmost character in a string.

Note that function definitions will nearly always contain references to
variables, parameters, or other functions.  To prevent these references from
being expanded at the time the function is defined, use back-quotes around
the function definition (as above.)  See 118Argument Quoting for more
information on using back-quotes to delay variable expansion.

Local and Global Functions

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

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

With a global function list, all copies of 4DOS will share the same
function list, and any changes made to functions in one copy will affect all
other copies.

You can control the type of function list on the Startup page of the
648OPTION dialogs, with the 387LocalFunctions directive in 4DOS.INI,
or with the /L and /LF 352startup options.

There is no fixed rule for determining whether to use a local or global
function 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, then modify it if you
find a situation where the default is not convenient.

Whenever you start a secondary shell which uses a local function list, it
inherits a copy of the functions from the previous shell.  However, any
changes made to functions in the secondary shell will affect only that
shell, and will be lost when the secondary shell exits.  If you want changes
made in a secondary shell to affect the previous shell, use a global
function list in both shells.

Options

!INDENT 5 5 0 5
     /P:  (Pause) This option is only effective when FUNCTION is used to
     display existing definitions.  It pauses the display after each page
     and waits for a keystroke before continuing (see 045Page
     and File Prompts).

     /R:  (Read file) This option loads a function list from a file.  The
     format of the file is the same as that of the FUNCTION display:
!INDENT 5 5 5 5

          name=value

     where name is the name of the function and value is its
     value.  You can use an equal sign [=] or space to
     separate the name and value.  Back-quotes are not required
     around the value.  You can add comments to the file by
     starting each comment line with a colon [:].  You can
     load multiple files with one FUNCTION /R command by placing the
     names on the command line, separated by spaces:

          c:\> function /r func1.lst func2.lst

     Each definition in a FUNCTION /R file can be up to 511 characters long.  The
     definitions can span multiple lines in the file if each line, except the
     last, is terminated with an 086escape character.  If there is no
     filename argument and input is redirected, FUNCTION /R will read from
     stdin.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 628 GLOBAL
!TTY

Purpose:  Execute a command in the current directory and its subdirectories.

Format:   GLOBAL [/H /I /P /Q] command

          command:  The command to execute, including arguments and
                    switches.

          /H(idden directories)       /P(rompt)
          /I(gnore exit codes)        /Q(uiet)
!TTY

Usage

GLOBAL performs the command first in the current directory and then in
every subdirectory under the current directory.  The command can be an
internal command, an alias, an external command, or a batch file.

This example copies the files in every directory on drive A to the
directory C:\TEMP:

     a:\> global copy *.* c:\temp

If files with the same name are found in more than one directory on A:,
assuming COPY is the default internal command, the one found last will
be left in C:\TEMP.  Which one of the identically named files is found
last is unpredictable!

If you use the /P option, GLOBAL will prompt for each subdirectory
before performing the command.  You can use this option if you want to
perform the command in most, but not all subdirectories of the current
directory.

You can use 085command grouping to execute multiple commands in
each subdirectory.  For example, the following command copies each .TXT
file in the current directory and all of its subdirectories to drive A.  It
then changes the extension of each of the copied files to .SAV:

     c:\> global (copy *.txt a: ^ ren *.txt *.sav)

If you receive a stack overflow error when using GLOBAL in complex, nested
command sequences, see the notes under the 574StackSize directive.

Options

!INDENT 5 5 0 5
     /H:  (Hidden directories) Forces GLOBAL to look for hidden and system
     subdirectories. If you don't use this switch, directories with either
     attribute will be ignored.

     /I:  (Ignore exit codes) If this option is not specified, GLOBAL will
     terminate if the command returns a non-zero exit code.  Use
     /I if you want the command to continue in additional subdirectories
     even if it returns an error in one subdirectory.  Even if you use /I,
     GLOBAL will normally halt execution if 4DOS receives a
     Ctrl-C or Ctrl-Break.

     /P:  (Prompt) Forces GLOBAL to prompt with each directory name before
     it performs the command.  Your options at the prompt are
     explained in detail under 045Page and File Prompts.

     /Q:  (Quiet) Do not display the directory names as each directory is
     processed.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 629 GOSUB
!TTY

Purpose:  Execute a subroutine in the current batch file.

Format:   GOSUB label [variables]

          label:      The batch file label at the beginning of
                      the subroutine.
          variables:  Optional GOSUB variables

!TTY

See also: 599CALL, 630GOTO and 659RETURN.

Usage

GOSUB can only be used in batch files.

4DOS allows subroutines in batch files.  A subroutine must start with a
label (a colon [:] followed by a one-word label name) which appears on
a line by itself.  Case differences are ignored when matching labels.
The subroutine must end with a RETURN statement.

The subroutine is invoked with a GOSUB command from another part of the
batch file.  After the RETURN, processing will continue with the command
following the GOSUB command.  For example, the following batch file
fragment calls a subroutine which displays the directory and returns:

     echo Calling a subroutine
     gosub subr1
     echo Returned from the subroutine
     quit
     :subr1
     dir /a/w
     return

GOSUB searches the entire batch file for the label, starting at the
beginning of the file.  If the label does not exist, the batch file is
terminated with the error message "Label not found."

You can define GOSUB variables by placing them after the label name on the
GOSUB line.  For example:

     Gosub Sub1 abc 15 "Hello World"

The variable names are defined on the label line.  For example:

     :Sub1 [str n world]

defines three variables - %str (set to "abc"), %n (set to 15), and %world
(set to "Hello World").  Note that the square brackets are required on the
label line.  GOSUB variables are only defined for the duration of the
subroutine.  They are not inherited by nested GOSUBs, and are destroyed by
the RETURN statement.

GOSUB calls with variables are limited to a maximum of 22 levels deep.
(There is no numerical limit on normal GOSUB calls.)

GOSUB variables are placed in the environment in a special form for
the duration of the subroutine, and will "mask" any environment
variables of the same name that existed before the subroutine was
called.  GOSUB variables can be referenced like normal environment
variables, but are not stored in the same way, and cannot be
modified with the 663SET, 622ESET, or 680UNSET commands.

You cannot use SET within a subroutine to change the value of a
GOSUB variable.  If you attempt to do so, the SET command will set
the standard environment variable of the same name, not the GOSUB
variable, but this value will be "masked" by the GOSUB variable and
will remain inaccessible until the subroutine ends.

GOSUB saves the 634IFF and 615DO states, so IFF statements inside a
subroutine won't interfere with statements in the part of the batch file
from which the subroutine was called.

You cannot 659RETURN from a GOSUB while inside a 615DO loop.

If 4DOS reaches the end of the batch file while inside a subroutine,
it will automatically return to the command after the GOSUB, just as
if an explicit 659RETURN command had been included as the last
line of the file.

Subroutines can be nested; the permissible nesting level depends on the
amount of free space in 4DOS's internal stack.  If you receive a stack
overflow error when using GOSUB in complex, nested command sequences, see
the notes under the 574StackSize directive.
;---------------------------------------------------------------------------
!TOPIC 630 GOTO
!TTY

Purpose:  Branch to a specified line inside the current batch file.

Format:   GOTO [/I] label

          label:  The batch file label to branch to.

          /I(FF and DO continue)
!TTY

See also: 629GOSUB.

Usage

GOTO can only be used in batch files.

After a GOTO command in a batch file, the next line to be executed will be
the one immediately after the label.  The label must begin with a colon
[:] and appear on a line by itself.  The colon is required on the line
where the label is defined, but is not required in the GOTO command
itself.  Case differences are ignored when matching labels.  Note: The
COMMAND.COM limitation that only the first 8 characters in labels are used
does not exist in 4DOS.  Batch files relying on this limitation may not run
correctly under 4DOS.

This batch file fragment checks for the existence of the file CONFIG.SYS.  If
the file exists, the batch file jumps to C_EXISTS and copies all the
files from the current directory to the root directory on A:.  Otherwise,
it prints an error message and exits.

     if exist config.sys goto C_EXISTS
     echo CONFIG.SYS doesn't exist - exiting.
     quit
     :C_EXISTS
     copy *.* a:\

GOTO searches the entire batch file for the label, starting at the
beginning of the file.  If the label does not exist, the batch file is
terminated with the error message "Label not found."

To avoid errors in the processing of nested statements and loops,
GOTO cancels all active 634IFF statements and 615DO / ENDDO
loops unless you use /I.  This means that a normal GOTO (without
/I) may not branch to any label that is between an IFF and the
corresponding ENDIFF or between a DO and the corresponding ENDDO.

For compatibility with CMD.EXE in the 25Windows NT line, the command

     GOTO :EOF

will end processing of the current batch file if the label :EOF does not
exist.  However, this is less efficient than using the 654QUIT or
600CANCEL command to end a batch file.

Options

!INDENT 5 5 0 5
     /I:  (IFF and DO continue) Prevents GOTO from canceling IFF
     statements and DO loops.  Use this option only if you are
     absolutely certain that your GOTO command is branching
     entirely within any current IFF statement and any active
     DO / ENDDO block.  Using /I under any other conditions
     will cause an error later in your batch file.
!INDENT 5 5 5 5

     You cannot branch into another IFF statement, another DO
     loop, or a different IFF or DO nesting level, whether you
     use the /I option or not.  If you do, you will
     eventually receive an "unknown command" error (or execution
     of the UNKNOWN_CMD 595alias) on a subsequent ENDDO, ELSE,
     ELSEIFF, or ENDIFF statement.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 697 HEAD
!TTY

Purpose:  Display the beginning of the specified file(s).

Format:   HEAD [/A:[[+|-]rhsad] /Cn /I"text" /Nn /P /Q /V] [@file] file...

          file:   The file or list of files that you want to display.
          @file:  A text file containing the names of the files to
                  display, one per line (see 057@file lists for details).

          /A: (Attribute select)      /P(ause)
          /C (Number of bytes)        /Q(uiet)
          /I (match description)      /V(erbose)
          /N (Number of lines)
!TTY

See also: 640LIST, 698TAIL, and 677TYPE.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Usage

The HEAD command displays the first part of a file.  It is normally only
useful for displaying ASCII text files.  Executable files (.COM and .EXE)
and many data files may be unreadable when displayed with HEAD because they
include non-alphanumeric characters.  You can press Ctrl-S to pause HEAD's
display and then any key to continue.

To display the first 15 lines of the files MEMO1 and MEMO2:

     c:\> head /n15 memo1 memo2

To display text from the clipboard, use CLIP: as the file name.  CLIP:
will not return any data unless the clipboard contains text.  See
051redirection for additional information on CLIP:, including details on
when you can use the clipboard under 4DOS.

Options

!INDENT 5 5 0 5
     /A:: (Attribute select) Select only those files that have the
     specified attribute(s) set.  The colon [:] after /A is
     required.  Preceding an attribute letter with a hyphen [-]
     will select files that do not have that attribute set.  You can
     OR attributes by preceding each attribute letter with a plus sign [+].

!INDENT 5 5 5 5
     The attributes are:

          R  Read-only      S  System
          H  Hidden         A  Archive

     If no attributes are listed at all (e.g., HEAD /A: ...), HEAD will
     select all files including hidden and system files.  If attributes are
     combined, all the specified attributes must match for a file to be
     selected.  For example, /A:RHS will select only those files
     with all three attributes set.
!INDENT 5 5 0 5

     /C:  Display the specified number of bytes.  /C accepts b, k, or m
     modifiers at the end of the number.  b is the number of 512-byte blocks,
     k is 1000's of bytes, K is kilobytes, m is millions of bytes, and M is
     megabytes.

     /I"text":  Select files by matching text in their descriptions.  The
     text can include 073wildcards and extended wildcards.  The search
     text must be enclosed in quotation marks, and must follow the /I
     immediately, with no intervening spaces.  You can select all filenames
     that have a description with /I"[?]*", or all filenames that do not 
     have a description with /I"[]".

     /N:  The number of lines to display.  The default is 10.

     /P:  (Pause) Prompt after displaying each page.  Your options at the
     prompt are explained in detail under 045Page and File Prompts.

     /Q:  (Quiet) Don't display a header for each file.  This is the
     default behavior unless /V is specified.

     /V:  (Verbose) Display a header for each file.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 631 HELP
!TTY

Purpose:  Display help for internal and external commands.

Format:   HELP [topic]

          topic:  A help topic, internal command, or external command.
!TTY

Usage

If you type the command HELP by itself (or press F1 when the command
line is empty), the table of contents is displayed.  If you type HELP plus a
topic name, that topic is displayed.  For example:

     help copy

displays information about the COPY command and its options.

For more information on this help system see 014Help Reference.
;---------------------------------------------------------------------------
!TOPIC 632 HISTORY
!TTY

Purpose:  Display, add to, clear, or read the history list.

Format:   HISTORY [/A command /F /N /P /R filename]

          command:   A command to be added to the history list.
          filename:  The name of a file containing entries to be added to
                     the history list.

          /A(dd)                      /P(ause)
          /F(ree)                     /R(ead)
          /N(o duplicates)
!TTY

See also: 613DIRHISTORY and 643LOG.

Usage

4DOS keeps a list of the commands you have entered on the command line.  See
033Command History and Recall for information on command recall, which
allows you to use the history list to repeat or edit commands you have
previously executed.

The HISTORY command lets you view and manipulate the command history list
directly.  If no parameters are entered, HISTORY will display the current
command history list:

     c:\> history

With the options explained below, you can clear the list, add new commands
to the list without executing them, save the list in a file, or read a new
list from a file.

The number of commands saved in the history list depends on the length of
each command line.  The history list size can be specified at startup from
256 to 8192 characters (see the 382History directive).  The default
size is 1024 characters.

Your history list can be stored either locally (a separate history list for
each copy of 4DOS) or globally (all copies of 4DOS share the same list).  For
full details see the discussion of local and global history lists under
033Command History and Recall.

You can use the HISTORY command as an aid in writing batch files by
redirecting the HISTORY output to a file and then editing the file
appropriately.  However, it may be easier to use the 643LOG /H command
for this purpose.

You can disable the history list or specify a minimum command-line
length to save on the Command Line page of the 648OPTION dialogs, or
with the 433HistMin directive in 4DOS.INI.

You can save the history list by redirecting the output of HISTORY to a file.
This example saves the command history to a file called HISTFILE and reads it
back again immediately.  If you leave out the HISTORY /F command on the
second line, the contents of the file will be appended to the current history
list instead of replacing it:

     c:\> history > histfile
     c:\> history /f
     c:\> history /r histfile

If you need to save your history at the end of each day's work, you might use
commands like this in your AUTOEXEC.BAT or other startup file:

     if exist c:\histfile history /r c:\histfile

     alias shut*down `history > c:\histfile`

This restores the previous history list if it exists, then defines an alias
which will allow you to save the history before shutting off the system.

Options

!INDENT 5 5 0 5
     /A:  (Add) Add a command to the history list.  This performs the same
     function as the Ctrl-K key at the command line (see
     033Command History and Recall).

     /F:  (Free) Erase all entries in the command history list.

     /N:  (No duplicates) Removes duplicate entries (oldest first) from
     the history list.  Also see the 451HistDups .INI directive.

     /P:  (Prompt) Wait for a key after displaying each page of the
     list.  Your options at the prompt are explained in detail under
     045Page and File Prompts.

     /R:  (Read) Read the command history from the specified file and
     append it to the history list currently held in memory.  Each line in
     the file must fit within the 044command line length limit.
!INDENT 5 5 5 5

     If you are creating a HISTORY /R file by hand, and need
     to create an entry that spans multiple lines in the file,
     you can do so by terminating each line, except the last,
     with an 086escape character.  However, you cannot use
     this method to exceed the command line length limit.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 775 IDLE
!TTY

Purpose:  Display, enable, or disable dynamic idle detection in DR DOS.

Format:   IDLE [ON | OFF]
!TTY

Usage

The IDLE command enables and disables the BatteryMAX ($IDLE$) device
driver.  IDLE OFF disables the device driver, while IDLE ON enables the
device driver.  The default state is enabled.  If the driver is not
installed, an error is returned.  The BatteryMAX ($IDLE$) driver is part
of both the DR DOS Power Management SDK and the DR DOS System Builder Kit.

You may wish to disable idle detection if it affects one of your
applications adversely, or if you want to demonstrate the benefits of idle
detection to yourself or others.

The IDLE command is valid only under DR DOS version 5.0 or later.
;---------------------------------------------------------------------------
!TOPIC 633 IF
!TTY

Purpose:  Execute a command if a condition or set of conditions is true.

Format:   IF [NOT] condition [.AND. | .OR. | .XOR. [NOT]
          condition ...] command
              or
          IF [NOT] condition [.AND. | .OR. | .XOR. [NOT]
          condition ...] (command) ELSE (command)

          condition:  A test to determine if the command should be executed.
          command:    The command to execute if the condition is true.
!TTY

See also: 634IFF, 287@IF.

Usage

IF is normally used only in aliases and batch files.  It is always followed
by one or more conditions and then a command.  First, the conditions are
evaluated.  If they are true, the command is executed.  Otherwise, the
command is ignored.  If you add a NOT before a condition, the command is
executed only when the condition is false.

You can link conditions with .AND., .OR., or .XOR., and you can
group conditions with parentheses (see Combining Tests below).  You can also
nest IF statements.

The conditions can test strings, numbers, the existence of a file or
subdirectory, the exit code returned by the preceding external command, and
the existence of aliases and internal commands.

The command can be an alias, an internal command, an external command, or a
batch file.  The entire IF statement, including all conditions and the
command, must fit on one line.

Some examples of IF conditions and commands are included below; additional
examples are included in the EXAMPLES.BTM file which came with 4DOS.

You can use 085command grouping to execute multiple commands if
the condition is true.  For example, the following command tests if any
.TXT files exist.  If they do, they are copied to drive A: and their
extensions are changed to .TXO:

     if exist *.txt (copy *.txt a: ^ ren *.txt *.txo)

(Note that the IFF command provides a more structured method of executing
multiple commands if a condition or set of conditions is true.)

If you receive a stack overflow error when using IF in complex, nested
command sequences, see the notes under the 574StackSize directive.

Conditions

The conditional tests listed in the following sections are available in both
the IF and IFF commands.  They fit into two categories:  string and numeric
tests, and status tests.  The tests can use environment variables, internal
variables and variable functions, file names, literal text, and numeric
values as their arguments.

String and Numeric Tests

Six test conditions can be used to test character strings.  The same
conditions are available for both numeric and normal text strings (see
below for details).  In each case you enter the test as:

     string1 operator string2

The operator defines the type of test (equal, greater than or equal,
and so on).  You should always use spaces on both sides of the
operator.  The operators are:

     Operator     Tests

     EQ or ==     string1 equal to string2
     NE or !=     string1 not equal to string2
     LT           string1 less than string2
     LE           string1 less than or equal to string2
     GE           string1 greater than or equal to string2
     GT           string1 greater than string2
     EQC          string1 equal to string2, including character case

When IF compares two character strings, it will use either a numeric
comparison or a string comparison.  A numeric comparison treats the
strings as numeric values and tests them arithmetically.  A string
comparison treats the strings as text.

The difference between numeric and string comparisons is best explained by
looking at the way two values are tested.  For example, consider comparing
the values 2 and 19.  Numerically, 2 is smaller, but as a string it is
"larger" because its first digit is larger than the first digit of 19.  So
the first of these conditions will be true, and the second will be false:

     if 2 lt 19 ...
     if "2" lt "19" ...

IF determines which kind of test to do by examining the first character of
each string.  If both strings begin with a numeric character (a digit,
sign, or decimal separator), a numeric comparison is used.  (If a string
begins with a decimal separator it is not considered numeric unless the next
character is a digit, and there are no more decimal separators within the
string.  For example, ".07" is numeric, but ".a" and ".07.50" are not.)  If
either value is non-numeric, a string comparison is used.  To
force a string comparison when both values are or may be numeric, use
double quotes around the values you are testing, as shown above.  Because
the double quote is not a numeric character, IF performs a string comparison.

Case differences are ignored in string comparisons (except by EQC).  If two
strings begin with the same text but one is shorter, the shorter string is
considered to be "less than" the longer one.  For example, "a" is less than
"abc", and "hello_there" is greater than "hello".

When you compare text strings, you may need to enclose the arguments
in double quotes in order to avoid syntax errors which can occur if
one of the argument values is empty (e.g., due to an environment
variable which has never been assigned a value).  This technique
will not work for numeric comparisons, as the quotes will force a
string compare, so with numeric tests you must be sure that all
variables are assigned values before the test is done.

Numeric comparisons work with both integer and decimal values.  The values
to be compared must contain only numeric digits, decimal points, and an
optional sign (+ or -).  The number may contain up to 20 digits to
the left of the decimal point, and 10 digits to the right.

161Internal variables and 241variable functions are very
powerful when combined with string and numeric comparisons.  They allow you
to test the state of your system, the characteristics of a file, date and
time information, or the result of a calculation.  You may want to review
the variables and variable functions when determining the best way to set
up an IF test.

This batch file fragment tests for a string value:

     input "Enter your selection : " %%cmd
     if "%cmd" == "WP" goto wordproc
     if "%cmd" NE "GRAPHICS" goto badentry

This example calls GO.BTM if the first two characters in the file MYFILE
are "GO":

     if "%@left[2,%@line[myfile,0]]" == "GO" call go.btm

The next two examples test whether there is more than 500 KBytes of free
memory or more than 2 MBytes of free EMS memory (the EMS example only
applies to 4DOS):

     c:\> if %@dosmem[K] gt 500 echo Over 500K free
     c:\> if %@ems[M] gt 2 echo Over 2 MB EMS free

Status Tests

These conditions test the system or 4DOS status.  You can use
internal variables and variable functions to test many other parts of the
system status.

     DEFINED variable
          If the variable exists in the environment, the condition is
          true.  This is equivalent to testing whether the variable is not
          empty, for example the following two commands are equivalent:

               if defined abc echo Hello
               if "%abc" != "" echo Hello

          Note that DEFINED tests only for environment variables, not for
          internal variables like _4VER or _ANSI.

     ERRORLEVEL [operator] n
          This test retrieves the exit code of the preceding external
          program.  By convention, programs return an exit code of 0 when
          they are successful and a number between 1 and 255 to indicate an
          error.  The condition can be any of the operators listed above
          (EQ, !=, GT, etc.).  If no operator is specified, the
          default is GE.  The comparison is done numerically.

          Not all programs return an explicit exit code.  For programs
          which do not, the behavior of ERRORLEVEL is undefined.

     EXIST filename
          If the file exists, the condition is true.  You can use wildcards
          in the filename, in which case the condition is true if any file
          matching the wildcard name exists.

          Do not use IF EXIST to test for existence of a directory (use IF
          ISDIR instead).  Due to variations in operating system internals,
          IF EXIST will not return consistent results when used to test for
          the existence of a directory.

     ISALIAS aliasname
          If the name is defined as an alias, the condition is true.

     ISDIR | DIREXIST path
          If the subdirectory exists, the condition is true.  For
          compatibility with the DR-DOS family, DIREXIST may be used as
          a synonym for ISDIR.

     ISFUNCTION functionname
          If the name is defined as a user-defined function, the condition 
          is true.

     ISINTERNAL command
          If the specified command is an active internal command, the
          condition is true.  Commands can be activated and deactivated
          with the 664SETDOS /I command.

     ISLABEL labelname
          If the specified name exists as a label in the current batch
          file, the condition is true.  Labels may be one or more words
          long.

The first batch file fragment below tests for the existence of A:\JAN.DOC
before copying it to drive C (this avoids an error message if the file does
not exist):

     if exist a:\jan.doc copy a:\jan.doc c:\

This example tests the exit code of the previous program and stops all
batch file processing if an error occurred:

     if errorlevel == 0 goto success
     echo "External Error -- Batch File Ends!"
     cancel

Combining Tests

You can negate the result of any test with NOT, and combine tests of
any type with .AND., .OR., and .XOR..

When two tests are combined with .AND., the result is true if both
individual tests are true.  When two tests are combined with .OR., the
result is true if either (or both) individual tests are true.  When two
tests are combined with .XOR., the result is true only if one of the
tests is true and the other is false.

This example runs a program called DATALOAD if today is Monday or Tuesday:

        if "%_dow" == "Mon" .or. "%_dow" == "Tue" dataload

Test conditions are always scanned from left to right -- there is no implied
order of precedence, as there is in some programming languages.  You can,
however, force a specific order of testing by grouping conditions with
parentheses, for example (enter this on one line):

     if (%a == 1 .or. (%b == 2 .and. %c == 3)) echo something

Parentheses can only be used when the portion of the condition inside the
parentheses contains at least one ".and.", ".or.", or ".xor.".  Parentheses
on a simple condition which does not combine two or more tests will be taken
as part of the string to be tested, and will probably make the test
fail.  For example, the first of these IF tests would fail; the second would
succeed:

     if (a == a) ...
     if (a == a .and. b == b) ...

Parentheses can be nested.  Under 4DOS, the permissible nesting level depends
on the amount of free space in 4DOS's internal stack; if you receive a stack
overflow error when using nested parentheses, see the notes under the
574StackSize directive.
;---------------------------------------------------------------------------
!TOPIC 634 IFF
!TTY

Purpose:  Perform IF / THEN / ELSE conditional execution of commands.

Format:   IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT]
               condition ...] THEN ^ commands
          [ELSEIFF condition  THEN ^ commands] ...
          [ELSE ^ commands]
          ^ ENDIFF

          condition:  A test to determine if the command(s) should be
                      executed.
          commands:   One or more commands to execute if the condition(s)
                      is true.  If you use multiple commands, they must be
                      separated by command separators or be placed on
                      separate lines of a batch file.
!TTY

See also: 633IF and 287@IF.

Usage

IFF is similar to the IF command, except that it can perform one set of
commands when a condition or set of conditions is true and a different set
of commands when the conditions are false.

IFF can also execute multiple commands when the conditions are true or
false; IF normally executes only one command.  IFF imposes no limit on the
number of commands and is generally a "cleaner" and more structured command
than IF.

IFF is always followed by one or more conditions.  If they are true, the
commands that follow the word THEN are executed.  Additional conditions can
be tested with ELSEIFF.  If none of these conditions are true, the commands
that follow the word ELSE are executed.  After the selected commands (if
any) are executed, processing continues after the word ENDIFF.

If you add a NOT before the condition, the THEN commands are executed only
when the condition is false and the ELSE commands are executed only when
the condition is true.

The commands may be separated by command separators, or may be on separate
lines of a batch file.  You should include a command separator or a line
break after a THEN, before an ELSEIFF, and before and after an ELSE.

IFF supports all of the same conditions as IF including string and numeric
comparisons, DEFINED, ERRORLEVEL, EXIST, ISALIAS, ISDIR /
DIREXIST, ISFUNCTION, ISINTERNAL, and ISLABEL.  See 633IF for
details on these conditions, and on linking them together using the
.AND. .OR. and .XOR. operators and parentheses.  You can nest IFF
statements up to 15 levels deep.

The commands can include any internal command, alias, external command, or
batch file.

The following batch file fragment tests the monitor type (monochrome or
color), and sets the appropriate colors and prompt:

     iff "%_monitor" == "color" then
       color bright white on blue ^ cls
       prompt=$e[s$e[1;1f$e[41;1;37m$e[K  Path: $p$e[u$e[44;37m$n$g
     else
       prompt=$e[s$e[1;1f$e[0;7m$e[K  Path: $p$e[u$e[0m$n$g
     endiff

(The above example uses 915ANSI color sequences in the prompt, which
will work only if an 842ANSI driver is loaded.  See 652PROMPT for
additional details.)

The alias in this second example checks to see if the argument is a
subdirectory.  If so, the alias deletes the subdirectory's files and removes
it (enter this on one line):

     c:\> alias prune `iff isdir %1 then ^ del /sxz %1 ^ else ^
          echo Not a directory!^endiff`

Be sure to read the cautionary notes about GOTO and IFF under the
630GOTO command before using a GOTO inside an IFF statement.

If you pipe data to an IFF, the data will be passed to the command(s)
following the IFF, not to IFF itself.
;---------------------------------------------------------------------------
!TOPIC 635 INKEY
!TTY

Purpose:  Get a single keystroke from the user and store it in an
          environment variable.

Format:   INKEY [/C /D /K"keys" /M /P /Wn /X] [prompt] %%varname

          prompt:   Optional text that is displayed as a prompt.
          varname:  The variable that will hold the user's keystroke.

          /C(lear buffer)             /P(assword)
          /D(igits only)              /W(ait)
          /K (valid keystrokes)       /X (no carriage return)
          /M(ouse button)
!TTY

See also: 636INPUT and 638KEYSTACK.

Usage

INKEY optionally displays a prompt.  Then it waits for a specified time or
indefinitely for a keystroke, and places the keystroke into an environment
variable.  It is normally used in batch files and aliases to get a menu
choice or other single-key input.  Along with the INPUT command, INKEY
allows great flexibility in reading input from within a batch file or
alias.

If prompt text is included in an INKEY command, it is displayed while INKEY
waits for input.

The following batch file fragment prompts for a character and stores it in
the variable NUM:

     inkey Enter a number from 1 to 9:  %%num

INKEY reads standard input for the keystroke, so it will accept keystrokes
from a redirected file or from the 53Keystack.  You can supply a
list of valid keystrokes with the /K option.

Standard keystrokes with ASCII values between 1 and 255 are stored directly
in the environment variable.  Extended keystrokes (for example, function
keys and cursor keys) are stored as a string in decimal format, with a
leading @ (for example, the F1 key is @59).  The Enter key is
stored as an extended keystroke, with the code @28.  See
911ASCII and Key Codes for a list of the ASCII and extended key codes.

To test for a non-printing ASCII keystroke returned by INKEY use the
243@ASCII function to get the numeric value of the key.  For example, to
test for Esc, which has an ASCII value of 27:

     inkey Enter a key:  %%key
     if "%@ascii[%key]" == "27" echo Esc pressed

If you press Ctrl-C or Ctrl-Break while INKEY is waiting for a key,
execution of an alias will be terminated, and execution of a batch file
will be suspended while you are asked whether to cancel the batch job.  A
batch file can handle Ctrl-C and Ctrl-Break itself with the 647ON
BREAK command.

Options

!INDENT 5 5 0 5
     /C:  (Clear buffer) Clears the keyboard buffer before INKEY accepts
     keystrokes.  If you use this option, INKEY will ignore any
     keystrokes which you type, either accidentally or
     intentionally, before INKEY is ready to accept input.

     /D:  (Digits only) Prevents INKEY from accepting any keystroke except
     a digit from 0 to 9.

     /K"keys":  (Valid keystrokes) Specify the permissible
     keystrokes.  The list of valid keystrokes should be enclosed
     in double quotes.  For alphabetic keys the validity test is not
     case-sensitive.  You can specify extended keys by enclosing their
     names in square brackets (within the quotes), for example:
!INDENT 5 5 5 5

          inkey /k"ab[Alt-F10]" Enter A, B, Alt-F10 %%var

     See 893Keys and Key Names for a complete listing of
     the key names you can use within the square brackets, and a
     description of the key name format.

     If an invalid keystroke is entered, 4DOS will echo the
     keystroke if possible, beep, move the cursor back one
     character, and wait for another keystroke.

!INDENT 5 5 0 5
     /M:  (Mouse buttons) Returns @240 for the left button, @241 for the
     right button, and @242 for the middle button.

     /P:  (Password) Prevents INKEY from echoing the character.

     /W:  (Wait) Timeout period, in seconds, to wait for a response.  If no
     keystroke is entered by the end of the timeout period, INKEY
     returns with the variable unchanged.  This allows you to continue the
     batch file if the user does not respond in a given period of time.  You
     can specify /W0 to return immediately if there are no keys waiting
     in the keyboard buffer.

     /X:  (No carriage return) Prevents INKEY from displaying a
     carriage return and line feed after the user's entry.

!INDENT 5 5 5 5
     For example, the following batch file fragment waits up to
     10 seconds for a character, then tests to see if a "Y" was
     entered:

          set net=N
          inkey /K"YN" /w10 Load network (Y/N)?  %%net
          iff "%net" == "Y" then
            rem  Commands to load the network go here
          endiff
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 636 INPUT
!TTY

Purpose:  Get a string from the keyboard and save it in an environment
          variable.

Format:   INPUT [/C /D /E /Ln /N /P /Wn /X] [prompt] %%varname

          prompt:   Optional text that is displayed as a prompt.
          varname:  The variable that will hold the user's input.

          /C(lear buffer)      /N(o colors)
          /D(igits only)       /P(assword)
          /E(dit)              /W(ait)
          /L(ength)            /X (no carriage return)
!TTY

See also: 635INKEY and 638KEYSTACK.

Usage

INPUT optionally displays a prompt.  Then it waits for a specified time or
indefinitely for your entry.  It places any characters you type into an
environment variable.  INPUT is normally used in batch files and aliases to
get multi-key input.  Along with the INKEY command, INPUT allows great
flexibility in reading user input from within a batch file or alias.

If prompt text is included in an INPUT command, it is displayed while INPUT
waits for input.  Standard command-line editing keys may be used to edit
the input string as it is entered.  If you use the /P password option,
INPUT will echo asterisks instead of the keys you type.

All characters entered up to, but not including, the carriage return are
stored in the variable.

The following batch file fragment prompts for a string and stores it in the
variable FNAME:

     input Enter the file name:  %%fname

INPUT reads standard input, so it will accept text from a redirected file
or from the KEYSTACK.

If you press Ctrl-C or Ctrl-Break while INPUT is waiting for input,
execution of an alias will be terminated, and execution of a batch file
will be suspended while you are asked whether to cancel the batch job.  A
batch file can handle Ctrl-C and Ctrl-Break itself with the 647ON
BREAK command.

In 4DOS you can 052pipe text to INPUT from another command, which will
stash the first line of the command's output in the specified
variable.  However, this trick will not work in 0204NT or Take Command,
which implement pipes differently.  The 265@EXECSTR function provides a
more portable way to get the first line of a command's output.

Options

!INDENT 5 5 0 5
     /C:  (Clear buffer) Clears the keyboard buffer before INPUT accepts
     keystrokes.  If you use this option, INPUT will ignore any
     keystrokes which you type, either accidentally or
     intentionally, before INPUT is ready.

     /D:  (Digits only) Prevents INPUT from accepting any keystroks except
     digits from 0 to 9.

     /E:  (Edit) Allows you to edit an existing value.  If there is no
     existing value for varname, INPUT proceeds as if /E had
     not been used, and allows you to enter a new value.

     /Ln:  (Length) Sets the maximum number of characters which INPUT will
     accept to "n".  If you attempt to enter more than this
     number of characters, INPUT will beep and prevent further
     input (you will still be able to edit the characters typed
     before the limit was reached).

     /N:  (No colors) Disables the use of input colors defined in the
     465InputColors directive in 4DOS.INI, and forces INPUT to use the
     default display colors.

     /P:  (Password) Tells INPUT to echo asterisks, instead of the
     characters you type.

     /W:  (Wait) Timeout period, in seconds, to wait for a response.  If no
     keystroke is entered by the end of the timeout period, INPUT
     returns with the variable unchanged.  This allows you to continue the
     batch file if the user does not respond in a given period of time.  If
     you enter a key before the timeout period, INPUT will wait indefinitely
     for the remainder of the line.  You can specify /W0 to return
     immediately if there are no keys waiting in the keyboard buffer.

     /X:  (No carriage return) Prevents INPUT from adding a carriage
     return and line feed after the user's entry.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 637 KEYBD
!TTY

Purpose:  Set the state of the keyboard toggles:  Caps Lock, Num Lock,
          and Scroll Lock.

Format:   KEYBD [/Cn /Nn /Sn]

          /C(aps lock)                /S(croll lock)
          /N(um lock)

n can be either 0 to turn off the toggle or 1 to turn on the toggle.
!TTY

Usage

Most keyboards have 3 toggle keys, the Caps Lock, Num Lock, and Scroll
Lock.  The toggle key status is usually displayed by three lights at the
top right corner of the keyboard.

This command lets you turn any toggle key on or off.  It is most useful in
batch files and aliases if you want the keys set a particular way before
collecting input from the user.

For example, to turn off the Num Lock and Caps Lock keys, you can use this
command:

     c:\> keybd /c0 /n0

If you use the KEYBD command with no switches, it will display the present
state of the toggle keys.

KEYBD works by performing a BIOS setting.  Some memory resident programs
that monitor the physical keyboard rather than BIOS settings may not
recognize that the state of the toggle keys has changed after a KEYBD
command.

The toggle key state is typically the same for all sessions, and changes
made with KEYBD in one session will therefore affect all other sessions.  The
only exception is when running under OS/2, where KEYBD affects only the
current 4DOS session.

Options

!INDENT 5 5 0 5
     /C:  (Caps lock) Turn the Caps Lock key on or off.

     /N:  (Num lock) Turn the Num Lock key on or off.

     /S:  (Scroll lock) Turn the Scroll Lock key on or off.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 638 KEYSTACK
!TTY

Purpose:  Feed keystrokes to a program or command automatically.

Format:   KEYSTACK [!] [/Wx] ["abc"] [keyname[n]] ...

          !:        Signal to clear the Keystack and the keyboard buffer.
          x:        Delay in clock ticks.
          "abc":    Literal characters to be placed in the Keystack.
          keyname:  Name or code for a key to be placed in the
                    Keystack.
          n:        Number of times to repeat the named key.

          /W(ait)
!TTY

Usage

KEYSTACK takes a series of keystrokes and feeds them to a program or
command as if they were typed at the keyboard.  When the program has used
all of the keystrokes in the keystack buffer, it will begin to read the
keyboard for input, as it normally would.

KEYSTACK places keystrokes into a buffer.  When an application program (or
4DOS itself) requests another keystroke, the "stacked" keystroke is retrieved
from the buffer.  The KEYSTACK command must be executed before running the
program which is going to receive the keystrokes in order to put the
keystrokes into the buffer first, so the program can find them when it runs.

KEYSTACK will only work if the memory-resident program 703KSTACK.COM has
been loaded.  KSTACK is usually loaded from 109AUTOEXEC.BAT.  If KSTACK is
not loaded, the KEYSTACK command will display an error message.  To load
KSTACK.COM, add this line to AUTOEXEC.BAT:

        d:\path\KSTACK.COM

where d:\path is the directory where your 4DOS files are stored.  If you
are using Windows 95/98/ME, see 795Installing KSTACK in Windows 95/98/ME.

Programs that bypass DOS and the BIOS for keyboard input cannot read
keystrokes entered with KEYSTACK.  If you use KEYSTACK and then run such a
program, the keystrokes will not appear in the program, but may appear at
the prompt when you exit the program and return to 4DOS.

Characters entered within double quotes ("abc") will be sent "as is" to
the application.  The only items allowed outside double quotes are key
names, key codes, the ! and /W options, and a repeat count.

See 893Keys and Key Names for a complete listing of key names and a
description of the key name and numeric key code format.  If you want to
send the same key name or numeric code several times, you can follow it with
a repeat count in square brackets.  For example, to send the Enter key 4
times, you can use this command:

     keystack enter [4]

The repeat count works only with individual keystrokes, or numeric keystroke
or character values.  It cannot be used with quoted strings.

An exclamation mark [!] will clear all pending keystrokes, both in the
KEYSTACK buffer and in the BIOS keyboard buffer.

For example, to start a program that needs a single space to skip its
opening screen you could use the command:

     c:\comm> keystack 32 ^ progname

This places a space (ASCII code 32) in the buffer, then runs the program.
When the program looks for a keystroke to end the display of the opening
screen the keystroke is already in the buffer, and the opening screen is
removed immediately.

You can store a maximum of 511 text or special characters in the KEYSTACK
buffer.  A delay takes two character slots in the buffer.  Each
time the KEYSTACK command is executed, it will clear any remaining
keystrokes stored by a previous KEYSTACK command.

You may need to experiment with your programs and insert delays (see the
/W option) to find a keystroke sequence that works for a particular
program.

Advanced Options

KEYSTACK treats the number 0 as a special case; it is used with programs
that flush the keyboard buffer.  When KEYSTACK processes a key value of 0,
it tells the program the buffer is clear, so subsequent keystrokes will be
accepted normally.  Some programs will require several "0"s before they
will accept input; you may need to experiment to determine the correct
number.

For example, the following batch file starts a spreadsheet program and loads
the file specified on the command line when the batch file is invoked:

     pushd c:\finance
     keystack 0 Enter 0 Enter 0 Enter 0 Enter 0 Enter "/FR" 0 "%1" Enter
     spread
     popd

The sequence of "0 Enter" pairs tells the program that the keyboard buffer is
empty, then passes a carriage return, repeating this sequence five
times.  (You must determine the actual sequence required by your software
through experimentation.  Few programs require as long a startup sequence as
is shown here.)  This gets the program to a point where an empty spreadsheet
is displayed.  The rest of the KEYSTACK line issues a File Retrieve command
(/FR), simulates an empty keyboard buffer once more, enters the file name
passed on the batch command line (%1), and finally enters a carriage return
to end the file name.

Here's the same command defined as an alias (enter this on one line):

     alias sload `pushd c:\finance ^ keystack 0 Enter 0 Enter 0 Enter 0
      Enter 0 Enter "/FR" 0 "%1" Enter ^ spread ^ popd`

KEYSTACK mimics the BIOS by stacking both an ASCII code and a scan code for
each key.  It does so by calculating the code for each character, whether it
is entered as part of a quoted string, as a key name, or as an ASCII value
less than 128.  However, if you are stacking keys for a program which
distinguishes between keys with the same symbol, like the plus on the
keyboard and the gray plus, you will have to calculate the codes for the keys
on the numeric keypad yourself.

Calculate the value ((256 * scan code) + ASCII code) and enter that numeric
value as an argument for KEYSTACK.  For example, for the Enter key on the
numeric keypad, the scan code is 224 and the ASCII code is 13, so to stack
both values use ((256 * 224) + 13) or KEYSTACK 57357.  Try this approach if
a "normal" KEYSTACK command does not work (for example, if you use KEYSTACK
Enter for the Enter key and the program doesn't see the correct
character).  To stack such combined key codes you must use the numeric
value, not the key name.  See 911ASCII and Key Codes for a complete list
of ASCII codes and scan codes.

Option

!INDENT 5 5 0 5
     /W:  (Wait) Delay the next keystroke in the KEYSTACK buffer by a
     specified number of clock "ticks".  A clock tick is
     approximately 1/18 second.  The number of clock ticks to
     delay should be placed immediately after the W, and must
     be between 1 and 65535 (65535 ticks is about 1 hour).  You
     can use the /W option as many times as desired and at
     any point in the string of keystrokes except within double
     quotes.  Some programs may need the delays provided by
     /W in order to receive keystrokes properly from
     KEYSTACK.  The only way to determine what delay is needed is
     to experiment.  Sometimes a combination of a delay and an
     "empty buffer" signal (a 0) are required.

!INDENT 5 5 5 5
     For example, to start the program CADX and send it an F7, a delay
     of one second, an indication that the keyboard buffer is empty, and
     a carriage return:

          c:\> keystack F7 /W18 0 Enter ^ cadx
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 687 LFNFOR
!TTY

Purpose:  Enable and disable LFN support for FOR wildcards
          in Windows 95/98/ME.

Format:   LFNFOR [ON | OFF]
!TTY

See also: 626FOR, 334@ALTNAME, and 296@LFN.

Usage

If you use wildcards in the set of a FOR command, 4DOS returns long
file names on an LFN volume by default.  For example, the command:

     c:\> for %f in (*.*) do echo %f

will, by default, display the long version of each filename in the
current directory.

You can alter this behavior with LFNFOR.  After the command

     c:\> lfnfor off

the same command will return the short version of each filename in
the current directory.  You can restore the default behavior with
the command

     c:\> lfnfor on

If you enter LFNFOR without either ON or OFF, 4DOS will report the
current state of LFNFOR.

LFNFOR is included for compatibilty with COMMAND.COM.  Under 4DOS,
you may find it easier to use 334@ALTNAME and 296@LFN to
convert between long and short filenames returned by FOR.

LFNFOR only affects the filenames and pathnames in a FOR command,
and only when wildcards are used in the set.  It has no effect on
DIR, SELECT, or any other command which returns file and path names.
;---------------------------------------------------------------------------
!TOPIC 639 LH
!TTY

Purpose:  Load a memory resident program into an Upper Memory Block (UMB).

Format:   LH [/L:r1,n1;r2,n2;... /S] filename
               or
          LOADHIGH [/L:r1,n1;r2,n2;... /S] filename

          filename:  The name of the program to load into high memory.

          /L(oad region)              /S(hrink)
!TTY

Usage

LH and LOADHIGH are synonyms.  You can use either one.

LOADHIGH requires version 5.0 or later of MS-DOS, PC DOS, or DR-DOS;
Windows 95/98/ME; or an OS/2 DOS session.

If you load memory-resident programs into UMBs, you will have more room in
conventional memory for application programs.  If your system has no UMBs,
or if the program is larger than the largest UMB, then LOADHIGH will load
the program into conventional base memory.

For example, to load the program C:\UTIL\CACHE.EXE into high memory:

     c:\> loadhigh c:\util\cache.exe

If you are running MS-DOS / PC DOS 5.0 or above, Windows 95/98/ME,
or an OS/2 2.x DOS session, LOADHIGH requires the DOS=UMB command
in your CONFIG.SYS file.

If you use a memory manager like 386MAX or QEMM to manage your UMBs,
rather than the DOS or Windows memory manager and the DOS=UMB directive,
then LOADHIGH will not work, and you must use the equivalent command
supplied with your memory manager in order to load programs high.

The /L and /S switches are designed to aid in optimizing the use
of upper memory by selecting one or more UMB regions for a particular
memory-resident program to use.  They are fully compatible with the MS-DOS
6.0 and above memory optimizer, 769MEMMAKER, and may also be used
under MS-DOS / PC DOS 5.0 and in OS/2 DOS sessions.

While a complete discussion of memory optimization techniques is well
beyond the scope of this help system (see also
the 65535external DOS help system), the basic technique is to load each
memory-resident program into a specific region to free up the maximum
possible amount of base memory.

Options

!INDENT 5 5 0 5
     /L:r1,n1;r2,n2;... :  (Load region) Specifies which region(s)
     should be used for the program, and optionally the minimum
     free space required in a region before the program is
     allowed access to that region.
!INDENT 5 5 5 5

     If /L is not used, all upper memory regions are
     available to the program.  If /L is used, you must
     specify one or more regions (r1, r2, etc.); only
     those regions will be made available.  Upper memory regions
     are numbered sequentially beginning with 1 (region 0 refers
     to low memory, and is normally used only by 769MEMMAKER).

     If only a region number is given, the entire region is made
     available to the program (assuming there is free space in
     the region).  If a size is given for a particular region
     (n1, n2, etc.), then the region is only made
     available if the free space in the region is equal to or
     greater than that size.  All sizes are in bytes.  Any region
     not available to a particular program is "locked out" while
     that program is loading and made available again once the
     program is loaded.  If the combination of /L values you
     use does not provide sufficient upper memory space for the
     program to load, it will be loaded in low memory.

     You can combine /L values in several ways.  In each of
     the following examples, if the requested space is not
     available or is insufficient the program is loaded into low
     memory:

          lh /l:2 filename
            The program can use region 2 only.

          lh /l:2;3 filename
            The program can use regions 2 and 3 only.

          lh /l:2,2048 filename
            The program can use region 2 only, and only if it
            has 2048 or more bytes free.

          lh /l:2,2048;3 filename
            The program can use region 2 if it has 2048 or more
            bytes free, and region 3 regardless of how many
            bytes it has free

!INDENT 5 5 0 5
     /S:  (Shrink) Shrinks each region selected by /L to the minimum
     size used in /L before loading the program.  This prevents
     memory-resident programs which take all available memory from using
     more than you want them to.  This switch is primarily intended for use
     by 769MEMMAKER.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 640 LIST
!TTY

Purpose:  Display a file, with forward and backward paging and scrolling.

Format:   LIST [/A:[[+|-]rhsad] /H /I /I"text" /Ln /N /R /S /T"text" /W /X]
          [@file] file...

          file:   A file or list of files to display.
          @file:  A text file containing the names of files to view,
                  one per line (see 057@file lists for details).

          /A: (Attribute select)       /R(everse)
          /H(igh bit off)              /S(tandard input)
          /I(gnore wildcards)          /T (search for text)
          /I"text" (match description) /W(rap)
          /L(ine offset)               /X (heX display mode)
          /N (line Numbers)
!TTY

See also: 697HEAD, 698TAIL, and 677TYPE.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Usage

LIST provides a fast and flexible way to view a file, without the overhead
of loading and using a text editor.

For example, to display a file called MEMO.DOC:

     c:\> list memo.doc

LIST is most often used for displaying ASCII text files.  It can be used for
other files which contain non-alphabetic characters, but you may need to use
hex mode (see below) to read these files.

LIST uses the cursor pad to scroll through the file.  The following keys
have special meanings:

     Space        Display the next page of the file (same as PgDn).
     Home         Display the first page of the file.
     End          Display the last page of the file.
     Esc          Exit the current file.
     Del          Prompt to delete the file.
     Insert       Prompt to save the file or pipe to a new name.
     Tab          Set a new tab size.
     Ctrl-PgUp    Display previous file.
     Ctrl-PgDn    Display next file.
     Ctrl-C       Quit LIST.
     Up           Scroll up one line.
     Down         Scroll down one line.
     Left         Scroll left 8 columns.
     Right        Scroll right 8 columns.
     Ctrl-Left    Scroll left 40 columns.
     Ctrl-Right   Scroll right 40 columns.
     F1           Display online help
     Del          Prompt whether to delete the file.
     Ins          Prompt whether to save the pipe or file to a new
                  name.
     Tab          Prompt for a new default tab size.
     B            Go back one file to the previous file in the current
                  group of files.
     F            Prompt and search for a string.
     Ctrl-F       Prompt and search for a string, searching backward from
                  the end of the file.
     G            Go to a specific line, or, in hex mode, to a specific
                  hexadecimal offset.
     H            Toggle the "strip high bit" (/H) option.
     I            Display information on the current file (the full
                  name, size, date, and time).
     L            Toggle the "line numbering" (/L) option.
     N            Find next matching string.
     Ctrl-N       Find previous match in the file.
     P            Print the current page or the entire file.
     W            Toggle the "line wrap" (/W) option.
     X            Toggle the hex-mode display (/X) option.

Text searches performed with F, N, Ctrl-F, and Ctrl-N are not
case-sensitive unless you hold a Shift key while pressing F or Ctrl-F,
in which case the searches become case-sensitive.

If the display is currently in hexadecimal mode and you press F or Ctrl-F,
you will be prompted for whether you want to search in hexadecimal mode.  If
you answer Y, you should then enter the search string as a sequence of
2-digit hexadecimal numbers separated by spaces, for example 41 63 65 (these
are the 912ASCII values for the string "Ace").  Hexadecimal searches are
case-sensitive, and search for exactly the string whose ASCII values you
enter.  The string can be any sequence of bytes in this mode, not just text.

When the search string is found LIST displays the line containing the string
at the top of the screen, and highlights the string it found.  Any
additional occurrences of the string on the same display page are also
highlighted.  Highlighting is intended for use with text files; in binary
files the search string will be found, but may not be highlighted properly.

You can use 073wildcards in the search string.  For example, you can
search for the string "to*day" to find the next line which contains
the word "to" followed by the word "day" later on the same line, or
search for the numbers "101" or "401" with the search string "[14]01".  If you
begin the search string with a back-quote [`], or enclose it in
back-quotes, wildcard characters in the string will be treated as normal text
with no special wildcard meaning.

LIST saves the search string used by F, N, Ctrl-F, and Ctrl-N, so
you can LIST multiple files and search for the same string simply by
pressing N in each file, or repeat your search the next time you use LIST.

You can use the /T switch to specify search text for the first
file.  When you do so, LIST begins a search as soon as the file is
loaded.  Use /I to ignore wildcards in the initial search string,
and /R to make the initial search go backwards from the end of the
file.  When you LIST multiple files with a single LIST command, these
switches affect only the first file; they are ignored for the second and
subsequent files.

You can use the G key to go to a specific line number in the file (or
to a specified hexadecimal offset in hex mode).  LIST numbers lines
beginning with 1, unless 475ListRowStart is set to 0.  A new line
is counted for every CR or LF character (LIST determines automatically
which character is used for line breaks in each file), or when line
length reaches 511 characters, whichever comes first.

LIST normally allows long lines in the file to extend past the right edge
of the screen.  You can use the horizontal scrolling keys (see above) to
view text that extends beyond the screen width.  If you use the W
command or /W switch to wrap the display, each line is wrapped when it
reaches the right edge of the screen, and the horizontal scrolling keys are
disabled.

To view output from another command simply pipe the output of the
command to LIST, for example:

     c:\> dir | list

Normally LIST will detect input from a pipe auomatically, but if it
does not, use /S to explicitly specify piped input.

To view text from the clipboard, use CLIP: as the file to be listed.  CLIP:
will not return any data unless the clipboard contains text.  See
051redirection for additional information on CLIP:, including details on
when you can use the clipboard under 4DOS.

If you print the file which LIST is displaying, you will be asked
whether you wish to print the entire file or the current display page.  The
print format will match the display format.  If you have switched
to hexadecimal or wrapped mode, that mode will be used for the printed
output as well.  If you print in wrapped mode, long lines will be
wrapped at the width of the display.  If you print in normal display
mode without line wrap, long lines will be wrapped or truncated by the
printer, not by LIST.

Printed output normally goes to device LPT1.  If you wish to send the
printed output to another device, use the Commands page of the 648OPTION
dialogs, or the 441Printer directive in 4DOS.INI.

If you specify a directory name instead of a filename as an argument, LIST
will display each of the files in that directory.

Most of the LIST keystrokes can be reassigned with 481key mapping
directives in 4DOS.INI.

You can set the colors used by LIST on the Commands page of the 648OPTION
dialogs, or the 467ListColors and 468ListStatBarColors directives in
4DOS.INI.  If ListColors is not used, the LIST display will use the current
default colors.  If ListStatBarColors is not used, the status bar will use the
reverse of the LIST display colors.

By default, LIST sets tab stops every 8 columns.  You can change this
behavior on the Display page of the 648OPTION dialogs, or with the
444TabStops .INI file directive.

LIST normally writes text directly to the screen.  If you have an unusual
display adapter which does not support direct video output, see the
572OutputBIOS directive.

Options

!INDENT 5 5 0 5
     /A::  (Attribute select) Select only those files that have the specified
     attribute(s) set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      S  System
          H  Hidden         A  Archive

     If no attributes are listed at all (e.g., LIST /A: ...), LIST will
     select all files including hidden and system files.  If attributes are
     combined, all the specified attributes must match for a file to be
     selected.  For example, /A:RHS will select only those
     files with all three attributes set.
!INDENT 5 5 0 5

     /H:  (High bit off) Strip the high bit from each character before
     displaying.  This is useful when displaying files created by
     some word processors that turn on the high bit for
     formatting purposes.  You can toggle this option on and off
     from within LIST with the H key.

     /I:  (Ignore wildcards) Only meaningful when used in conjunction with
     the /T "text" option.  Directs LIST to interpret characters such as
     *, ?, [, and ] as literal characters instead of wildcard
     characters.  /I affects only the initial search started by /T, not
     subsequent searches started from within LIST.

     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /Ln: (Line offset) Start at line n (no space is allowed between L and
     n).  This option only affects the initial page display; it does not
     prevent you from subsequently scrolling back to the start of the file.
     If /X is also specified, n designates a hexadecimal offset from the
     start of file.  Thus, the /L option is equivalent to the G (goto) key.

     /N:  (line numbers) Display line numbers.  This option is useful with
     source code listings and other text files where the exact line numbers
     are important.  You can toggle this option on and off from within LIST
     with the L key.

     /R:  (Reverse) Only meaningful when used in conjuction with the
     /T "text" option.  Directs LIST to search for text from the end of
     the file instead of from the beginning of the file.  Using this switch
     can speed up searches for text that is normally near the end of the
     file, such as a signature.  /R affects only the initial search
     started by /T, not subsequent searches started from within LIST.

     /S:  (Standard input) Read from standard input rather than a
     file.  This allows you to redirect command output and view it with
     LIST.  Normally, LIST will detect input from a redirected command and
     adjust automatically.  However, you may find circumstances when /S is
     required.  For example, to use LIST to display the output of DIR you
     could use either of these commands:

!INDENT 5 5 5 5
          c:\> dir | list
          c:\> dir | list /s

!INDENT 5 5 0 5
     /T:  (Text) Search for text in the first file.  This option is the
     same as pressing F, but it allows you to specify the search text on
     the command line.  The text must be contained in quotation marks if
     it contains spaces, punctuation, or wildcard characters.  For example, to
     search for the string 4DOS in the file README.DOC, you can use this
     command:

!INDENT 5 5 5 5
          c:\> list /t4dos readme.doc

     The search text may include 073wildcards and extended wildcards.  For
     example, to search for the words Hello and John on the same line in the
     file LETTER.DAT:

          c:\> list /t"Hello*John" letter.dat

     When you LIST multiple files with a single LIST command, /T only
     initiates a search in the first file.  It is ignored for the second and
     subsequent files.  Also see /I and /R.

     If /X is also given, the argument of /T must be an enclosed in double
     quotes sequence of 2-digit hexadecimal numbers separated by spaces, for
     example "E8 0C 66 01 00".

!INDENT 5 5 0 5
     /W:  (Wrap) Wrap the text at the right edge of the screen.  This
     option is useful when displaying files that don't have a carriage
     return at the end of each line.  The horizontal scrolling
     keys do not work when the display is wrapped.  You can toggle this
     option on and off from within LIST with the W key.

     /X:  (hex mode) Display the file in hexadecimal (hex) mode.  This
     option is useful when displaying executable files and other
     files that contain non-text characters.  Each byte of the
     file is shown as a pair of hex characters.  The corresponding
     text is displayed to the right of each line of hexadecimal data.  You
     can toggle this mode on and off from within LIST with the X key.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 641 LOADBTM
!TTY

Purpose:  Switch a batch file to or from BTM mode.

Format:   LOADBTM [ON | OFF]
!TTY

Usage

4DOS recognizes two kinds of 102batch files: .BAT and .BTM.  Batch
files executing in BTM mode run two to ten times faster than in BAT
mode.  (However, BTM mode should not be used to load
memory-resident programs in DOS, nor should BTM mode be used for
self-modifying batch files.)  Batch files automatically start in the
mode indicated by their extension.

The LOADBTM command turns BTM mode on and off.  It can be used to
switch modes in either a .BAT or .BTM file.  If you use LOADBTM with
no argument, it will display the current batch mode:  LOADBTM ON or
LOADBTM OFF.

Using LOADBTM to repeatedly switch modes within a batch file is not
efficient.  In most cases the speed gained by running some parts of the file
in BTM mode will be more than offset by the speed lost through repeated
loading of the file each time BTM mode is invoked.

LOADBTM can only be used within a batch file.  It is most often used
to switch a .BAT file into BTM mode after memory-resident programs
are loaded, to convert a .BAT file to BTM mode without changing its
extension, or to switch a .BTM file into BAT mode in order to load
memory-resident programs.

The following .BAT file fragment loads some memory resident programs (TSRs),
and then switches to BTM mode:

     rem  Because this file has a .BAT extension,
     rem  the initial default state is LOADBTM OFF
     rem  Loading TSRs...
     ansi.com
     mouse.com
     rem  Switch to high-speed (BTM) mode now that
     rem  TSRs are loaded
     loadbtm on
     path c:\;c:\util;c:\dos
     alias /r c:\aliases
     .....
;---------------------------------------------------------------------------
!TOPIC 642 LOCK
!TTY

Purpose:  Lock a disk drive to allow exclusive access under Windows.

Format:   LOCK [drive: ...]

          drive:  The drive or list of drives to lock.
!TTY

See also: 679UNLOCK.

Usage

LOCK is only available when 4DOS is running under Windows 95/98/ME.  LOCK
locks the specified drive(s) so that the 4DOS session, and the programs you
run in it, have exclusive access to those drive(s).  This allows you to run
programs (such as disk maintenance utilities) which access the disk drive
directly, without rebooting in DOS.

If no drives are specified, 4DOS will attempt to lock all drives.

Use extreme caution with programs which access the disk drive directly
(and therefore require LOCK) and which were not written for Windows 95/98/ME.
If such programs are unaware of Windows's changes to the FAT directory
structure, they can damage or destroy files, filenames, and system data.
This damage can be caused whether you run such programs under Windows,
or from a DOS boot without the Windows GUI.
;---------------------------------------------------------------------------
!TOPIC 643 LOG
!TTY

Purpose:  Save a log of commands to a disk file.

Format:   LOG [/E /H /W file] [ON | OFF | text]

          file:  The name of the file to hold the log.
          text:  An optional message that will be added to the log.

          /E(rror log)                /W(rite to file)
          /H(istory log)
!TTY

See also: 632HISTORY.

Usage

LOG keeps a record of all internal and external commands you use, whether
they are executed from the prompt or from a batch file.  Each entry includes
the shell level and the current system date and time, along with the actual
command after any alias or variable expansion.  You can use the log file as
a record of your daily activities.  The 399LogOn directive can be used
to enable command logging by default when 4DOS starts.

LOG with the /H option keeps a similar record called a "history
log."  The history log records only commands entered at the prompt; it does
not record batch file commands.  In addition, the history log does not record
the date and time for each command, and it records commands before aliases
and variables are expanded.  The 400HistLogOn directive can be used to
enable history logging by default when 4DOS starts.

By default, LOG writes to the file 4DOSLOG in the root directory of the
boot drive.  The default file name for LOG /H is 4DOSHLOG.  You can set the
default log file names on the Options 2 page of the
648OPTION dialogs, or with the 437LogName and 432HistLogName
directives in the .INI file.

Entering LOG or LOG /H with no parameters displays the name of the log file
and the log status (ON or OFF):

     c:\> log
     LOG (C:\4DOSLOG) is OFF

To enable or disable logging, add the word "ON" or "OFF" after the LOG
command:

     c:\> log on

or

     c:\> log /h on

Entering LOG or LOG /H with text writes a message to the log file, even if
logging  is set OFF.  This allows you to enter headers in the log file:

     c:\> log "Started work on the database system"

The LOG file format looks like this:

     [date  time]  command

where the date and time are formatted according to the country code set
for your system.

The LOG /H output can be used as the basis for writing batch files.  Start
LOG /H, then execute the commands that you want the batch file to
execute.  When you are finished, turn LOG /H off.  The resulting file can be
turned into a batch file that performs the same commands with little or no
editing.

Options

!INDENT 5 5 0 5
     /E:  (Error log) This option saves all error messages to the log.  It
     applies only to the command log; /E has no effect on the history log.

     /H:  (History log) This option makes the other options on the command
     line (after the /H) apply to the history log.  For example, to turn on
     history logging and write to the file C:\LOG\HLOG:

!INDENT 5 5 5 5
          c:\> log /h /w c:\log\hlog

!INDENT 5 5 0 5
     /W:  (Write) This switch specifies a different filename for the LOG or
     LOG /H output.  It also automatically performs a LOG ON
     command.  For example, to turn logging on and write the log
     to C:\LOG\LOGFILE:

!INDENT 5 5 5 5
          c:\> log /w c:\log\logfile

!INDENT 5 5 0 5
          Once you select a new file name with the LOG /W or LOG /H/W
     command, LOG will use that file until you issue another LOG /W
     or LOG /H/W command, or until you reboot your computer.  Turning
     LOG or LOG /H off or on does not change the file name.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 644 MD
!TTY

Purpose:  Create a subdirectory.

Format:   MD [/N /S] path...
               or
          MKDIR [/N /S] path...

          path:  The name of one or more directories to create.

          /N(o update)                /S(ubdirectories)
!TTY

See also: 655RD.

Usage

MD and MKDIR are synonyms.  You can use either one.

MD creates a subdirectory anywhere in the directory tree.  To create a
subdirectory from the root, start the path with a backslash [\].  For
example, this command creates a subdirectory called MYDIR in the root
directory:

     c:\> md \mydir

If no path is given, the new subdirectory is created in the current
directory.  This example creates a subdirectory called DIRTWO in the
current directory:

     c:\mydir> md dirtwo

To create a directory from the parent of the current directory (that is, to
create a sibling of the current directory), start the pathname with two
periods and a backslash [..\].

You must quote any path which contains whitespace or special characters
(see 945File Names for details).

If MD creates one or more directories, they will be added automatically to
the 048extended directory search database unless the /N option is
specified.

Options

!INDENT 5 5 0 5
     /N:  (No update) Do not update the 048extended directory search
     database, JPSTREE.IDX.  This is useful when creating a temporary
     directory which you do not want to appear in the extended search
     database.

     /S:  (Subdirectories) MD creates one directory at a time unless you
     use the /S option.  If you need to create the directory
     C:\ONE\TWO\THREE and none of the named directories exist,
     you can use /S to have MD create all of the necessary
     subdirectories for you in a single command:

!INDENT 5 5 5 5
          c:\> md /s \one\two\three
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 645 MEMORY
!TTY

Purpose:  Display the amount and status of system RAM.

Format:   MEMORY
!TTY

Usage

MEMORY displays information about the RAM in your system.

MEMORY lists the amount of total RAM in your system and the amount
available for applications after DOS, 4DOS, and memory-resident programs
have been loaded; the amount of EMS expanded memory, XMS extended memory,
and total extended memory; the HMA status; and the amount of memory 4DOS
is using for environment variable space, alias space, function space, and
history space.

You can use the information from the MEMORY display to fine tune your
system, to aid in setting the proper alias and environment sizes in
4DOS.INI, and to be sure that you have sufficient memory for your largest
applications.

If you compare the free RAM displayed by MEMORY with the free RAM displayed
by CHKDSK and some memory map programs, MEMORY will usually show a slightly
higher value.  The difference is the size of the environment passed to
these external programs; most memory mapping programs do not count the
passed environment as free space, but MEMORY does.
;---------------------------------------------------------------------------
!TOPIC 646 MOVE
!TTY

Purpose:  Move files to a new directory and drive.

Format:   MOVE [/A:[[+|-]rhsad] /C /D /E /F /G /H /I"text" /M /N /O /P /Q
          /R /S /T /U /V /W /Z] [@file] source... destination

          source:       A file or list of files to move.
          destination:  The new location for the files.
          @file:        A text file containing the names of the source
                        files to move, one per line (see 057@file lists
                        for details).

          /A: (Attribute select)      /O (move if not exist)
          /C(hanged)                  /P(rompt)
          /D(irectory)                /Q(uiet)
          /E (no error messages)      /R(eplace)
          /F(orce delete)             /S(ubdirectory tree)
          /G (percent moved)          /T(otal)
          /H(idden and system)        /U(pdate)
          /I (match descriptions)     /V(erify)
          /M(odified files)           /W(ipe)
          /N(othing)                  /Z (overwrite readonly files)

!TTY

See also: 606COPY and 658REN.

File Selection

Supports extended 073wildcards, 074ranges,
079multiple file names, and 080include lists.  Date, time, size or
file exclusion ranges anywhere on the line apply to all source files.

Use wildcards with caution on LFN volumes; see 081LFN File Searches for
details.

Usage

The MOVE command moves one or more files from one directory to another,
whether the directories are on the same drive or not.  It has the same
effect as copying the files to a new location and then deleting the
originals.  Like COPY and RENAME, MOVE works with single files, multiple
files, and sets of files specified with an include list.

The simplest MOVE command moves a single source file to a new location and,
optionally, gives it a new name.  These two examples both move one file
from drive C: to the root directory on drive A:

     c:\> move myfile.dat a:\
     c:\> move myfile.dat a:\savefile.dat

In both cases, MYFILE.DAT is removed from drive C: after it has been copied
to drive A:.  If a file called MYFILE.DAT in the first example, or
SAVEFILE.DAT in the second example, already existed on drive A:, it would
be overwritten.  (This demonstrates the difference between MOVE and
RENAME.  MOVE will move files between drives and will overwrite the
destination file if it exists; RENAME will not.)

When you move a single file, the destination can be a directory
name or a file name.  If it is a directory name, and you add a backslash
[\] to the end of the name, MOVE will display an error message if
the name does not refer to an existing directory.  You can use this feature
to keep MOVE from treating a mistyped destination directory name as
a file name, and attempting to move the source file to that name.

If you MOVE multiple files, the destination must be a directory name.  MOVE
will move each file into the destination directory with its original
name.  If the destination is not a directory, MOVE will display an error
message and exit.  For example, if C:\FINANCE\MYFILES is not a directory,
this command will display an error; otherwise, the files will be moved to
that directory:

     c:\> move *.wks *.txt c:\finance\myfiles

The /D option can be used for single or multiple file moves; it
checks to see whether the destination is a directory, and will
prompt to see if you want to create the destination directory if it
doesn't exist.

If MOVE creates one or more destination directories, they will be added
automatically to the 048extended directory search database.

You cannot move a file to a character device like the printer, or to
itself.

Be careful when you use MOVE with the 662SELECT command.  If you
SELECT multiple files and the destination is not a directory (for example,
because of a misspelling), MOVE will assume it is a file name.  In this
case each file will be moved in turn to the destination file, overwriting the
previous file, and then the original will be erased before the next file is
moved.  At the end of the command, all of the original files will have been
erased and only the last file will exist as the destination file.

You can avoid this problem by using square brackets with SELECT instead of
parentheses (be sure that you don't allow the command line to get too long
-- watch the character count in the upper left corner while you're selecting
files).  MOVE will then receive one list of files to move instead of a
series of individual filenames, and it will detect the error and halt.  You
can also add a backslash [\] to the end of the destination name to ensure
that it is the name of a subdirectory (see above).

Advanced Features and Options

MOVE first attempts to rename the file(s), which is the fastest way to move
files between subdirectories on the same drive.  If that fails (e.g., because
the destination is on a different drive or already exists), MOVE will copy the
file(s) and then delete the originals.

If you are using 4DOS in an OS/2 DOS session, MOVE will copy OS/2
Extended Attributes from the source to the destination, provided the file
system on the destination drive supports them.

If MOVE must physically copy the files and delete the originals, rather
than renaming them (see above), then some disk space may be freed on the
source drive.  MOVE displays the amount of disk space recovered unless the
the move is to the same drive, or /Q option is used (see below).  It does
so by comparing the amount of free disk space before and after the MOVE
command is executed.  However, this amount may be incorrect if you are using
a deletion tracking system which retains deleted files for later recovery,
or if another program performs a file operation while the MOVE command is
executed.

When physically copying files, MOVE preserves the hidden, system, and
read-only attributes of the source files, and sets the archive attribute of
the destination files.  However, if the files can be renamed, and no
copying is required, then the file attributes are not changed.

Use caution with the /A: and /H switches (both of which can allow MOVE to
process hidden files) when you are physically moving files, and both the
source and destination directories contain file descriptions.  If the source
file specification matches the description file name (normally
DESCRIPT.ION), and you tell MOVE to process hidden files, the DESCRIPT.ION
file itself will be moved, overwriting any existing file descriptions in the
destination directory.  For example, if the C:\DATA directory contains
file descriptions, this command would overwrite any existing descriptions in
the D:\SAVE directory:

     c:\data> move /h d*.* d:\save\

If you remove the hidden attribute from the DESCRIPT.ION file the same
caution applies even if you do not use /A:, /H, or /K, as DESCRIPT.ION
is then treated like any other file.  You can use an 078exclusion range
to prevent the descriptions file from being moved:

     c:\data> move /[!%192_dname] /h d*.* d:\save\

Under Windows 95/98/ME, if you MOVE files with long filenames to a volume which
does not support them, 4DOS will store the destination files with their short,
FAT-compatible names.  You can view the short names before executing the
MOVE with the 612DIR /X command.

Use caution when using wildcards with MOVE under Windows 95/98/ME.  For
compatibility with COMMAND.COM, 4DOS's wildcard matching will match both
short and long filenames.  This can move files you did not expect.

See 081LFN File Searches for additional details on the last two items
above.

Options

!INDENT 5 5 0 5
     /A::  (Attribute select) Select only those files that have the
     specified attribute(s) set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      S  System
          H  Hidden         A  Archive

     If no attributes are listed at all (e.g., MOVE /A: *.* ...), MOVE
     will select all files including hidden and system files.  If attributes
     are combined, all the specified attributes must match for a file to be
     selected.  For example, /A:RHS will select only those files with all
     three attributes set.

     See the cautionary note under Advanced Features and Options above
     before using /A: when both source and destination directories contain
     file descriptions.
!INDENT 5 5 0 5

     /C:  (Changed files) Move files only if the destination file exists
     and is older than the source (see also /U).  This option is useful 
     for updating the files in one directory from those in another without 
     moving any newly-created files.  (Before using /C in a network 
     environment be sure to read the note under /U.)

     /D:  (Directory) Requires that the destination be a directory.  If the
     destination does not exist, MOVE will prompt to see if you
     want to create it.  If the destination exists as a file,
     MOVE will fail with an "Access denied" error.  Use this
     option to avoid having MOVE accidentally interpret your
     destination name as a file name when it's really a mistyped
     directory name.

     /E:  (No error messages) Suppress all non-fatal error messages, such
     as "File not found."  Fatal error messages, such as "Drive not ready,"
     will still be displayed.  This option is most useful in batch files and
     aliases.

     /F:  (Force delete) This option is only for use when running in an
     OS/2 DOS session.  It forces deletion of the source file without saving
     it to the DELDIR directory (if DELDIR is not in use, /F has no
     effect).  /F is only effective when MOVE must copy the source file(s)
     and delete the originals (i.e., if the destination is on a different
     drive or the destination file already exists).  If the files are simply
     renamed, /F has no effect.

     /G:  Displays the percent moved.  This is useful when moving large
     files across a network to ensure the move is proceeding.

     /H:  (Hidden) Move all files, including hidden and system files.  See
     the cautionary note under Advanced Features and Options above
     before using /H when both source and destination directories contain
     file descriptions.

     /I"text":  Select source files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /M:  (Modified files) Move only files that have the archive bit set.
     The archive bit will remain set after the MOVE; to clear it use
     596ATTRIB.

     /N:  (Nothing) Do everything except actually move the file(s).  This
     option is most useful for testing what a complex MOVE command will do.
     /N does NOT prevent creation of destination subdirectories when used
     with /S.

     /O:  Don't move the file(s) unless the target doesn't exist.

     /P:  (Prompt) Prompt the user to confirm each move.  Your options at
     the prompt are explained in detail under 045Page and File Prompts.

     /Q:  (Quiet) Don't display filenames, the total number of files moved,
     or the amount of disk space recovered, if any.  This option is
     most often used in batch files.  See also /T.

     /R:  (Replace) Prompt for a Y or N response before overwriting
     an existing destination file.  See also the 4DOS.INI 450CopyPrompt
     directive.

     /S:  (Subdirectories) Move an entire subdirectory tree to another
     location.  MOVE will attempt to create the destination directories if
     they don't exist, and will remove empty subdirectories after the
     move.  When /D is used with /S, you will be prompted if the first
     destination directory does not exist, but subdirectories below that will
     be created automatically by MOVE.  If MOVE /S creates one or more
     destination directories, they will be added automatically to the
     048extended directory search database.

!INDENT 5 5 5 5
     If you attempt to use /S to move a subdirectory tree into part of
     itself, MOVE will detect the resulting infinite loop, display an error
     message, and exit.

     Do not use /S with @file lists; see 057@file lists for details.

     Note that MOVE /S will not search into subdirectories with the hidden
     or system attributes set unless you also specify /A: or /H.
!INDENT 5 5 0 5

     /T:  (Total) Don't display filenames as they are moved, but display the
     total number of files moved and the amount of free disk space
     recovered, if any.

     /U:  (Update) Move each source file only if it is newer than a matching
     destination file or if a matching destination file does not
     exist (also see /C).  This option is useful for moving
     new or changed files from one directory to another.

!INDENT 5 5 5 5
     The time comparisons used with /U may not always work
     reliably across a network, due to differences in time zone and
     in the file time storage method between the local and remote
     systems.  Be sure to do some non-destructive testing (e.g. with
     /N) before depending on this option to yield the results you
     want in a network environment.
!INDENT 5 5 0 5

     /V:  (Verify) Verify each disk write.  This is the same as executing
     the VERIFY ON command, but is only active during the MOVE.  /V does not
     read back the file and compare its contents with what was written; it
     only verifies that the data written to disk is physically readable.

     /W:  (Wipe) If the MOVE is to a different drive, overwrite the old
     file with zeros before deleting it (like DEL /W).

     /Z:  (Overwrite) Overwrite read-only destination files.  Without
     this option, MOVE will fail with an "Access denied" error if the
     destination file has its read-only attribute set.
!INDENT 0

For comparison with the external DOS MOVE command refer to
the 65535external DOS help system.
;---------------------------------------------------------------------------
!TOPIC 647 ON
!TTY

Purpose:  Execute a command in a batch file when a specific condition
          occurs.

Format:   ON BREAK [command]
               or
          ON ERROR [command]
               or
          ON ERRORMSG [command]
!TTY

Usage

ON can only by used in batch files.

ON sets a "watchdog" that remains in effect for the duration of the current
batch file.  Whenever a BREAK or ERROR condition occurs after ON has been
executed, the corresponding command is automatically executed.

ON BREAK will execute the command if the user presses Ctrl-C or
Ctrl-Break.

ON ERROR and ON ERRORMSG will execute the command after any 4DOS or
operating system error (including 083critical errors).  That
is, they will detect errors such as a disk write error, and 4DOS errors
such as a COPY command that fails to copy any files, or the use of an
invalid command option.

ON ERROR executes the command immediately after the error occurs,
without displaying any 4DOS error message (operating system
errors may still be displayed in some cases).  ON ERRORMSG displays the
appropriate error message, then executes the command.  If both are
specified, ON ERROR will take precedence, and the ON ERRORMSG setting will be
ignored.  The remainder of this section discusses both settings together,
using the term ON ERROR[MSG].

ON BREAK and ON ERROR[MSG] are independent of each other.  You can use either
one, or both, in any batch file.

Each time ON BREAK or ON ERROR[MSG] is used, it defines a new command to be
executed for a break or error, and any old command is discarded.  If you
use ON BREAK or ON ERROR[MSG] with no following command, that type of error
handling is disabled.  Error handling is also automatically disabled when
the batch file exits.

ON BREAK and ON ERROR[MSG] only affect the current batch file.  If you CALL
another batch file, the first batch file's error handling is suspended, and
the CALLed file must define its own error handling.  When control returns
to the first batch file, its error handling is reactivated.

The command can be any command that can be used on a batch file line by
itself.  Frequently, it is a 630GOTO or 629GOSUB command.  For
example, the following fragment traps any user attempt to end the batch
file by pressing Ctrl-C or Ctrl-Break.  It scolds the user for
trying to end the batch file and then continues displaying the numbers:

     on break gosub gotabreak
     do i = 1 to 1000
       echo %i
     enddo
     quit
     :gotabreak
     echo Hey!  Stop that!!
     return

You can use a 085command group as the command if you want to execute
multiple commands, for example:

     on break (echo Oops, got a break!^quit)

ON BREAK and ON ERROR[MSG] always assume that you want to continue executing
the batch file.  After the command is executed, control automatically returns
to the next command in the batch file (the command after the one that was
interrupted by the break or error).  The only way to avoid continuing the
batch file after a break or error is for the command to transfer control to
another point with 630GOTO, end the batch file with 654QUIT or
600CANCEL, or start another batch file (without CALLing it).

When handling an error condition with ON ERROR[MSG], you may find it useful to
use 161internal variables, particularly %164_? and
%218_SYSERR, to help determine the cause of the error.

The ON ERROR[MSG] command will not be invoked if an error occurs
while reading or writing a redirected input file, output file, or pipe.

If a break or error occurs while the command specified in ON BREAK or
ON ERROR[MSG] is executing, the command will be restarted.  This means you
must use caution to avoid or handle any possible errors in the commands
invoked by ON ERROR[MSG], since such errors can cause an infinite loop
and/or a stack overflow condition.
;---------------------------------------------------------------------------
!TOPIC 648 OPTION
!TTY

Purpose:  Modify 4DOS configuration.

Format:   OPTION [//optname=value ...]

          optname:  An .INI file directive to set or modify.
          value:    A new value for that directive.
!TTY

See also:  356.INI File Directives and 018OPTION Reference.

Usage

If the OPTION command is used without any parameters, it displays a set of
dialogs which allows you to modify many of the configuration options stored
in the .INI file.

OPTION handles most standard .INI file settings.  More advanced settings,
including all those listed under 481Key Mapping Directives and
550Advanced Directives cannot be modified with the OPTION
dialogs.  These settings must be inserted or modified in the .INI
file manually.  For more details see 353Modifying the .INI File.

OPTION does not preserve comments when saving modified settings in the
.INI file.  To be sure .INI file comments are preserved, put them on
separate lines in the file.  See 353Modifying the .INI File for
additional details.

OPTION runs the external program OPTION.EXE to display the dialogs.  If 4DOS
cannot find OPTION.EXE it will display an error message.  OPTION.EXE must
be run with the OPTION command, and will not work if you invoke it directly.

For information about using the OPTION dialogs, see 018OPTION Reference.

Setting Individual Options

If you follow the OPTION command with one or more sequences of a double slash
mark [//] followed by an option=value setting, the OPTION
dialogs or notebook will not appear.  Instead, the new settings will take
effect immediately, and will be in effect for the current session only.  This
example turns off batch file echo and changes the input colors to bright cyan
on black (enter this all on one line):

     c:\> option //BatchEcho = No //InputColors = bri cya on bla

Option values may contain whitespace.  However, you cannot enter an option
value which contains the "//" string.

This feature is most useful for testing settings quickly, and in aliases or
batch files which depend on certain options being in effect.

If you are setting more than one directive, it is more efficient to combine
them into one OPTION command because 4DOS must load the external OPTION.EXE
program for each OPTION //... command.

Changes made with // are temporary.  They will not be saved in the
.INI file, even if you subsequently load the option dialogs and select Save.
;---------------------------------------------------------------------------
!TOPIC 649 PATH
!TTY

Purpose:  Display or alter the list of directories that 4DOS will
          search for executable files, batch files, and files with
          executable extensions that are not in the current directory.

Format:   PATH [directory[;directory...]]

          directory:  The full name of a directory to include in the
                      path setting.
!TTY

See also: 622ESET and 663SET.

Usage

When 4DOS is asked to execute an external command (a .COM, .EXE, .BTM,
or .BAT file or executable extension), it first looks for the file in
the current directory.  If it fails to find an executable file in the
current directory, it will search each of the directories specified in
the PATH setting.

For example, after the following PATH command, 4DOS will search for an
executable file in four directories:  the current directory, the root
directory on drive C, then the DOS subdirectory on C, and then the UTIL
subdirectory on C:

     c:\> path c:\;c:\dos;c:\util

The list of directories to search can be set or viewed with the PATH
command.  The list is stored as an environment string named 138PATH,
and can also be set or viewed with SET, and edited with ESET.

Directory names in the path must be separated by semicolons [;].  Each
directory name is shifted to upper case to maintain compatibility with
programs which can only recognize upper case directory names in the path.  If
you modify your path with the 663SET or 622ESET command, you
may include directory names in lower case.  These may cause trouble with
some programs, which assume that all path entries have been shifted to
upper case.

On drives which support long filenames, some directory names may include
spaces or other special characters.  Unlike other commands where quotes are
required, such names should not be quoted in the PATH.

If you enter PATH with no parameters, the current path is displayed.

Entering PATH and a semicolon clears the search path so that only the
current directory is searched for executable files (this is the default at
system startup).

Some applications also use the PATH to search for their data files.

4DOS normally searches the path for files with the extensions .COM, .EXE,
.BTM, and .BAT (in that order).  However, if you include an explicit
file extension on a command name (for example, WP.EXE), the search will
find files with that name and extension in the current directory and
every directory in the path.  It will not locate other executable files
with the same base name (e.g., WP.COM).

The standard list of extensions for which to search can be modified by
setting 477PathExt to Yes in 4DOS.INI, then setting the
143PATHEXT variable.

If you have an entry in the path which consists of a single period
[.], the current directory will not be searched first, but instead
will be searched when 4DOS reaches the "." in the path.  This allows
you to delay the search of the current directory for executable files and
files with executable extensions.  In rare cases, this feature may not be
compatible with applications which use the path to find their files; if you
experience a problem, you will have to remove the "." from the path while
using any such application.

In normal use, 4DOS can create a path as long as 506 characters (the
command-line limit is 511 characters, and "PATH " takes five).  However,
some DOS applications expect a path no longer than the traditional limit of
123 characters.  If you extend your path beyond this limit and experience
problems with application programs, see 848Compatibility.

To create a path longer than the command line length limit, use PATH
repeatedly to append additional directories to the path:

     path [first list of directories]
     path %path;[second list of directories]
     ...

You cannot use this method to extend the path beyond 506 characters (the
511-byte internal buffer limit, with room for "PATH ").  It is usually more
efficient to use aliases to load application programs than to create a long
PATH.  See 595ALIAS for details.

If you specify an invalid directory in the path, it will be skipped and the
search will continue with the next directory in the path.
;---------------------------------------------------------------------------
!TOPIC 650 PAUSE
!TTY

Purpose:  Suspend batch file or alias execution.

Format:   PAUSE [text]

          text:  The message to be displayed as a user prompt.
!TTY

Usage

A PAUSE command will suspend execution of a batch file or alias, giving you
the opportunity to change disks, turn on the printer, etc.

PAUSE waits for any key to be pressed and then continues execution.  You
can specify the text that PAUSE displays while it waits for a keystroke, or
let it use the default message:

     Press any key when ready...

If you press Ctrl-C or Ctrl-Break while PAUSE is waiting for a key,
execution of an alias will be terminated, and execution of a batch file
will be suspended while you are asked whether to cancel the batch job.  In
a batch file you can handle Ctrl-C and Ctrl-Break yourself with the
647ON BREAK command.
;---------------------------------------------------------------------------
!TOPIC 651 POPD
!TTY

Purpose:  Return to the disk drive and directory at the top of the
          directory stack.

Format:   POPD [*]
!TTY

See also: 614DIRS, 653PUSHD, and 047Directory Navigation.

Usage

Each time you use the PUSHD command, it saves the current disk drive and
directory on the internal directory stack.  POPD restores the last drive
and directory that was saved with PUSHD and removes that entry from the
stack.  You can use these commands together to change directories, perform
some work, and return to the starting drive and directory.

Directory changes made with POPD are recorded for display in the
040directory history window.  Directory changes made with POPD are
recorded in the directory history list and can be displayed in the directory
history window.

This example saves and changes the current disk drive and directory with
PUSHD, and then restores it.  The current directory is shown in the prompt:

     c:\> pushd d:\database\test
     d:\database\test> popd
     c:\>

You can use the DIRS command to see the complete list of saved drives and
directories (the directory stack).

The POPD command followed by an asterisk [*] clears the directory stack
without changing the current drive and directory.

If the directory on the top of the stack is not on the current drive,
POPD will switch to the drive and directory on the top of the stack without
changing the default directory on the current drive.
;---------------------------------------------------------------------------
!TOPIC 652 PROMPT
!TTY

Purpose:  Change the command-line prompt.

Format:   PROMPT [text]

          text:  Text to be used as the new command-line prompt.
!TTY

Usage

You can change and customize the command-line prompt at any time.  The
prompt can include normal text, and system information such as the current
drive and directory, the time and date, and the amount of memory
available.  You can create an informal "Hello, Bob!" prompt or an
official-looking prompt full of impressive information.

The prompt text can contain special character sequences in the form $?,
where ? is one of the characters listed below:

     a    The ampersand character [&].
     b    The vertical bar character [|].
     c    The open parenthesis [(].
     d    Current date, in the format:  Mon  6-19-00 (the month, day,
          and year are formatted according to your current country
          settings.
     D    Current date, in the format:  Mon  Jun 19, 2000.
     e    The ASCII ESC character (decimal 27).
     f    The close parenthesis [)].
     g    The > character.
     h    Backspace over the previous character.
     i    Display the OS/2 prompt header line, which reminds you of how
          to return to the OS/2 desktop, or get help.
     J    Date in ISO 8601 international format (yyyy-mm-dd).
     K    Date in ISO 8601 week date format (yyyy-Www-d).
     l    The < character.
     m    Time in hours and minutes using 24-hour format.
     M    Time in hours and minutes using the default country format and
          retaining "a" or "p", e.g. 4:07p.
     n    Current drive letter.
     p    Current drive and directory (lower case).
     P    Current drive and directory (upper case on drives which do
          not support long filenames; directory names shown in mixed case as
          stored on the disk on LFN drives.)
     q    The = character.
     r    The numeric exit code of the last external command.
     s    The space character.
     t    Current 24-hour time, in the format hh:mm:ss.
     T    Current 12-hour time, in the format hh:mm:ss[a|p].
     U    The current user (the value of the environment variable
          147LOGINNAME).
     v    Operating system version number, in the format 6.22.
     w    Current working directory in a shortened format (lower
          case).  If the current directory is the root or a first level
          subdirectory, it is displayed as-is.  If it is second level or
          deeper, the path is truncated in the display.
     W    Current working directory in a shortened format (upper case
          on drives which do not support long filenames; directory names
          shown in mixed case as stored on the disk on LFN drives.)
     xd:  Current directory on drive d:, in lower case, including drive
          letter.  (Uses the actual case of the directory name as stored on
          the disk for LFN drives.)
     Xd:  Current directory on drive d:, (including drive letter),
          in upper case.
     z    Current shell nesting level; the primary command processor is
          shell 0.
     +    Display one + character for each directory on the PUSHD directory
          stack.
     $    The $ character.
     _    CR/LF (go to beginning of a new line).

For example, to set the prompt to the current date and time, with a ">" at
the end:

     c:\> prompt $D $t $g
     Mon  Jun 19, 2000 10:29:19 >

You can include the PROMPT command in your 109AUTOEXEC.BAT file to
set the prompt whenever your system is rebooted, in 1094START, or in
any batch file that runs when 4DOS starts.

The default prompt is $n$g (drive name plus ">") on drives A and B, and
$p$g (current drive and directory plus ">") on all other drives.  If
you use 4DOS under OS/2, the SET PROMPT statement in the OS/2 CONFIG.SYS
file may override the default 4DOS prompt.  If it does, you will need to
delete this statement if you want to use the default 4DOS prompt.

If you enter PROMPT with no arguments, the prompt will be reset to its
default value.  The current setting of the PROMPT will be stored in an
environment variable named 139PROMPT.

If 4DOS is running in Windows 95/98/ME or under OS/2, PROMPT will look for
the environment variable 146TITLEPROMPT and use its contents to build a
prompt in the title bar.  Note that 4DOS is limited to a maximum of 79
characters in the title bar.

Along with literal text, special characters, and 915ANSI sequences, you
can include any 131environment variable, 161internal variable, or
241variable function in a prompt.  For example, if you want to display
the amount of free memory in the command prompt, plus the current drive and
directory, you could use this command:

     c:\> prompt (%%@dosmem[K]K) $p$g
     (601K) c:\data>

Notice that the @DOSMEM function is shown with two leading percent signs
[%].  If you used only one percent sign, the @DOSMEM function would be
expanded once when the PROMPT command was executed, instead of every time
the prompt is displayed.  As a result, the amount of memory would never
change from the value it had when you entered the PROMPT command.  You can
also use back-quotes to delay expanding the variable function until the
prompt is displayed:

     c:\> prompt `(%@dosmem[K]K) $p$g`

You can use this feature along with the 264@EXEC variable function
to create a complex prompt which not only displays information but executes
commands.  For example, to execute an alias which checks battery status each
time the prompt is displayed (enter the alias on one line):

     c:\> alias cbatt `if %_apmlife lt 30 beep 440 4 880 4 440 4 880 4`
     c:\> prompt `%@exec[@cbatt]$p$g`

If you have an 842ANSI driver installed you can include 915ANSI
escape sequences in the PROMPT text.  This example uses ANSI sequences to
set a prompt that displays the shell level, date, time and path in color on
the top line of the screen (enter the command on one line):

     c:\> prompt $e[s$e[1;1f$e[41;1;37m$e[K[$z] $d
          Time: $t$h$h$h  Path: $p$e[u$e[0;32m$n$g

You may find it helpful to define a different prompt in secondary shells,
perhaps including $z in the prompt to display the shell level.  To do so,
place a PROMPT command in your 1094START file and use 633IF or
634IFF statements to set the appropriate prompt for different shells.
;---------------------------------------------------------------------------
!TOPIC 653 PUSHD
!TTY

Purpose:  Save the current disk drive and directory, optionally changing
          to a new drive and directory.

Format:   PUSHD [path]

          path:  The name of the new default drive and directory.
!TTY

See also: 601CD, 602CDD, 614DIRS, 651POPD, and 047Directory Navigation.

Usage

PUSHD saves the current drive and directory on a "last in, first out"
directory stack.  The POPD command returns to the last drive and directory
that was saved by PUSHD.  You can use these commands together to change
directories, perform some work, and return to the starting drive and
directory.  The DIRS command displays the contents of the directory stack.

To save the current drive and directory, without changing directories, use
the PUSHD command by itself, with no path.

If a path is specified as part of the PUSHD command, the current drive
and directory are saved and PUSHD changes to the specified drive and
directory.  If the path includes a drive letter, PUSHD changes to the
specified directory on the new drive without changing the current directory
on the original drive.

This example saves the current directory and changes to C:\WORDP\MEMOS,
then returns to the original directory:

     c:\> pushd \wordp\memos
     c:\wordp\memos> popd
     c:\>

You should quote the path name if it contains whitespace or special
characters.  See 945File Names for additional details.

If PUSHD cannot change to the directory you have specified it will attempt to
search the 049CDPATH and the 048extended directory search
database.  You can also use 073wildcards in the path to
force an extended directory search.  See 047Directory Navigation
for complete details on these and other directory navigation features.

Directory changes made with PUSHD are also recorded in the
040directory history list and can be displayed in the directory history
window.

The directory stack can hold up to 511 characters, or between 20 and 40
entries (depending on the length of the names).  If you exceed this limit,
the oldest entry is removed before adding a new entry.
;---------------------------------------------------------------------------
!TOPIC 654 QUIT
!TTY

Purpose:  Terminate the current batch file.

Format:   QUIT [value]

          value:  The numeric exit code to return to 4DOS or to the
                  previous batch file.
!TTY

See also: 600CANCEL and 624EXIT.

Usage

QUIT provides a simple way to exit a batch file before reaching the end of
the file.  If you QUIT a batch file called from another batch file, you
will be returned to the previous file at the line following the original
CALL.

QUIT only ends the current batch file.  To end all batch file processing,
use the CANCEL command.

If you specify a value, QUIT will set the ERRORLEVEL or exit code to that
value.  For information on exit codes, see the 633IF command and the
%162? variable.

You can also use QUIT to terminate an alias.  If you QUIT an alias while
inside a batch file, QUIT will end both the alias and the batch file and
return you to the command prompt or to the calling batch file.
;---------------------------------------------------------------------------
!TOPIC 655 RD
!TTY

Purpose:  Remove one or more subdirectories.

Format:   RD [/I"text"] [@file] path...
               or
          RMDIR [/I"text"] [@file] path...

          path:  The name of one or more subdirectories to remove.

          @file: A text file containing the names of the directories to
                 remove, one per line (see 057@file lists for details).

          /I: (match descriptions)
!TTY

See also: 644MD.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Usage

RD and RMDIR are synonyms.  You can use either one.

RD removes directories from the directory tree.  For example, to remove the
subdirectory MEMOS from the subdirectory WP:

     c:\> rd \wp\memos

Before using RD, you must delete all files and subdirectories (and their
files) in the path you want to remove.  Remember to remove hidden and
read-only files as well as normal files (you can use DEL /Z to delete
hidden and read-only files).

You can use wildcards in the path.

You must quote any path which contains whitespace or special
characters.  See 945File Names for additional details.

If RD removes one or more directories, they will be deleted automatically
from the 048extended directory search database.

You cannot remove the root directory, the current directory (.), any
directory above the current directory in the directory tree, or any
directory in use by another process in a multitasking system.

Option

!INDENT 5 5 0 5
     /I"text":  Select directories by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 656 REBOOT
!TTY

Purpose:  Do a warm or cold system reboot or change the power state.

Format:   REBOOT [/C /M /P /S /V]

          /C(old reboot)              /S(uspend)
          /M(onitor off)              /V(erify)
          /P(ower off)
!TTY

Usage

REBOOT will completely restart your computer or change its power state.  It
normally performs a "warm" reboot, which is comparable to pressing
Ctrl-Alt-Del.  REBOOT can also perform a "cold" reboot, which is comparable
to turning the power off and back on or pressing the reset button.  Finally,
REBOOT can change the power state of systems equipped with APM.  A reboot is
necessary to activate any changes to your CONFIG.SYS file, and may also be
used if you wish to restart DOS with an altered 4START or AUTOEXEC.BAT file.
Turning the monitor off and / or entering system suspend state saves energy
and reduces the dissipated heat into the air.

REBOOT defaults to performing a "warm" boot, with no prompting.

Unless the /M or /S option is given, 4DOS executes the contents of your
1094EXIT file, if any, then flushes any SMARTDRV or compatible disk
caching program and the disk buffers, resets the drives, and waits two
seconds before rebooting or turning power off, to allow disk caching
programs to finish writing any cached data.

Some system BIOSes, memory managers, multitaskers, or memory-resident
programs (TSRs) may intercept attempts to reboot your system and defeat
them entirely, convert a cold boot request to a warm boot or vice versa, or
in very rare cases, hang the system -- requiring a reboot!  As a result you
may need to experiment with which reboot options work best for your system
hardware and software configuration, and under rare circumstances REBOOT
may not be usable on your system.

WARNING: Under Windows, REBOOT does not attempt to terminate any processes
so if a program does a disk write at the time of reboot or its work file has
not been saved, data loss may be possible!  Make sure that no other programs
are running before issuing this command under any multitasking environments.

Options

!INDENT 5 5 0 5
     /C:  (Cold) Do a "cold" reboot.  This is similar to turning the power
     off and back on, and may be necessary to properly initialize the system.

!INDENT 5 5 5 5
     REBOOT /C may not physically reset all hardware devices as
     thoroughly as actually turning off the power; its effect
     depends on the internal design of each hardware device and
     on your system configuration.

!INDENT 5 5 0 5
     /M:  (Monitor off) Shut off the display, if the system has a VESA
     BIOS and VESA Display Power Management Signalling is supported.  The
     monitor is turned back on when a typematic key is pressed.  Like /S,
     this option does not actually reboot.

!INDENT 5 5 5 5
     If the current video mode is not supported by the VESA BIOS, it may
     switch the display to a supported mode (usually a text mode) before
     it turns the monitor off.

!INDENT 5 5 0 5
     /P:  (Power off) Turn power off, if the system has APM version 1.1
     or newer, else reboot only if /C is also given, otherwise return an
     error code.  REBOOT /P will not work properly under OS/2.

!INDENT 5 5 0 5
     /S:  (Suspend) Enter suspend state, if the system has APM version
     1.1 or newer.  Suspend state ends when a key (even non-typematic) is
     pressed, or when the mouse or its wheel is moved, or a mouse button
     clicked on.  Like /M, this option does not actually reboot.

!INDENT 5 5 0 5
     /V:  (Verify) Prompt for confirmation (Y or N) before rebooting or
     changing the power state.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 657 REM
!TTY

Purpose:  Put a comment in a batch file.

Format:   REM [comment]

          comment:  The text to include in the batch file.
!TTY

Usage

The REM command lets you place a remark or comment in a batch file.  Batch
file comments are useful for documenting the purpose of a batch file and
the procedures you have used.  For example:

     rem  This batch file provides a menu-based utility system.
     rem  Clear the screen and get selection
     cls

REM must be followed by a space or tab character and then your
comment.  Comments can be up to 511 characters long.  4DOS will normally
ignore everything on the line after the REM command, including quote
characters, redirection symbols, and other commands.

If ECHO is ON, the comment is displayed.  Otherwise, it is ignored.  If ECHO
is ON and you don't want to display the line, preface the REM command with an
at sign [@].

You can also place a comment in a batch file by starting the comment line
with two colons [::].  In essence this creates a batch file "label"
without a valid label name.  Such comments are processed slightly faster than
those entered with REM, because they do not require 4DOS to
handle a command.

You can use REM to create a zero-byte file if you use a redirection symbol
after the REM command.  For example, to create the zero-byte file C:\FOO:

     c:\> rem > foo

(This capability is included for compatibility with COMMAND.COM.  A simpler
method for creating a zero-byte file with 4DOS is to use >filename as a
command, with no actual command before the [>] redirection character.)
;---------------------------------------------------------------------------
!TOPIC 658 REN
!TTY

Purpose:  Rename files or subdirectories.

Format:   REN [/A:[[+|-]rhsad] /E /I"text" /N /P /Q /S /T][@file]
          old_name... new_name
               or
          RENAME [/A:[[+|-]rhsad] /E /I"text" /N /P /Q /S /T][@file]
          old_name... new_name

          old_name:  Original name of the file(s) or subdirectory.
          new_name:  New name to use, or new path on the same drive.
          @file:     A text file containing the names of the source files
                     to rename, one per line (see 057@file lists for
                     details).

          /A: (Attribute select)      /P(rompt)
          /E (no error messages)      /Q(uiet)
          /I (match descriptions)     /S(ubdirectory)
          /N(othing)                  /T(otal)
!TTY

See also: 606COPY and 646MOVE.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Use wildcards with caution on LFN volumes; see 081LFN File Searches
for details.

Usage

REN and RENAME are synonyms.  You may use either one.

REN lets you change the name of a file or a subdirectory, or move one or
more files to a new subdirectory on the same drive.  (If you want to move
files to a different drive, use MOVE.)

In its simplest form, you give REN the old_name of an existing file or
subdirectory and then a new_name.  The new_name must not already exist --
you can't give two files the same name (unless they are in different
directories).  The first example renames the file MEMO.TXT to MEM.TXT.  The
second example changes the name of the \WORD directory to \WP:

     c:\> rename memo.txt mem.txt
     c:\> rename \word \wp

You must quote any file names which contain whitespace or special
characters.  See 945File Names for additional details.

You can also use REN to rename a group of files that you specify with
wildcards, as multiple files, or in an include list.  When you do, the
new_name must use one or more wildcards to show what part of each filename
to change.  Both of the next two examples change the extensions of multiple
files to .SAV:

     c:\> ren config.sys autoexec.bat 4start.btm *.sav
     c:\> ren *.txt *.sav

REN can move files to a different subdirectory on the same drive.  When it
is used for this purpose, REN requires one or more filenames for the
old_name and a directory name for the new_name:

     c:\> ren memo.txt \wp\memos\
     c:\> ren oct.dat nov.dat \data\save\

The final backslash in the last two examples is optional.  If you use it,
you force REN to recognize the last argument as the name of a directory,
not a file.  The advantage of this approach is that if you accidentally
mistype the directory name, REN will report an error instead of renaming
your files in a way that you didn't intend.

REN can also move files to a new directory and change their name at the
same time if you specify both a path and file name for new_name.  In this
example, the files are renamed with an extension of .SAV as they are moved
to a new directory:

     c:\> ren *.dat \data\save\*.sav

If you use REN to rename a directory, the new_name must normally be
specified explicitly, and cannot contain wildcards.  You can
override this restriction with /S.  When you rename a directory
the 048extended directory search database will be automatically
updated to reflect the change.

You can also rename a subdirectory to a new location on in the
directory tree on the same physical drive (sometimes called "prune
and graft").  This feature works under Windows 98/ME, but not under
DOS or Windows 95, which do not support it internally.  You must
specify the new name explicitly, not just give the path.  For
example, if the D:\4DOS directory contains a subdirectory TEST, you
can rename TEST to be a subdirectory of the root directory like
this:

     d:\4dos> ren TEST \TEST\

REN does not change a file's attributes.  The new_name file(s) will have
the same attributes as old_name.

Options

!INDENT 5 5 0 5
     /A::  (Attribute select) Rename only those files that have the
     specified attribute(s) set.  The colon [:] after /A is required.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed at all (e.g., REN /A: ...), REN will
     rename all matching files (and subdirectories, if /S is specified or
     wildcards are not used), including those with the hidden or system
     attributes.  If attributes are combined, all the specified attributes
     must match for a file to be selected.  For example, /A:RHS will select
     only those files with all three attributes set.
!INDENT 5 5 0 5

     /E:  (No error messages) Suppress all non-fatal error messages,
     such as "File not found."  Fatal error messages, such as "Drive not
     ready," will still be displayed.  This option is most useful in batch
     files.

     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /N:  (Nothing) Do everything except actually rename the file(s).  This
     option is useful for testing what a REN command will
     actually do.

     /P:  (Prompt) Prompt the user to confirm each rename operation.  Your
     options at the prompt are explained in detail under 045Page and File
     Prompts.

     /Q:  (Quiet) Don't display filenames  or the number of files renamed.
     This option is most often used in batch files.  See also /T.

     /S:  (Subdirectory) Normally, you can rename a subdirectory only if
     you do not use any wildcards in the new_name.  This prevents
     subdirectories from being renamed inadvertently when a group
     of files is being renamed with wildcards.  /S will let
     you rename a subdirectory even when you use wildcards.  /S does not
     cause REN to process files in the current directory and all
     subdirectories as it does in some other file processing commands.  To
     rename files throughout a directory tree, use a 628GLOBAL REN.

     /T:  (Total) Don't display filenames as they are renamed, but report
     the number of files renamed.  See also /Q.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 659 RETURN
!TTY

Purpose:  Return from a GOSUB (subroutine) in a batch file.

Format:   RETURN [value]

          value:  The exit code (0 to 255) to return to 4DOS or to
                  the previous batch file.
!TTY

See also: 629GOSUB.

Usage

4DOS allows subroutines in batch files.

A subroutine begins with a label (a colon followed by a word) and ends with
a RETURN command.

The subroutine is invoked with a GOSUB command from another part of the
batch file.  When a RETURN command is encountered the subroutine
terminates, and execution of the batch file continues on the line following
the original GOSUB.  If RETURN is encountered without a GOSUB, 4DOS will
display a "Missing GOSUB" error.

You cannot execute a RETURN from inside a 615DO loop.

The following batch file fragment calls a subroutine which displays the
files in the current directory:

     echo Calling a subroutine
     gosub subr1
     echo Returned from the subroutine
     quit

     :subr1
     dir /a/w
     return

If you specify a value, RETURN will set the internal exit code to that
value.  The exit code should be tested immediately upon return from the
subroutine and before it is reset by another command.  For information on
exit codes from internal commands, see the 164_? variable.
;---------------------------------------------------------------------------
!TOPIC 660 SCREEN
!TTY

Purpose:  Position the cursor on the screen and optionally display a
          message.

Format:   SCREEN row column [text]

          row:     The new row location for the cursor.
          column:  The new column location for the cursor.
          text:    Optional text to display at the new cursor location.
!TTY

See also: 619ECHO, 661SCRPUT, 671TEXT, and 684VSCRPUT.

Usage

SCREEN allows you to create attractive screen displays in batch files.  You
use it to specify where a message will appear on the screen.  You can use
SCREEN to create menus and other similar displays.  For example, the
following batch file fragment displays part of a menu:

     @echo off ^ cls
     screen 3 10  Select a number from 1 to 4:
     screen 6 20  1 - Word Processing
     screen 7 20  2 - Spreadsheet
     ...

SCREEN does not change the screen colors.   To display text in specific
colors, use SCRPUT or VSCRPUT.  SCREEN always leaves the cursor at the end
of the displayed text.

The row and column values are zero-based, so on a standard 25 line by 80
column display, valid rows are 0 - 24 and valid columns are 0 - 79.  You
can also specify the row and column as offsets from the current cursor
position.  Begin the value with a plus sign [+] to move the cursor down
the specified number of rows or to the right the specified number of
columns, or with a minus sign [-] to move the cursor up or to the
left.  This example prints a string 3 lines above the current position, in
absolute column 10:

     screen -3 10 Hello, World!

If you specify 999 for the row, SCREEN will center the text
vertically on the display.  If you specify 999 for the column,
SCREEN will center the text horizontally.  This example prints a message at
the center of the display:

     screen 999 999 Hello, World

SCREEN checks for a valid row and column, and displays a "Usage" error
message if either value is out of range.
;---------------------------------------------------------------------------
!TOPIC 661 SCRPUT
!TTY

Purpose:  Position text on the screen and display it in color.

Format:   SCRPUT row col [BRIght] [BLInk] fg ON [BRIght] bg text

          row:   Starting row
          col:   Starting column
          fg:    Foreground character color
          bg:    Background character color
          text:  The text to display
!TTY

See also: 619ECHO, 660SCREEN, 671TEXT, and 684VSCRPUT.

Usage

SCRPUT allows you to create attractive screen displays in batch files.  You
use it to specify where a message will appear on the screen and what colors
will be used to display the message text.  You can use SCRPUT to create
menu displays, logos, etc.

SCRPUT works like SCREEN, but requires you to specify the display
colors.  See 892Colors and Color Names for details about colors and notes
on the use of bright background colors.

The row and column values are zero-based, so on a standard 25 line by 80
column display, valid rows are 0 - 24 and valid columns are 0 - 79.  SCRPUT
checks for a valid row and column, and displays a "Usage" error message if
either value is out of range.

You can also specify the row and column as offsets from the current cursor
position.  Begin the value with a plus sign [+] to move down the specified
number of rows or to the right the specified number of columns, or with a
minus sign [-] to move up or to the left.

If you specify 999 for the row, SCRPUT will center the text vertically.  If
you specify 999 for the column, SCRPUT will center the text horizontally.

SCRPUT normally does not move the cursor when it displays the text.  However,
if you have set 572OutputBIOS to Yes in 4DOS.INI, SCRPUT will leave the
cursor at the end of the displayed text.

The following batch file fragment displays part of a menu, in color:

     cls white on blue
     scrput 3 10 bri whi on blu Select an option:
     scrput 6 20 bri red on blu 1 - Word Processing
     scrput 7 20 bri yel on blu 2 - Spreadsheet
     ...

If you have an unusual display adapter which does not support the direct
video output used by SCRPUT, see the 572OutputBIOS directive.
;---------------------------------------------------------------------------
!TOPIC 662 SELECT
!TTY

Purpose:  Interactively select files for a command.

Format:   SELECT [/1 /A[[:][+|-]rhsad] /C[HP] /D /E /H /I"text" /J /L
          /O[[:][-]acdeginrsu] /T:acw /X /Z] [command] ... (files...)...

          command:  The command to execute with the selected files.
          files:    The files from which to select.  File names may be
                    enclosed in either parentheses or square brackets.
                    The difference is explained in the usage text.

          /1 (one selection)          /J(ustify names)
          /A: (Attribute select)      /L(ower case)
          /C[HP] (Compression)        /O(rder)
          /D(isable color)            /T(ime)
          /E (use upper case)         /X (display short names)
          /H(ide dots)                /Z (use FAT format)
          /I (match descriptions)
!TTY

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.  Ranges must appear immediately
after the SELECT keyword.

Use wildcards with caution on LFN volumes; see 081LFN File Searches for
details.

Usage

SELECT allows you to select files for internal and external commands by
using a full-screen "point and shoot" display.  You can have SELECT execute
a command once for each file you select, or have it create a list of files
for a command to work with.  The command can be an internal command, an
alias, an external command, or a batch file.

If you use parentheses around the files, SELECT executes the command once
for each file you have selected.  During each execution, one of the
selected files is passed to the command as an argument.  If you use square
brackets around files, the SELECTed files are combined into a single list,
separated by spaces.  The command is then executed once with the entire
list presented part of its command-line arguments.

Using the SELECT File List

When you execute the SELECT command, the file list is displayed in a
full-screen format which includes a top-line status bar and shows the
command to be executed, the number of files marked, and the number of Kbytes
in those files.

SELECT supports the mouse for selecting and scrolling the list.  You can also
use uses the cursor up, cursor down, PgUp, and PgDn keys to scroll through
the file list.  You can also use character matching to find specific
files, just as you can in any 894popup window.  While the file list is
displayed you can enter any of the following keys to select or unselect
files, display files, execute the command, or exit:

!INDENT 5 5 5 5
     + or space:  Select a file, or unselect a marked file.

     -:  Unselect a marked file.

     *:  Reverse all of the current marks (except those on
     subdirectories).  If no files have been marked you can use * to mark
     all of the files.

     /:  Unselect all files.

     Ctrl-L:  View the current highlighted file with 640LIST.  When
     you exit from LIST, the SELECT screen will be restored.

     Enter:  Execute the command with the marked files, or with the
     currently highlighted file if no files have been marked.

     Esc:  Skip the files in the current display and go on to the next
     file specification inside the parentheses or brackets (if any).

     Ctrl-C or Ctrl-Break:  Cancel the current SELECT command entirely.
!INDENT 0

On FAT drives the file list is shown in standard FAT directory format, with
names at the left an descriptions at the right.  On LFN drives the format is
similar but more space is allowed for the name, and the description is not
shown.  In this format long names are truncated if they do not fit in the
allowable space.  For a short-name format (including descriptions) on long
filename drives, use the /X and / or /Z switches.

When displaying descriptions in the short filename format, SELECT adds a
right arrow [] at the end of the line if the description is too
long to fit on the screen.  This symbol will alert you to the existence of
additional description text.  You can use the left and right arrow keys to
scroll the description area of the screen horizontally and view the
additional text.

You can display the filenames in color by using the 663SET command to
create an environment variable called 133COLORDIR, or using the
Commands page of the 648OPTION dialogs or a text editor to set the
463ColorDir directive in your .INI file.  If you do not use the COLORDIR
variable or the ColorDir directive, SELECT will use the default screen
colors for all files.  See the discussion of color-coded directories under
612DIR for more details.  To disable directory color coding within
SELECT, use the /D option.

You can set the default colors used by SELECT on the Commands page of the
OPTION dialogs or with the 469SelectColors and 470SelectStatBarColors
directives in the .INI file.  If SelectColors is not used, the SELECT
display will use the current default colors.  If SelectStatBarColors is not
used, the status bar will use the reverse of the SELECT colors.

Creating SELECT Commands

In the simplest form of SELECT, you merely specify the command and then the
list of files from which you will make your selection(s).  For example:

     c:\> select copy (*.com *.exe) a:\

will let you select from among the .COM files on the current
drive, and will then invoke the COPY command to copy each file you select
to drive A:.  After the .COM files are done, the operations will be repeated
for the .EXE files.

If you want to select from a list of all the .COM and .EXE files mixed
together, create an 080include list inside the parentheses by
inserting a semicolon:

     c:\> select copy (*.com;*.exe) a:\

Finally, if you want the SELECT command to send a single list of files to
COPY, instead of invoking COPY once for each file you select, put the file
names in square brackets instead of parentheses:

     c:\> select copy [*.com;*.exe] a:\

If you use brackets, you have to be sure that the resulting command (the
word COPY, the list of files, and the destination drive in this example) does
not exceed the command line length limit:  511 characters for internal
commands or 126 characters for external commands.  The current line length is
displayed by SELECT while you are marking files to help you to conform to
these limits.

The parentheses or brackets enclosing the file name(s) can appear anywhere
within the command; SELECT assumes that the first set of parentheses or
brackets it finds is the one containing the list of files from which you
wish to make your selection.

You must quote any file names inside the parentheses which contain
whitespace or special characters.  See 945File Names for additional
details.  For example, to copy selected files from the "Program Files"
directory to the E:\SAVE directory:

     c:\> select copy ("Program Files\*.*") e:\save\

File names passed to the command will be quoted automatically if
they contain whitespace or special characters.

The list of files from which you wish to select can be further refined by
using 074date, time, size, and 078file exclusion ranges.  The range(s)
must be placed immediately after the word SELECT.  If the command is an
internal command that supports ranges, an independent range can also be used
in the command itself.

You cannot use command grouping to make SELECT execute several commands,
because SELECT will assume that the parentheses are marking the list of files
from which to select, and will display an error message or give incorrect
results if you try to use parentheses for command grouping instead.  (You
can use a SELECT command inside command grouping parentheses, you just
can't use command grouping to specify a group of commands for SELECT to
execute.)

Advanced Topics

If you don't specify a command, the selected filename(s) will become the
command.  For example, this command defines an alias called UTILS that
selects from the executable files in the directory C:\UTIL, and then
executes them in the order marked:

     c:\> alias utils select (c:\util\*.com;*.exe;*.btm;*.bat)

If you want to use 035filename completion to enter the filenames
inside the parentheses, type a space after the opening
parenthesis.  Otherwise, the command-line editor will treat the open
parenthesis as the first character of the filename.

When displaying descriptions, SELECT adds a right arrow [] at the end of
the line if the description is too long to fit on the screen. This symbol
will alert you to the existence of additional description text.  You can
use the left and right arrow keys to scroll the screen horizontally and view
the additional text.

With the /I option, you can select files based on their
descriptions.  SELECT will display files if their description matches the
text after the /I switch.  The search is not case sensitive.  You can
use wildcards and extended wildcards as part of the text.

When sorting file names and extensions for the SELECT display, 4DOS
normally assumes that sequences of digits should be sorted numerically (for
example, the file DRAW2 would come before DRAW03 because 2 is numerically
smaller than 03), rather than strictly alphabetically (where DRAW2 would
come second because "2" comes after "0").  You can defeat this behavior and
force a strict alphabetic sort with the /O:a option.

SELECT normally writes text directly to the screen.  If you have an unusual
display adapter which does not support direct video output, see the
572OutputBIOS directive.

If you receive a stack overflow error when using SELECT in complex,
nested command sequences, see the notes under the 574StackSize
directive.

Options

!INDENT 5 5 0 5
     /1:  (1 selection) Limits selection to a single file.

     /A:  (Attribute select) Display only those files that have the
     specified attribute(s) set.  The colon [:] after /A is optional.

!INDENT 5 5 5 5
     Preceding an attribute letter with a hyphen [-] will select
     files that do not have that attribute set.  You can OR attributes
     by preceding each attribute letter with a plus sign [+].

     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed at all (e.g., SELECT /A ...),
     SELECT will display all files and subdirectories
     including hidden and system files.  If attributes are
     combined, all the specified attributes must match for a file
     to be included in the listing.  For example, /A:RHS will
     display only those files with all three attributes set.

!INDENT 5 5 0 5
     /C:  (Compression) Display per-file and total compression ratios
     on compressed drives.  The compression ratio is displayed instead
     of the file description.  The ratio is left blank for directories
     and files with a length of 0 bytes, and for files on non-compressed
     drives.  The compression ratios will not be visible on LFN drives
     unless you use /Z to switch to the traditional short filename
     format.

!INDENT 5 5 5 5
     Only the compression programs distributed with MS-DOS and
     Windows 95/98/ME (DRVSPACE and DBLSPACE) are supported.

     Using /CH displays compression ratios like /C, but
     bases the calculation on the host drive's cluster size.  This
     gives a more accurate picture of the space saved
     through compression than is given by /C.

     If /CP is used instead of /C, the compression is
     displayed as a percentage instead of a ratio.  If /CHP
     is used instead of /CH, the host compression is
     displayed as a percentage.  The /CHP option must be
     entered as shown; you can not use /CPH.

     See the 612DIR /C documentation for more details on how compression
     ratios are calculated.

!INDENT 5 5 0 5
     /D:  (Disable color coding) Temporarily turn off directory color
     coding within SELECT.

     /E:  (Use upper case) Display filenames in the upper
     case; also see 664SETDOS /U and the 446UpperCase
     directive in 4DOS.INI.

     /H:  (Hide dots) Suppress the display of the "." and ".." directories.

     /I"text":  Display filenames by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /J:  (Justify names) Justify (align) filename extensions and display
     them in the traditional format.

     /L:  (Lower case) Display file and directory names in lower case;
     also see 664SETDOS /U and the 446UpperCase directive in 4DOS.INI.

     /O:  (Order) Set the sort order for the files.  The order can be any
     combination of the following options:

!INDENT 5 5 5 5
          -  Reverse the sort order for the next option.
          a  Sort names and extensions in standard ASCII order, rather
             than sorting numerically when digits are included in the
             name or extension.
          c  Sort by compression ratio (the least compressed file in
             the list will be displayed first).  If /O:c is used with
             /CH or /CHP, the sort will be based on the host-drive
             compression ratios.  For information on supported
             compression systems, see /C above.
          d  Sort by date and time (oldest first).
          e  Sort by extension.
          g  Group subdirectories first, then files.
          i  Sort by the file description (ignored if /C or /O:c is
             also used).
          n  Sort by filename (this is the default).
          r  Reverse the sort order for all options.
          s  Sort by size.
          u  Unsorted.

!INDENT 5 5 0 5
     /T:acw:  (Time display) Specify which of the date and time fields on
     an LFN drive should be displayed and used for sorting:

!INDENT 5 5 5 5
          a  last access date and time (access time is not saved
             on LFN volumes).
          c  creation date and time.
          w  last write date and time (this is the default).

!INDENT 5 5 0 5
     /X:  (Display short names):  Display short filenames, in the
     traditional FAT format (like /Z), on LFN drives

     /Z:  (Use FAT format) Display filenames on an LFN drive in the
     traditional FAT format, with the short filename at the left and the
     description at the right.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 663 SET
!TTY

Purpose:  Display, create, modify, or delete environment variables.

Format:   SET [/A /E /M /P /R file...] [name[=][value]]

          file:   One or more files containing variable definitions.
          name:   The name of the environment variable to define or modify.
          value:  The new value for the variable.

          /A(rithmetic)               /P(ause)
          /E(nvironment)              /R(ead from file)
          /M(aster)
!TTY

See also: 622ESET and 680UNSET.

Usage

Every program and command inherits an 131environment, which is a list
of variable names, each of which is followed by an equal sign and some
text.  Many programs use entries in the environment to modify their own
actions.

If you simply type the SET command with no options or arguments, it will
display all the names and values currently stored in the
environment.  Typically, you will see an entry called 134COMSPEC, an entry
called 138PATH, an entry called CMDLINE, and whatever other environment
variables you and your programs have established:

     c:\> set
     COMSPEC=C:\4DOS.COM
     PATH=C:\;C:\DOS;C:\UTIL
     CMDLINE=E:\UTIL\MAPMEM.EXE

To add a variable to the environment, type SET, a space, the variable name,
an equal sign, and the text:

     c:\> set mine=c:\finance\myfiles

The variable name is converted to upper case by 4DOS.  The text after the
equal sign will be left just as you entered it.  If the variable already
exists, its value will be replaced with the new text that you entered.

Normally you should not put a space on either side of the equal sign.  A
space before the equal sign will become part of the name; a space after the
equal sign will become part of the value.

If you use SET to create a variable with the same name as one of the
4DOS 161internal variables, you will disable the internal variable.  If
you later execute a batch file or alias that depends on that internal
variable, it may not operate correctly.

To display the contents of a variable, type SET plus the variable name:

     c:\> set mine

If the name contains one or more 073wildcards, SET will display all
matching environment variables.

You can edit environment variables with the 622ESET command.  To remove
variables from the environment, use 680UNSET, or type SET plus a
variable name and an equal sign:

     c:\> set mine=

The variable name is limited to a maximum of 80 characters, and the name
and value together cannot be longer than 511 characters.

Unless you use /M, SET only affects the environment of the current
command processor and the programs it executes.  If you EXIT to a parent
command processor, the original environment will be unchanged.

The size of the environment can be specified on the Startup page of the
648OPTION dialogs, with the 377Environment and 378EnvFree
directives in 4DOS.INI, or with the /E: 352startup option.

Options

!INDENT 5 5 0 5
     /A:  (Arithmetic) Evaluate the value as an arithmetic expression;
     store the result in the specified variable and display it to standard
     output.  SET /A supports the same operators as the 263@EVAL
     function.

!INDENT 5 5 5 5
     Warnings:  SET /A was never an officially documented or sanctioned
     option.  Use it at your own risk.  While this feature was apparently
     introduced to provide some compatibility with Microsoft's CMD.EXE,
     be aware that 4DOS's SET /A differs from CMD's in features and
     syntax.  Using SET /A in batch files to be run by either shell will
     require careful study:  use only those operators supported by both;
     remember to space around all operators; 131variables in the
     expression require both leading and trailing percent signs; use
     118double quotes around the expression if it contains troublesome
     characters like the 041caret, ampersand or 052vertical bar.

     Unless you need it for CMD.EXE compatibility, the documented 263@EVAL
     function should be used instead of SET /A.

!INDENT 5 5 0 5
     /E:  (Environment) When used together with /M, set both the master and
     local environments.  Note: SET /E /M does not propagate to any other
     environment instances.  For example, if you do it in a 4th level 4DOS,
     the top level (master) and the current (local) environments are modified,
     but the level 2 and level 3 environments are not.

     /M:  (Master) Display or modify the master environment rather than
     the local environment.  This option is only useful in secondary
     shells.

     /P:  (Pause) Wait for a key to be pressed after each screen page before
     continuing the display.  Your options at the prompt are
     explained in detail under 045Page and File Prompts.

     /R:  (Read) Read environment variables from a file.  This is much
     faster than loading variables from a batch file with
     multiple SET commands.  Each entry in the file must fit
     within the 511-byte command line length limit for 4DOS.  The
     file is in the same format as the SET display (i.e., name=value), so
     SET /R can accept as input a file generated by redirecting SET
     output. For example, the following commands will save the
     environment variables to a file, and then reload them from
     that file:

!INDENT 5 5 5 5
          set > varlist
          set /r varlist

     You can load variables from multiple files by listing the
     filenames individually after the /R.  You can add
     comments to a variable file by starting the comment line
     with a colon [:].

     If you are creating a SET /R file by hand, and need to
     create an entry that spans multiple lines in the file, you
     can do so by terminating each line, except the last, with an
     086escape character.  However, you cannot use this
     method to exceed the command line length limit.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 664 SETDOS
!TTY

Purpose:  Display or set the 4DOS configuration.

Format:   SETDOS [/A? /B? /C? /D? /E? /Fn.n /G?? /I+|- command /L? /M? /N?
          /P? /R? /S?:? /U? /V? /X[+|-]n /Y?]

          /A(NSI)                     /N(o clobber)
          /B(right background)        /P(arameter character)
          /C(ompound)                 /R(ows)
          /D(escriptions)             /S(hape of cursor)
          /E(scape character)         /U(pper case)
          /F(ormat for @EVAL)         /V(erbose)
          /G (numeric separators)     /W (switch character)
          /I(nternal commands)        /X (expansion, special characters)
          /L(ine)                     /Y (debug batch files)
          /M(ode for editing)
!TTY

Usage

SETDOS allows you to customize certain aspects of 4DOS to suit your
personal tastes or the configuration of your system.  Each of these options
is described below.

You can display the value of all SETDOS options by entering the SETDOS
command with no parameters.

Most of the SETDOS options can be initialized when 4DOS executes the
410configuration directives in 4DOS.INI, and can also be set with on
the Command Line, Windows, Options 1, or Options 2 pages of the
648OPTION dialogs.  The name of the corresponding directive is listed
with each option below; if none is listed, that option cannot be set with
OPTION or from 4DOS.INI.  You can also define the SETDOS options in your
AUTOEXEC.BAT, 4START, or other startup file (see 109Automatic Batch
Files), in aliases, or at the command line.

Secondary shells automatically inherit most configuration settings
currently in effect in the previous shell.  If values have been changed by
SETDOS since 4DOS started, the new values will be passed to the secondary
shell.

SETDOS /I settings are not inherited by secondary shells.  If you want to
use SETDOS /I- to disable commands in all shells, place the SETDOS
command(s) in your 4START file, which is executed when any shell starts.

Options

!INDENT 5 5 0 5
     /A:  (ANSI) This option determines whether 4DOS will attempt to
     use ANSI escape sequences for the 604CLS and
     605COLOR commands.  4DOS normally determines this
     itself, but if you are using a non-standard ANSI driver or
     your loading sequence is unusual, you may need to explicitly
     inform 4DOS.  /A0 allows 4DOS to determine automatically
     whether an ANSI driver is installed (the default).  /A1
     forces 4DOS to assume an ANSI driver is installed.  /A2
     forces 4DOS to assume an ANSI driver is not installed.  See
     842ANSI Drivers for more information on ANSI drivers.  Also
     see the 412ANSI directive.

     /B:  (Bright background) This option determines whether 4DOS
     configures your video adapter for blinking text (/B0,
     the default) or bright background colors (/B1), or leave the video
     bright / blink configuration unchanged (/B2).  See 892Colors and
     Color Names for a detailed discussion of this option.  Also see the
     461BrightBG directive.

     /C:  (Compound character) This option sets the character used
     for separating 041multiple commands on the same line.  The
     default is the caret [^].  You cannot use any of the redirection
     characters [<>|], or the blank, tab, comma, or equal sign as the
     command separator.  The command separator is saved by 665SETLOCAL
     and restored by 621ENDLOCAL.  This example changes the separator to
     a tilde [~]:

!INDENT 5 5 5 5
          c:\> setdos /c~

     (You can specify either the character itself, or its ASCII code as a
     decimal number, or a hexadecimal number preceded by 0x.)  If you want
     to share batch files or aliases between 4DOS and 0204NT or 021Take
     Command, see the 166%+ variable, which retrieves the current command
     separator, and 054Special Character Compatibility for details on using
     compatible command separators for all the products you use.  Also see the
     418CommandSep directive.

!INDENT 5 5 0 5
     /D:  (Descriptions) This option controls whether file
     processing commands like 606COPY, 609DEL,
     646MOVE, and 658REN process file descriptions
     along with the files they belong to.  /D1 turns
     description processing on, which is the default.  /D0
     turns description processing off.  Also see the
     424Descriptions directive.

!INDENT 5 5 5 5
     You can also use /D to set the name of the hidden file in each
     directory that contains file descriptions.  To do so, follow
     /D with the filename in quotes:

          c:\> setdos /d"files.bbs"

     Use this option with caution because changing the name from the
     default will make it difficult to transfer file descriptions to another
     system.  This option is provided for bulletin board system
     operators and others who have special needs.

     Also see the 423DescriptionName directive.

!INDENT 5 5 0 5
     /E:  (Escape character) This option sets the character used to
     suppress the normal meaning of the following character.  Any
     character following the 086escape character will be
     passed unmodified to the command.  The default escape
     character is Ctrl-X (ASCII 24, which appears on screen as an
     up-arrow []).  (You can specify either the character itself, or
     its ASCII code as a decimal number, or a hexadecimal number preceded by
     0x.)  You cannot use any of the redirection characters [<>|] or the
     blank, tab, comma, or equal sign as the escape character.  The escape
     character is saved by 665SETLOCAL and restored by 621ENDLOCAL.
     Certain characters (b, c, e, f, k, n, q, r, s, and t)
     have special meanings when immediately preceded by the
     escape character.

!INDENT 5 5 5 5
     If you want to share batch files or aliases between 4DOS and
     4OS2, 0204NT, or Take Command, see the 165%= variable,
     which retrieves the current escape character, and 054Special
     Character Compatibility for details on using compatible escape
     characters for all the products you use.  Also see the 426EscapeChar
     directive.

!INDENT 5 5 0 5
     /F:  (Format for @EVAL) This option lets
     you set default decimal precision for the @EVAL variable function. The
     maximum precision is 20 digits to the left of the decimal point and up
     to 10 digits to the right of the decimal point.  Also see the
     427EvalMax and 428EvalMin directives.

!INDENT 5 5 5 5
     The general form of this option is /Fx.y, where the x value
     sets the minimum number of digits to the right of the decimal
     point and the y value sets the maximum number of digits.  You
     can use =x,y instead of =x.y if the comma is your decimal
     separator.  Both values can range from 0 to 10.  You can
     specify either or both values:  /F2.5, /F2, and /F.5 are
     all valid entries.  If x is greater than y, it is ignored; if
     only x is specified, y is set to the same value (e.g. /F2 is
     equivalent to /F2.2).  See the 263@EVAL function if you
     want to set the precision for a single computation.

!INDENT 5 5 0 5
     /G:  (Numeric separators) This option sets the decimal and thousands
     separator characters.  The format is /Gxy where "x" is the new
     decimal separator and "y" is the
     new thousands separator.  Both characters must be included.  The only
     valid settings are /G., (period is the decimal separator,
     comma is the thousands separator); /G,. (the reverse); or
     /G0 to remove any custom setting and use the default
     separators associated with your current country code (this is the
     default).

!INDENT 5 5 5 5
     The decimal separator is used for 263@EVAL, numeric 633IF and
     634IFF tests, version numbers, and other similar uses.  The
     thousands separator is used for numeric output, and is skipped when
     performing calculations in @EVAL.  Also see the 421DecimalChar and
     445ThousandsChar directives.
!INDENT 5 5 0 5

     /I:  (Internal) This option allows you to disable or enable
     internal commands.  To disable a command, precede the
     command name with a minus [-].  To re-enable a command,
     precede it with a plus [+].  For example, to disable the
     internal LIST command to force 4DOS to use an external
     command:

!INDENT 5 5 5 5
          c:\> setdos /i-list

     To re-enable all disabled commands use /I*.

!INDENT 5 5 0 5
     /L:  (Line) This option controls how 4DOS gets its input from
     the command line.  /L0 tells 4DOS to use character input
     (the default).  /L1 tells it to use line input (like
     COMMAND.COM and CMD.EXE).  /L1 will disable command-line
     editing, history recall, filename completion, and the
     directory history window.  It should only be used if it is
     needed for compatibility with a specific program.  If you
     have a program that requires line input, you can use the
     following line in an alias or batch file to change the line
     input option just for that single program:

!INDENT 5 5 5 5
          setdos /L1 ^ program %& ^ setdos /L0

     See 751Compatibility for information on programs which require
     this option.  Also see the 436LineInput directive.

!INDENT 5 5 0 5
     /M:  (Mode) This option controls the initial line editing mode.  To
     start in overstrike mode at the beginning of each command line, use
     /M0 (the default).  To start in insert mode, use /M1.  If any
     other digit is used, 4DOS will not force either editing mode when the
     prompt is displayed; the editing mode last used will be retained.  Also
     see the 425EditMode directive.

     /N:  (No clobber) This option controls output
     051redirection.  /N0 means existing files will be
     overwritten by output redirection (with >) and that
     appending (with >>) does not require the file to exist
     already.  This is the default.  /N1 means existing files
     may not be overwritten by output redirection, and that when
     appending the output file must exist.  A /N1 setting can
     be overridden with the [!] character.  If you use
     /N1, you may have problems with a few unusual programs
     that shell out to run a command with redirection, and expect
     to be able to overwrite an existing file.  Also see the
     438NoClobber directive and the table of all 055output redirection
     operators.

     /P:  (Parameter character) This option sets the character used
     after a percent sign to specify all or all remaining
     command-line arguments in a 102batch file, 101alias, or
     696user-defined function (e.g., %& or %n&).  The default is the
     ampersand [&].  (You can specify either the character itself, or its
     ASCII code as a decimal number, or a hexadecimal number preceded by
     0x.)  The parameter character is saved by 665SETLOCAL and restored
     by 621ENDLOCAL.

!INDENT 5 5 5 5
     If you want to share batch files or aliases between 4DOS and
     0204NT or Take Command, see 054Special Character Compatibility
     for details on selecting compatible parameter characters for all the
     products you use.  Also see the 439ParameterChar directive.

!INDENT 5 5 0 5
     /R:  (Rows) This option sets the number of screen rows used by
     the video display.  Normally 4DOS detects the screen size,
     but if you have a non-standard display you may need to set
     it explicitly.  This option does not affect screen scrolling
     (that is controlled by your video driver, the BIOS, or
     ANSI.SYS).  It also does not set the screen size; it is used only to
     specify the screen height for LIST, SELECT, paged output options (i.e.,
     TYPE /P), and error checking in screen output commands.  Also see the
     443ScreenRows directive.

     /S:  (Shape) This option sets the cursor shape.  The format is
     /So:i where o is the cursor size for overstrike mode, i the
     cursor size for insert mode.  The size is entered as a percentage of
     the total character height.  The default values are 10:100 (a 10%
     underscore cursor for overstrike mode, and a 100% block cursor for insert
     mode).  Because of the way video BIOSes and drivers remap the cursor
     shape, you may not get a smooth progression in the cursor size from 0%
     - 100%.  To disable the cursor, enter /S0:0.

!INDENT 5 5 5 5
     If either value is -1, 4DOS will not attempt to
     modify the cursor shape at all.  You can use this feature to give
     another program full control of the cursor shape.  You can retrieve the
     current cursor shape values with the 178_CI and 179_CO
     internal variables.

     Also see the 420CursorOver and 419CursorIns directives.

!INDENT 5 5 0 5
     /U:  (Upper) This option controls the default case (upper or
     lower) for file and directory names displayed by internal commands
     like COPY and DIR.  /U0 displays file names in lower case (the
     default).  /U1 displays file names in the traditional upper
     case.  Also see the 446UpperCase directive.

!INDENT 5 5 5 5
     The /U setting is ignored for filenames on LFN drives.  Names on such
     drives are always displayed in the case in which they are stored.  See
     945File Names for additional details.

!INDENT 5 5 0 5
     /V:  (Verbose) This option controls the default for command
     echoing in batch files.  /V0 disables echoing of batch
     file commands unless 619ECHO is explicitly set ON.  /V1, the
     default setting, enables echoing of batch file
     commands unless ECHO is explicitly set OFF.  Also see
     104Echoing in Batch Files.

!INDENT 5 5 5 5
     /V2 forces echoing of all batch file commands, even if
     ECHO is set OFF or the line begins with an "@".  This allows
     you to turn echoing on for a batch file without editing the
     batch file and removing the ECHO OFF command(s) within it.  /V2 is
     intended for debugging, and can be set with
     SETDOS, but not with the 648OPTION command or the 414BatchEcho
     directive in 4DOS.INI.  For more information see
     112Debugging Batch Files.

!INDENT 5 5 0 5
     /W:  (Switch character) This option sets the DOS switch character
     (normally a slash [/]).  It will not work in Datalight ROM-DOS.
     The DOS switch character setting may be ignored by application programs.
     Note that setting the switch character to anything but a slash [/]
     will probably break all of your existing batch files and aliases!

     /X[+|-]n:  (Expansion and special characters) This option enables
     and disables alias and environment variable expansion, and
     controls whether special characters have their usual meaning
     or are treated as text.  It is most often used in batch
     files to process text strings which may contain special
     characters.

!INDENT 5 5 5 5
     The features enabled or disabled by /X are numbered.  All
     features are enabled when 4DOS starts, and you can
     re-enable all features at any time by using /X0.  To
     disable a particular feature, use /X-n, where n is
     the feature number from the list below.  To re-enable the
     feature, use /X+n.  To enable or disable multiple
     individual features, list their numbers in sequence after
     the + or - (e.g. /X-345 to disable features 3,
     4, and 5).

     The features are:

          1     All alias expansion.
          2     Nested alias expansion only.
          3     All variable expansion (includes environment
                variables, batch file parameters, and alias
                parameters).
          4     Nested variable expansion only.
          5     Multiple commands, conditional commands, and
                piping (affects the command separator, ||,
                &&, |, and |&).
          6     Redirection (affects < , >,  >&, >&>, etc.).
          7     Quoting (affects back-quotes [`], double
                quotes ["], and square brackets []).
          8     Escape character.
          9     User-defined functions.

     If nested alias expansion is disabled, the first alias of a
     command is expanded but any aliases it invokes are not
     expanded.  If nested variable expansion is disabled, each
     variable is expanded once, but variables containing the
     names of other variables are not expanded further.

     For example, to disable all features except alias expansion
     while you are processing a text file containing special
     characters:

          setdos /x-35678
          ... [perform text processing here]
          setdos /x0

!INDENT 5 5 0 5
     /Y:  (Debug batch file) /Y1 enables the built-in
     batch file debugger.  The debuggger allows you to "single-step" through
     a batch file line by line, with the file displayed in a popup window as
     it executes.  For complete details on using the debugger see
     112Debugging Batch Files (this topic also covers additional
     debugging techniques which do not require stepping through each line
     individually).

!INDENT 5 5 5 5
     To start the debugger, insert a SETDOS /Y1 command at the beginning of
     the portion of the batch file you want to debug, and a SETDOS /Y0
     command at the end.

     You cannot use the batch debugger with 116REXX files; it can only be
     used with normal 4DOS batch files.

     You can also invoke SETDOS /Y1 from the prompt, but because the debugger
     is automatically turned off whenever 4DOS returns to
     the prompt, you must enter the SETDOS command and the batch file name on
     the same line, for example:

        c:\> setdos /y1 ^ mybatch.btm
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 827 SETERROR
!TTY

Purpose:  Set the ERRORLEVEL value and the DOS error code.

Format:   SETERROR errorlevel

          errorlevel:  New value for ERRORLEVEL.
!TTY

Usage

SETERROR set the value of the ERRORLEVEL (162?) internal variable (i.e.
the exit code of the last external program) and the last-error code in DOS
to the specified value.
;---------------------------------------------------------------------------
!TOPIC 665 SETLOCAL
!TTY

Purpose:  Save a copy of the current disk drive, directory, environment,
          alias list, and special characters.

Format:   SETLOCAL
!TTY

See also: 621ENDLOCAL.

Usage

SETLOCAL is used in batch files to save the default disk drive and
directory, the environment, the alias list and the command separator, escape
character, parameter character, decimal separator, and thousands
separator.  You can then change their values and later restore the original
values with ENDLOCAL.

For example, this batch file fragment saves everything, removes all aliases
so that user aliases will not affect batch file commands, changes the disk
and directory, changes the command separator, runs a program, and then
restores the original values:

     setlocal
     unalias *
     cdd d:\test
     setdos /c~
     program ~ echo Done!
     endlocal

SETLOCAL and ENDLOCAL are nestable up to 8 levels deep within a batch file.
You cannot use SETLOCAL in an alias or at the command line.

An ENDLOCAL is performed automatically at the end of a batch file if you
forget to do so.  If you invoke one batch file from another without using
CALL, the first batch file is terminated, and an automatic ENDLOCAL is
performed; the second batch file inherits the settings as they were prior to
any unterminated SETLOCAL.

Do not load memory-resident programs (TSRs) from a batch file while
SETLOCAL is in effect, as SETLOCAL will have to temporarily set aside
some amount of memory to store the current settings.  If you do, when
ENDLOCAL is executed and the memory used by SETLOCAL is released,
a "hole" will be left in memory below the TSR.  This is not usually
harmful, but wastes memory.  However, in most cases, it only applies
when loading TSRs into conventional memory.

A combination of SETLOCAL / ENDLOCAL and 680UNSET can be used to slightly
reduce the memory footprint of most TSRs loaded into other memory regions
(usually Upper Memory), or at least avoid some possible memory fragmentation
in that region.  (This mainly applies to TSRs which don't free their 
environment segment when becoming resident.)  You can temporarily shrink
the environment down to the required minimum for the TSR to work using
UNSET * -- most TSRs do not need any environment variables at all, and
those few which do will usually only look for very specific variables
during initialization.  In addition to this, it is often possible to
temporarily assign a SUBST drive to make a long load path to the TSR as
short as possible in order to reduce the size of the environment appendage
under DOS 3.0 and above (which contains the full path to the loaded
driver).  For example:

     setlocal
     unset *
     subst b: d:\dir1\dir2\dir3\dir4\dir5\dir6\dir7\dir8
     lh b:\tsr.com ...
     subst b: /d
     endlocal
;---------------------------------------------------------------------------
!TOPIC 666 SHIFT
!TTY

Purpose:  Allows the use of more than 255 batch file parameters in a
          batch file.

Format:   SHIFT [n | /n]

          n:  Number of positions to shift.
!TTY

Usage

SHIFT is provided for compatibility with older batch files, where it was
used to access more than 10 parameters.  4DOS supports 256 parameters (%0
to %255), so you don't need to use SHIFT for batch files running
exclusively under JP Software command processors.

SHIFT moves each of the batch file parameters n positions to the left.  The
default value for n is 1.  SHIFT 1 moves the parameter in %1 to position
%0, the parameter in %2 becomes %1, etc.  You can reverse a SHIFT by giving
a negative value for n (i.e., after SHIFT -1, the former %0 is restored, %0
becomes %1, %1 becomes %2, etc.).

SHIFT also affects the special parameters %n& (command-line tail) and %#
(number of command arguments).  For compatibility with CMD.EXE, SHIFT does
not affect the %* parameter.

For example, create a batch file called TEST.BAT:

     echo %1 %2 %3 %4
     shift
     echo %1 %2 %3 %4
     shift 2
     echo %1 %2 %3 %4
     shift -1
     echo %1 %2 %3 %4

Executing TEST.BAT produces the following results:

     c:\> test one two three four five six seven
     one two three four
     two three four five
     four five six seven
     three four five six

If you add a slash before the value n, the value determines the
postion at which to begin the shift.  For example:

     shift /2

leaves parameters %0 and %1 unchanged, and moves the value of %3 to postion
%2, %4 to %3, etc.  The value after the slash cannot be negative, and shifts
performed with the slash cannot be undone later in the batch file.
;---------------------------------------------------------------------------
!TOPIC 667 START
!TTY

Purpose:  Start a program in another OS/2 session.

Format:   START ["program title"] [/B[G] /C /DOS[=optfile] /F[G] /FS
          /ICON=iconfile /INV /K /L /LA /LD /LH /MAX /MIN /N
          /PGM progname /PM /POS=x,y,width,height /WIN
          /WIN3[=optfile] /WIN3S[=optfile]] [command]

          program title:  Title to appear on title bar.
          optfile:        Option settings file.
          iconfile:       Name of icon (.ICO) file.
          progname:       Program name (not the session name).
          command:        Command to be executed.

          /B[G] (background)          /LH (local history list)
          /C(lose when done)          /MAX(imized)
          /DOS (DOS session)          /MIN(imized)
          /F[G] (foreground)          /N(o command processor)
          /FS (full screen)           /PGM (program name)
          /ICON (.ICO file)           /PM (PM application)
          /INV(isible)                /POS(ition of window)
          /K(eep when done)           /WIN(dowed session)
          /L(ocal lists)              /WIN3 (Windows 386 Enhanced mode)
          /LA (local aliases)         /WIN3S (Windows Standard mode)
          /LD (local dir history)
!TTY

Usage

START is available only from DOS sessions under OS/2.  It will not work
when running 4DOS under DOS or Windows.  If you are running 4DOS under
Windows 95/98/ME, you can use the external START command that is
usually stored in your \WINDOWS\COMMAND folder.  See
your 65535Windows documentation or type START /? for details.

START is used to begin a new session and, optionally, to run a program in
that session.  If you use START with no parameters, it will begin a new
session.  If you add a command, START will begin a new session and execute
that command.

The program title, if it is included, will appear on the title bar, and on
the Presentation Manager window list.  The program title must be enclosed
in quotation marks and cannot exceed 60 characters.  If the program title
is omitted, the program name will be used as the title.

START always assumes that the first quoted string on the command line is the
program title; if there is a second quoted string it is assumed to be the
command.  As a result, if the name of the program you are starting is a long
filename containing whitespace (and must therefore be quoted), you cannot
simply place it on the command line.  If you do, as the first quoted string
it will be interpreted as the program title, not the command.  To address
this, use the /PGM switch to indicate explicitly that the quuoted string is
the program name, or include a title before the program name.  For example,
to start the program "C:\Program Files\Proc.Exe" you could use either of the
first two commands below, but the third command would not work:

     c:\> start /PGM "C:\Program Files\Proc.Exe"
     c:\> start "test" "C:\Program Files\Proc.Exe"
     c:\> start "C:\Program Files\Proc.Exe"

START offers a large number of switches to control the session you start.  In
most cases you need only a few switches to accomplish what you want.  The
list below summarizes the most commonly used START options, and how you can
use them to control the way a session is started:

!INDENT 5 5 5 5
     /MAX,  /MIN, and /POS allow you to start a
     character-mode windowed session in a maximized window, a minimized
     window, or a window with a specified position and size.  The default is
     to let the operating environment choose the position and size of the
     window.

     /C allows you to close the session when the command is
     finished (the default); /K allows you to keep the session open
     and go to a prompt.

     /BG and /FG allow you to start the session in the background
     (does not respond to keystrokes until selected) or
     foreground (responds to keystrokes until deselected).  /FG is
     the default if /DOS, /FS, /WIN, or /PM is used; otherwise,
     /BG is the default.

     /FS and /WIN control whether a character-mode session is
     started in full-screen or windowed mode.  The default is
     to start a session of the same type as the current session, if the
     application can be run in such a session.
!INDENT 0

START gives you some flexibility in determining the session mode.  For
example, if the command is the name of a batch file, you can use the /FS
or /WIN options to run the batch file as part of a new session in either
full-screen or windowed mode.

However, you cannot start a session in a mode that is inappropriate for the
application type.  A DOS application cannot be run as part of a Presentation
Manager session, for example, even if you use the /PM switch.  Invalid or
conflicting options will be ignored.

The 4DOS START command is unable to determine the application type.  If you
don't specify the type on the command line, 4DOS will start a new OS/2
session to run it.

If you want to start a DOS command-line session in OS/2, you can
use the command:

     c:\> start /DOS

You can specify settings for DOS and Windows sessions by using a
settings options file, and loading it with the /DOS=, /WIN3=, or
/WIN3S= option.  This allows you to start DOS and Windows sessions with
specific settings without creating a desktop object and modifying the
settings manually.  Before using this capability you should read the
description of it under /DOS= (below) very carefully, since errors in the
settings file can occasionally hang your system.

Options

!INDENT 5 5 0 5
     /BG:  (BackGround session) The session is started as a background
     session.  /BG may be abbreviated to /B.

     /C:  (Close) The session is closed when the application ends.

     /DOS[=filename]:  (DOS session) Start a DOS session.  If you
     include the =filename, OS/2 will load DOS settings from
     the specified file.  When you use /DOS you can also alter the
     DOS settings for a session with environment variables of the form
     DosSetting.name=value, without using a settings file.

!INDENT 5 5 5 5
     Starting a session with specific DOS settings is an
     undocumented feature which was implemented within OS/2 with
     little error checking.  It is included in START because it
     substantially eases a complex task, but you must experiment
     carefully to ensure that the settings you select will work
     properly on the systems on which you plan to use them.  Incorrect
     settings may be ignored, but they may also hang your session or
     stop the entire system.  Be sure your experiments are not conducted
     while critical tasks are in process.

     Each line in the file must have a name, an equal sign
     [=], and a value.  The names are those shown in OS/2's
     DOS Settings dialog box.  Do not use spaces on either side
     of the equal sign.

     The names in the DOS Settings dialog box will vary depending
     on the device drivers and other settings in your CONFIG.SYS
     file, though many are available on all systems.  You must
     ensure that the names you use are valid for the systems on
     which you use them.  For example, if you replace IBM's
     COM.SYS and VCOM.SYS with different communications drivers,
     the COM_ settings will probably not be valid for the new
     drivers.  If you have a settings file which contains
     settings defined by a particular driver, and use it on a
     system where the corresponding driver is not loaded, the
     results are undefined.

     The values in your settings file must be numeric for
     settings which show a numeric value under DOS Settings
     (e.g., DOS_FILES=30), and must be text strings for settings
     shown with a string (e.g., DOS_SHELL=C:\4DOS.COM C:\4DOS
     /P).  Strings should be entered without trailing blanks.  For
     values shown as multiple choice on the DOS Settings page
     you must specify a numeric value, typically "0" for Off and
     "1" for On (e.g., DOS_HIGH=1).  Items with choices other than
     Off and On may use different values, or may not work at all;
     experimentation is usually required to find out what works.  Attempting
     to use strings for choice items (e.g., DOS_HIGH=ON) will not work, and
     can hang your system.  This is due to the internal operation of OS/2,
     and is not a problem in 4DOS.

     A typical DOS settings file might look like this:

          DOS_FILES=30
          DOS_HIGH=1
          DOS_SHELL=C:\4DOS\4DOS.COM C:\4DOS /P
          MOUSE_EXCLUSIVE_ACCESS=0
          VIDEO_FASTPASTE=1

     You can include comments in a settings file by beginning any
     line with a colon [:].

     When you use /DOS you can also alter the DOS settings for a session
     with environment variables, without using a DOS settings file.  When the
     =filename portion of the switch is not used, OS/2 will scan the
     environment looking for variables of the form
     DosSetting.name=value.  Each such variable entry will be used to set
     the DOS setting with the specified name to the specified value.  All of
     the cautions and restrictions given above for settings stored in a file
     apply equally to settings stored in environment variables.

     Settings stored in environment variables are "global" and apply to all
     sessions started with START /DOS, except when an explicit settings file
     is specified with =filename.

!INDENT 5 5 0 5
     /FG:  (ForeGround session) Start the session as the foreground session.
     /FG may be abbreviated to /F.

     /FS:  (Full Screen) Start the session as a full-screen session.

     /ICON=filename:  (Icon) Use the specified icon file.  If you don't
     use /ICON, the displayed icon will be the one found or assigned by
     OS/2.

     /INV:  (Invisible) Start the session as invisible.  No icon will
     appear and the session will only be accessible through the Task
     Manager or Window List.

     /K:  (Keep session) The session continues after the application
     program ends.  Use the 624EXIT command to end the session.

     /L:  (Local lists) Start 4DOS with local alias,
     history, and directory history lists (this combines the effects of
     /LA, /LD, and /LH).

     /LA:  (Local alias list) Start 4DOS with a local
     alias list.See 595ALIAS for information on local and
     global aliases.

     /LD:  (Local directory history) Start 4DOS with
     a local directory history.  See 040Directory History Window for
     information on local and global directory history.

     /LH:  (Local History list) Start 4DOS with a local
     history list.  See 033Command History and Recall for
     information on local and global history lists.

     /MAX:  (Maximized) Start the session maximized.

     /MIN:  (Minimized) Start the session minimized.

     /N:  (No command processor) Start a program directly, without
     a command processor.  The command cannot be an internal command
     or batch file.

     /PGM:  (Program name) The string following this option is the program
     name.  If you do not use /PGM, the first quoted string on the line
     will be used as the session and task list title, and not as the program
     name.

     /PM:  (Presentation Manager) Start a program in the Presentation
     Manager session.

     /POS:  (Position) Start the window at the specified screen
     position.  The syntax is /POS=x, y, width, height where the values
     are specified in pixels or pels.  x and y refer
     to the position of the bottom left corner of the window
     relative to the bottom left corner of the screen.

     /WIN:  (Windowed) Start the session in a window.

     /WIN3[=filename]:  (Windows 386 Enhanced mode) Run the program in an
     386 Enhanced mode Windows 3.xx session.  The session will run in
     Windows full-screen mode.  You can include an equal sign and
     the name of an options file to set options for the specific
     session and application (see /DOS= above for details).
     The setting names in the file should be taken from those
     shown in OS/2's WIN-OS/2 Settings dialog box.

     /WIN3S[=filename]:  (Windows Standard mode) Equivalent to /WIN3,
     but runs the program in Standard mode rather than 386 Enhanced mode.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 668 SWAPPING
!TTY

Purpose:  Enable or disable 4DOS swapping, or display the swapping state.

Format:   SWAPPING [ON | OFF]
!TTY

Usage

SWAPPING temporarily disables or enables the swapping of the transient
portion of 4DOS to expanded memory, to XMS extended memory, or to disk (see
the 391Swapping directive in 4DOS.INI for more information).

Setting SWAPPING OFF may be useful for speeding up batch files
(including AUTOEXEC.BAT) when 4DOS is using disk swapping.  When you are
running several small programs from a batch file, disk swapping can
sometimes cause a noticeable delay.  However, if you disable swapping,
there will be about 245K less memory available for large application
programs.

The following batch file fragment disables swapping, runs several programs,
and then re-enables swapping:

     swapping off
     c:\util\mouse
     c:\video\ansi.com
     c:\bin\cache.com
     swapping on

If you enter SWAPPING with no arguments, 4DOS displays the current
swapping type (XMS, EMS, Disk, or None) and state:

     c:\> swapping
     SWAPPING (XMS) is ON

Setting SWAPPING OFF does not close the disk swap file or release any
reserved EMS or XMS memory.

You may have trouble if you load memory-resident programs (TSRs) with
SWAPPING OFF and unload them with SWAPPING ON, or vice versa.  Many TSRs
expect the system to be in the same state when they unload that it was in
when they loaded, and variation from this norm may cause the TSR to unload
improperly or hang your system.
;---------------------------------------------------------------------------
!TOPIC 669 SWITCH
!TTY

Purpose:  Select commands to execute based on a value.

Format:   SWITCH expression
          CASE value1 [.OR. value2] ...
               commands
          CASE value3
               commands
          [DEFAULT
               commands]
          ENDSWITCH

          expression:            An environment variable, internal variable,
                                 variable function, text string, or a
                                 combination of these elements, that is used
                                 to select a group of commands.
          value1, value2, etc.:  A value to test, or multiple values
                                 connected with .OR.
          commands:              One or more commands to execute if the
                                 expression matches the value.  If you use
                                 multiple commands, they must be separated
                                 by command separators or placed on separate
                                 lines in the batch file.
!TTY

See also:  633IF, and 634IFF.

Usage

SWITCH can only be used in batch files.  It allows you to select a command or
group of commands to execute based on the possible values of a variable or a
combination of variables and text.

The SWITCH command is always followed by an expression created from
environment variables, internal variables, variable functions, and text
strings, and then by a sequence of CASE statements matching the possible
values of that expression.  If one of the values
in a CASE statement matches the expression, the commands following
that CASE statement are executed, and all subsequent CASE statements and the
commands which follow them are ignored.  If no matches are found, the commands
following the optional DEFAULT statement are executed.  If there are no
matches and there is no DEFAULT statement, no commands are executed by
SWITCH.

After all of the commands following the CASE or DEFAULT statement are
executed, the batch file continues with the commands that follow ENDSWITCH.

The SWITCH command must be the last (or only) command on the line.  Each
CASE, DEFAULT, or ENDSWITCH statement must appear on a line by
itself.  Multiple values in CASE must be separated by the .OR. operator;
.AND. and .XOR. are not legal.

For example, the following batch file fragment displays one message if the
user presses A, another if user presses B or C,
and a third if the user presses any other key:

     inkey Enter a keystroke: %%key
     switch %key
     case A
        echo It's an A
     case B .or. C
        echo It's either B or C
     default
        echo It's not A, B, or C
     endswitch

In the example above, the value of a single environment variable was used for
the expression.  You will probably find that this is the best
method to use in most situations.  However, you can use other kinds of
expressions if necessary.  The first example below selects a command to
execute based on the length of a variable, and the second bases the action on
a quoted text string stored in an environment variable:

     switch %@len[%var1]
     case 0
        echo Missing var1
     case 1
        echo Single character
     ...
     endswitch
     switch "%string1"
     case "This is a test"
        echo Test string
     case "The quick brown fox"
        echo It's the fox
     ...
     endswitch

The SWITCH command is a multiline structure.  You can't put it in a
085command group or pack it into a single line.  (This is why SWITCH
cannot be used in aliases.)  However, commands within a CASE or DEFAULT block
can use command groups or the 041command separator in the normal way.

SWITCH commands can be nested.  The permissible nesting level
depends on the amount of free space in 4DOS's internal stack; if you receive
a stack overflow error when using SWITCH in complex, nested command
sequences, see the 574StackSize directive.

You can exit from all SWITCH / ENDSWITCH processing by using 630GOTO to a
line past the last ENDSWITCH.
;---------------------------------------------------------------------------
!TOPIC 698 TAIL
!TTY

Purpose:  Display the end of the specified file(s).

Format:   TAIL [/A:[[+|-]rhsad] /Cn /I"text" /Nn /P /Q /V] [@file] file...

          file:   The file or list of files that you want to display.
          @file:  A text file containing the names of the files to
                  display, one per line (see 057@file lists for details).

          /A: (Attribute select)      /P(ause)
          /C (Number of bytes)        /Q(uiet)
          /I (match description)      /V(erbose)
          /N (Number of lines)
!TTY

See also: 697HEAD, 640LIST, and 677TYPE.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Usage

The TAIL command displays the last part of a file.  It is normally only
useful for displaying ASCII text files.  Executable files (.COM and .EXE)
and many data files may be unreadable when displayed with TAIL because they
include non-alphanumeric characters.  You can press Ctrl-S to pause TAIL's
display and then any key to continue.

To display the last 15 lines of the files MEMO1 and MEMO2:

     c:\> tail /n15 memo1 memo2

To display text from the clipboard, use CLIP: as the file name.  CLIP:
will not return any data unless the clipboard contains text.  See
051redirection for additional information on CLIP:, including details on
when you can use the clipboard under 4DOS.

Options

!INDENT 5 5 0 5
     /A:: (Attribute select) Select only those files that have the
     specified attribute(s) set.  The colon [:] after /A is
     required.  Preceding an attribute letter with a hyphen [-]
     will select files that do not have that attribute set.  You can
     OR attributes by preceding each attribute letter with a plus sign [+].

!INDENT 5 5 5 5
     The attributes are:

          R  Read-only      S  System
          H  Hidden         A  Archive

     If no attributes are listed at all (e.g., TAIL /A: ...), TAIL will
     select all files including hidden and system files.  If attributes are
     combined, all the specified attributes must match for a file to be
     selected.  For example, /A:RHS will select only those files
     with all three attributes set.
!INDENT 5 5 0 5

     /C:  Display the specified number of bytes.  /C accepts b, k, or m
     modifiers at the end of the number.  b is the number of 512-byte blocks,
     k is 1000's of bytes, K is kilobytes, m is millions of bytes, and M is
     megabytes.

     /I"text":  Select files by matching text in their descriptions.
     The text can include 073wildcards and extended wildcards.  The
     search text must be enclosed in quotation marks, and must follow
     the /I immediately, with no intervening spaces.  You can select 
     all filenames that have a description with /I"[?]*", or all 
     filenames that do not have a description with /I"[]".

     /N:  The number of lines to display.  The default is 10.

     /P:  (Pause) Prompt after displaying each page.  Your options at the
     prompt are explained in detail under 045Page and File Prompts.

     /Q:  (Quiet) Don't display a header for each file.  This is the
     default behavior unless /V is specified.

     /V:  (Verbose) Display a header for each file.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 670 TEE
!TTY

Purpose:  Copy standard input to both standard output and a file.

Format:   TEE [/A] file...

          file:  One or more files that will receive the "tee-d" output.

          /A(ppend)
!TTY

See also: 686Y, 052piping and 051redirection.

Usage

TEE is normally used to "split" the output of a program so that you can see
it on the display and also save it in a file.  It can also be used to
capture intermediate output before the data is altered by another program
or command.

TEE gets its input from standard input (usually the piped output of another
command or program), and sends out two copies:  one goes to standard
output, the other to the file or files that you specify.  TEE is not likely
to be useful with programs which do not use standard output, because these
programs cannot send output through a pipe.

For example, to search the file DOC for any lines containing the string
"4DOS", make a copy of the matching lines in 4.DAT, sort the lines, and
write them to the output file 4D.DAT:

     c:\> find "4DOS" doc | tee 4.dat | sort > 4d.dat

If you are typing at the keyboard to produce the input for TEE, you must
enter a Ctrl-Z to terminate the input.

When using TEE with a pipe, the previous command writes its output to a
temporary file.  When that command finishes, TEE begins operation and can
read the temporary file, display the output, and write it to the file(s)
named in the TEE command.

Options

!INDENT 5 5 0 5
     /A:  (Append) Append to the file(s) rather than overwriting them.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 671 TEXT
!TTY

Purpose:  Display a block of text in a batch file.

Format:   TEXT
            .
            .
            .
          ENDTEXT
!TTY

See also: 619ECHO, 660SCREEN, 661SCRPUT, and 684VSCRPUT.

Usage

TEXT can only be used in batch files.

The TEXT command is useful for displaying menus or multi-line messages.
TEXT will display all subsequent lines in the batch file until terminated
by ENDTEXT.  Both TEXT and ENDTEXT must be entered as the only command on
the line.

To redirect the entire block of text, use redirection on the TEXT command
itself, but not on the actual text lines or the ENDTEXT line.  No
environment variable expansion or other processing is performed on the
lines between TEXT and ENDTEXT; they are displayed exactly as they are
stored in the batch file.

If you have an 842ANSI driver loaded, you can change screen colors by
inserting 915ANSI escape sequences anywhere in the text block.  You can
also use a 604CLS or 605COLOR command to set the screen color before
executing the TEXT command.

The following batch file fragment displays a simple menu:

     @echo off
     cls
     screen 2 0
     text
        Enter one of the following:
           1 - Spreadsheet
           2 - Word Processing
           3 - DOS Utilities
           4 - Exit
     endtext
     inkey /k"1234" Enter your selection:  %%key
;---------------------------------------------------------------------------
!TOPIC 672 TIME
!TTY

Purpose:  Display or set the current system time.

Format:   TIME [/T] [hh[:mm[:ss]]] [AM | PM]

          hh:  The hour (0 - 23).
          mm:  The minute (0 - 59).
          ss:  The second (0 - 59), set to 0 if omitted.

          /T:  (display only)
!TTY

See also: 608DATE.

Usage

If you don't enter any parameters, TIME will display the current system
time and prompt you for a new time.  Press Enter if you don't wish to
change the time; otherwise, enter the new time.

     c:\> time
     Mon  Jun 19, 2000  9:30:06
     New time (hh:mm:ss):

TIME defaults to 24-hour format, but you can optionally enter the time in
12-hour format by appending "a", "am", "p", or "pm" to the time you enter.

For example, to enter the time as 9:30 am:

     c:\> time 9:30 am

DOS adds the system time and date to the directory entry for every file you
create or modify.  If you keep both the time and date accurate, you will
have a record of when you last updated each file.

Option

!INDENT 5 5 0 5
     /T:  (Display only)  Displays the current time but does not prompt you
     for a new time.  You cannot specify a new time on the command line with
     /T.  If you do, the new time will be ignored.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 673 TIMER
!TTY

Purpose:  TIMER is a system stopwatch.

Format:   TIMER [ON|OFF] [/1 /2 /3 /Q /S]

          ON:  Force the stopwatch to restart.
          OFF: Force the stopwatch to stop.

          /1 (stopwatch #1, default)  /Q(uiet)
          /2 (stopwatch #2)           /S(plit)
          /3 (stopwatch #3)
!TTY

Usage

The TIMER command turns a system stopwatch on and off.  When you first run
TIMER, the stopwatch starts.

     c:\> timer
     Timer 1 on:  12:21:46

When you run TIMER again, the stopwatch stops and the elapsed time is
displayed.

     c:\> timer
     Timer 1 off:  12:21:58   Elapsed time: 0:00:12.06

There are three stopwatches available (1, 2, and 3) so you can time
multiple overlapping events.  By default, TIMER uses stopwatch #1.

TIMER is particularly useful for timing events in batch files.  For
example, to time both an entire batch file, and an intermediate section of
the same file, you could use commands like this:

     rem  Turn on timer 1
     timer
     rem  Do some work here
     rem  Turn timer 2 on to time the next section
     timer /2
     rem  Do some more work
     echo Intermediate section completed
     rem  Display time taken in intermediate section
     timer /2
     rem  Do some more work
     rem  Now display the total time
     timer

The smallest interval TIMER can measure (same as the elapsed time resolution
or granularity) is 0.03 seconds under OS/2, and 0.01 seconds under all other
operating systems.  The largest possible interval that TIMER can measure is
23 hours, 59 minutes, 59.99 seconds.

Options

!INDENT 5 5 0 5
     /1:  Use timer #1 (the default).

     /2:  Use timer #2.

     /3:  Use timer #3.

     /Q:  (Quiet) Don't display any messages.

     /S:  (Split) Display a split time without stopping the timer.  To
     display the current elapsed time but leave the timer running:

!INDENT 5 5 5 5
          c:\> timer /s
          Timer 1 elapsed: 0:06:40.63

!INDENT 5 5 0 5
     ON:  Start the timer regardless of its previous state (on or
     off).  Otherwise the TIMER command toggles the timer state
     (unless /S is used).

     OFF: Stops the timer.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 768 TITLE
!TTY

Purpose:  Change the window title.

Format:   TITLE title

          title:  The new window title.
!TTY

Usage

TITLE changes the text that appears in the caption bar at the top of the
command processor window, if 4DOS is running in Windows 95/98/ME or under
OS/2.

The title text should not be enclosed in quotes unless you want the quotes
to appear as part of the actual title.

For example, to change the title of the current window to "Title Test", you
could use this command:

     c:\> title Title Test

The current setting of the TITLE will be stored in an environment variable
named 146TITLEPROMPT.  The current window title can be obtained through
the 223_WINTITLE internal variable.

Note that 4DOS is limited to a maximum of 79 characters in the title bar.

Most of the features available in PROMPT may also be used in TITLE,
including the $ sequences, 131environment variables, 161internal
variables, and 241variable functions; see 652PROMPT for details.  (ANSI
sequences and other console-control functions will not do anything useful in
the title bar, however.)
;---------------------------------------------------------------------------
!TOPIC 674 TOUCH
!TTY

Purpose:  Change a file's date and time stamps.

Format:   TOUCH [/A:[[+|-]rhsad]/C /D[acw][mm-dd-yy] /E /F /I"text" /N /Q
          /R[:acw] reffile /S /T[acw][hh:mm]] [@file] file...

          reffile:   A file whose date and / or time stamps are to be
                     transferred to one or more other files.
          file:      One or more files whose date and/or time stamps are
                     to be changed.
          @file:     A text file containing the names of the files to
                     touch, one per line (see 057@file lists
                     for details).

          /A: (Attribute select)      /N(othing)
          /C(reate file)              /Q(uiet)
          /D(ate)                     /R(epeat)
          /E (No error messages)      /S(ubdirectories)
          /F(orce read-only files)    /T(ime)
          /I (match descriptions)
!TTY

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Use wildcards with caution on LFN volumes; see 081LFN File Searches
for details.

Usage

TOUCH is used to change the date and/or time of a file.  You can use it to
be sure that particular files are included or excluded from an internal
command, backup program, compiler MAKE utility, or other program that selects
files based on their time and date stamps, or to set a group of files to the
same date and time for consistency.

TOUCH should be used with caution, and in most cases should only be used
on files you create.  Many programs depend on file dates and times to perform
their work properly.  In addition, many software manufacturers use file dates
and times to signify version numbers.  Indiscriminate changes to date and
time stamps can lead to confusion or incorrect behavior of other software.

TOUCH normally works with existing files, and will display an error if the
file you specify does not exist, or has the read-only attribute set.  To
create the file if it does not already exist, use the /C switch.  To force
a date and time change for read-only files, use the /F switch.

TOUCH displays the date, time, and full name of each file whose timestamp is
modified.  To disable this output, use /Q.

If you don't specify a date or a time, TOUCH will default to the current date
and time from your system clock.  For example, to set the time stamp of all
.C files in the current directory to the current date and time:

     d:\source> touch *.c
      6-12-00 11:13:58  D:\SOURCE\MAIN.C
      6-12-00 11:13:58  D:\SOURCE\INIT.C
      ...

If you specify a date but not a time, the time will default to the current
time from your system clock.  Similarly, if you specify a time but not a
date, the date will be obtained from the system clock.

If you enter /D or /T with no argument, TOUCH will preserve the existing
date or time.

To transfer the date and time from one file to another use /R; see
below for details.

Due to operating system limitations, TOUCH can not set the date and
time for directories, even if you use the /A:d switch.

On LFN files, TOUCH sets the "modified" or "last write" date
and time by default.  By adding the appropriate character to the /D or /T
switch, you can set the other date and time stamps that are maintained for
each file:

!NOWRAP
     a    last access date and time (access time can not be set on
          LFN volumes).
     c    creation date and time.
     w    last write date and time (default).
!WRAP

Options

!INDENT 5 5 0 5
     /A:: (Attribute select) Select only those files that have the
     specified attribute(s) set.  The colon [:] after /A is
     required.  Preceding an attribute letter with a hyphen [-]
     will select files that do not have that attribute set.  You can
     OR attributes by preceding each attribute letter with a plus sign [+].

!INDENT 5 5 5 5
     The attributes are:

          R  Read-only      D  subDirectory
          H  Hidden         A  Archive
          S  System

     If no attributes are listed at all (e.g., TYPE /A: ...), TOUCH will
     select all files and subdirectories including hidden and system files.
     If attributes are combined, all the specified attributes must match for
     a file to be selected.  For example, /A:RHS will select only those
     files with all three attributes set.

!INDENT 5 5 0 5
     /C:  (Create file) Create the file (as a zero-byte file) if it does
     not already exist.  You cannot use wildcards with /C, but you can
     create multiple files by listing them individually on the command line.

     /D:  (Date) Specify the date that will be set for the
     selected files.  If the date is not specified, TOUCH will use
     the current date.  For LFN files you can use /Da, /Dc, or
     /Dw, followed by the date, to explicitly specify the last
     access, creation, or last write date stamp.  The date must be
     entered using the proper format for your current country
     settings.  You can also use the ISO 8601 international date format
     "yyyy-mm-dd", the ISO 8601 week date format "yyyy-Www-d", where
     yyyy = year, ww = week, d = week day, or the ISO 8601 ordinal date
     format "yyyy-ddd", where yyyy = year, ddd = day of the year.

     /E:  (No error messages) Suppress all non-fatal error
     messages, such as "File not found."  Fatal error messages, such as
     "Drive not ready," will still be displayed.  This option is most useful
     in batch files.

     /F:  (Force read-only files) Remove the read-only attribute from each
     file before changing the date and time, and restore it
     afterwards.  Without /F, attempting to change the date and time on a
     read-only file will usually cause an error.

     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /N:  (Nothing) Do everything but actually change the date and time.

     /Q:  (Quiet) Do not display the new date and time and the full name
     for each file.

     /R:  (Repeat) The date and time for the specified file(s)
     will be set to the current date and time for the reference file
     whose name immediately follows the /R. For LFN files, you can
     use /R:c or /R:w, followed by the file name, to specify the
     last creation or last write time stamp.  However, files on FAT-based
     volumes do not have a last access time, so TOUCH /R:a will
     have no effect on such files.

     If /D or /T is used after /R, the specified date or time
     will override the date and/or time from the reference file.
     For example, to set the date for file X2 to match the date for
     X1, and also set the time for X2 to 11:42 AM, you could use:

!INDENT 5 5 5 5
          c:\> touch /r x1 /t11:42 x2

!INDENT 5 5 0 5
     /S:  (Subdirectories): TOUCH all matching files in the specified
     directory and its subdirectories.  Unlike most 4DOS commands, TOUCH /S
     will search into subdirectories with the hidden or system attributes
     set.

     /T:  (Time) Specify the time that will be set for the selected
     files, in hh:mm format.  If the time is not specified, TOUCH will use
     the current time.  For LFN files you can use /Tc or /Tw,
     followed by the time, to explicitly specify the last access, creation,
     or last write time stamp.  However, files on FAT-based volumes do not
     have a last access time, so TOUCH /Ta will have no effect on such
     files.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 774 TRANSIENT
!TTY

Purpose:  Toggle the shell's transient mode.

Format:   TRANSIENT [ON | OFF]
!TTY

Usage

TRANSIENT can only be used in batch files.  It allows you to change the
shell's transient mode (i.e., whether it was started with a /C), so that you
can make a transient session permanent (or vice versa).
;---------------------------------------------------------------------------
!TOPIC 675 TREE
!TTY

Purpose:  Display a graphical directory tree.

Format:   TREE [/A /B /F /H /P /S /T[:acw]] dir...

          dir:  The directory to use as the start of the tree.  If
                more than one directory is specified, TREE will display a
                directory tree for each.

          /A(SCII)                    /P(ause)
          /B(are)                     /S (file size)
          /F(iles)                    /T(ime and date)
          /H(idden directories)
!TTY

Usage

The TREE command displays a graphical representation of the directory tree
using standard or extended ASCII characters.  For example, to display the
directory structure on drive C:

     c:\> tree c:\

You can print the display, save it in a file, or view it with 640LIST by
using the usual 051redirection and 052piping operators.  Be sure to
review the /A option before attempting to print the TREE output.  The
options discussed below specify the amount of information included in the
display.

Options

!INDENT 5 5 0 5
     /A:  (ASCII) Display the tree using standard ASCII characters.  You
     can use this option if you want to save the directory tree in a file
     for further processing or print the tree on a printer which does not
     support the graphical symbols that TREE normally uses.

     /B:  (Bare) Display the full pathname of each directory,
     without any of the line-drawing characters.

     /F:  (Files) Display files as well as directories.  If you use this
     option, the name of each file is displayed beneath the name of the
     directory in which it resides.

     /H:  (Hidden) Display subdirectories with the hidden or system
     attributes set.  If you combine /H and /F, hidden and system files
     will also be displayed.

     /P:  (Pause) Wait for a key to be pressed after each screen page before
     continuing the display.  Your options at the prompt are explained in
     detail in 045Page and File Prompts.

     /S:  (Size) Display the size of each file.  This option is only useful
     when combined with /F.

     /T:  (Time and date) Display the time and date for each directory.  If
     you combine /T and /F, the time and date for each file will also be
     displayed.  For LFN files, the time and date of the last
     write will be shown by default.  You can select a specific time and date
     stamp by using the following variations of /T:

!INDENT 5 5 5 5
          /T:a    last access date and time (access time is not saved
                  on LFN volumes).
          /T:c    creation date and time.
          /T:w    last write date and time (default).
!INDENT 0

For comparison with the external DOS TREE.COM command refer to
the 65535external DOS help system.
;---------------------------------------------------------------------------
!TOPIC 676 TRUENAME
!TTY

Purpose:  Find the full, true path and file name for a file.

Format:   TRUENAME file

          file:  The file whose name TRUENAME will report.
!TTY

See also: 325@TRUENAME variable function.

Usage

Default directories, as well as the JOIN and SUBST
external commands, can obscure the true name of a file.  TRUENAME "sees
through" these obstacles and reports the fully qualified name of a file.

The following example uses TRUENAME to get the true pathname for a file:

     c:\> subst d: c:\util\test
     c:\> truename d:\test.exe
     c:\util\test\test.exe

To use TRUENAME you must be running MS-DOS or PC DOS 3.0 or above, DR DOS
6.0 or above, or OS/2 version 2.0 or above.

On LFN drives TRUENAME returns the short name for the file, for example:

     c:\> truename "Program Files"
     C:\PROGRA~1

TRUENAME can handle simple drive substitutions such as those created by
JOIN, SUBST, or most network drive mappings.  However it may not be able to
correctly determine the tr  Multiple commands, conditional commands, and
                piping (affects the command separator, ||,
                &&, |, and |&).
          6     Redirection (affects < , >677 TYPE
!TTY

Purpose:  Display the contents of the specified file(s).

Format:   TYPE [/A:[[+|-]rhsad] /I"text" /L /P /V] [@file] file...

          file:   The file or list of files that you want to display.
          @file:  A text file containing the names of the files to
                  display, one per line (see 057@file lists for
                  details).

          /A: (Attribute select)      /L(ine numbers)
          /I  (match description)     /P(ause)
                                      /V(erbose)
!TTY

See also: 697HEAD, 640LIST, and 698TAIL.

File Selection

Supports extended 073wildcards, 074ranges, 079multiple file
names, and 080include lists.

Usage

The TYPE command displays a file.  It is normally only useful for
displaying ASCII text files.  Executable files (.COM and .EXE) and many
data files may be unreadable when displayed with TYPE because they include
non-alphanumeric characters.

To display the files MEMO1 and MEMO2:

     c:\> type /p memo1 memo2

You can press Ctrl-S to pause TYPE's display and then any key to
continue.

To display text from the clipboard, use CLIP: as the file name.  CLIP:
will not return any data unless the clipboard contains text.  See
051redirection for additional information on CLIP:, including details on
when you can use the clipboard under 4DOS.

You will probably find LIST to be more useful for displaying files.  However,
the TYPE /L command used with 051redirection is useful if you want to add
line numbers to a file, for example:

     c:\> type /l myfile > myfile.num

Options

!INDENT 5 5 0 5
     /A:: (Attribute select) Select only those files that have the
     specified attribute(s) set.  The colon [:] after /A is
     required.  Preceding an attribute letter with a hyphen [-]
     will select files that do not have that attribute set.  You can
     OR attributes by preceding each attribute letter with a plus sign [+].

!INDENT 5 5 5 5
     The attributes are:

          R  Read-only      S  System
          H  Hidden         A  Archive

     If no attributes are listed at all (e.g., TYPE /A: ...), TYPE will
     select all files including hidden and system files.  If attributes are
     combined, all the specified attributes must match for a file to be
     selected.  For example, /A:RHS will select only those files with all
     three attributes set.
!INDENT 5 5 0 5

     /I"text":  Select files by matching text in their
     descriptions.  The text can include 073wildcards and
     extended wildcards.  The search text must be enclosed in
     quotation marks, and must follow the /I immediately, with no
     intervening spaces.  You can select all filenames that have a
     description with /I"[?]*", or all filenames that do not have
     a description with /I"[]".

     /L:  (Line numbers) Display a line number preceding each line of text.

     /P:  (Pause) Prompt after displaying each page.  Your options at the
     prompt are explained in detail under 045Page and File Prompts.

     /V:  (Verbose) Display a file name header for each file.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 678 UNALIAS
!TTY

Purpose:  Remove aliases from the alias list.

Format:   UNALIAS [/Q /R file] [alias...]
               or
          UNALIAS *

          alias:  One or more aliases to remove from memory.
          file:   One or more files to read for alias definitions.

          /Q(uiet)                    /R(ead file)
!TTY

See also: 595ALIAS and 622ESET.

Usage

4DOS maintains a list of the aliases that you have defined.  The UNALIAS
command will remove aliases from that list.  UNALIAS supports wildcards in
the alias name, and you can remove one or more aliases by name, or you
can delete the entire alias list by using the command UNALIAS *.

For example, to remove the alias DDIR:

     c:\> unalias ddir

To remove all the aliases:

     c:\> unalias *

To remove all the aliases that begin with "DD":

     [c:\] unalias dd*

If you keep aliases in a file that can be loaded with the 595ALIAS /R
command, you can remove the aliases by using the UNALIAS /R command with the
same file name:

     c:\> unalias /r alias.lst

This is much faster than removing each alias individually in a batch file,
and can be more selective than using UNALIAS *.

Options

!INDENT 5 5 0 5
     /Q:  (Quiet) Prevents UNALIAS from displaying an error message if one or
     more of the aliases does not exist.  This option is most
     useful in batch files, for removing a group of aliases when
     some of the aliases may not have been defined.

     /R:  (Read) Read the list of aliases to remove from a file.  The file
     format should be the same format as that used by the 595ALIAS /R
     command.  You can use multiple files with one UNALIAS /R command by
     placing the names on the command line, separated by spaces:

!INDENT 5 5 5 5
          c:\> unalias /r alias1.lst alias2.lst
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 699 UNFUNCTION
!TTY

Purpose:  Remove user-defined variable functions.

Format:   UNFUNCTION [/Q /R file] [function...]
               or
          UNFUNCTION *

          function:  One or more functions to remove from memory.
          file:      One or more files to read for function definitions.

          /Q(uiet)                    /R(ead file)
!TTY

See also: 696FUNCTION.

Usage

4DOS maintains a list of the 241variable functions that you have
defined.  The UNFUNCTION command will remove user-defined definitions
from that list.  UNFUNCTION supports wildcards in the function name,
and you can remove one or more functions by name, or you can delete
the entire function list by using the command UNFUNCTION *.

Options

!INDENT 5 5 0 5
     /Q:  (Quiet) Prevents UNFUNCTION from displaying an error message if
     one or more of the functions does not exist.  This option is most
     useful in batch files, for removing a group of variable functions
     when some of them may not have been defined.

     /R:  (Read) Read the list of function names to remove from a
     file.  The file format should be the same format as that used by
     the 696FUNCTION /R command.  You can use multiple files with
     one UNFUNCTION /R command by placing the names on the command
     line, separated by spaces:

!INDENT 5 5 5 5
          c:\> unfunction /r func1.lst func2.lst
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 679 UNLOCK
!TTY

Purpose:  Unlock a disk drive to disable exclusive access under Windows.

Format:   UNLOCK [drive: ...]

          drive:  The drive or list of drives to unlock.
!TTY

See also: 642LOCK.

Usage

UNLOCK is only available when running under 4DOS under Windows 95/98/ME.

UNLOCK unlocks the specified drive(s), reversing the effects of LOCK and
allowing other sessions to access the drive(s).  See the warning under
642LOCK before using these commands.

If no drives are specified, 4DOS will attempt to unlock all drives.
;---------------------------------------------------------------------------
!TOPIC 680 UNSET
!TTY

Purpose:  Remove variables from the environment.

Format:   UNSET  [/M /Q /R file...] name...
               or
          UNSET *

          name:  One or more variables to remove from the environment.
          file:  One or more files containing variable definitions.

          /M(aster environment)       /R(ead from file)
          /Q(uiet)
!TTY

See also: 622ESET and 663SET.

Usage

UNSET removes one or more variables from the environment.  UNSET supports
wildcards in the variable name, and you can remove one or more variables by
name.  You can delete all environment variables with the command UNSET *.

For example, to remove the environment variable CMDLINE:

     c:\> unset cmdline

To remove all of the environment variables:

     c:\> unset *

To remove all the variables that begin with "P":

     [c:\] unalias P*

UNSET can be used in a batch file, in conjunction with the 665SETLOCAL and
621ENDLOCAL commands, to clear the environment of variables that may
cause problems for applications run from that batch file.

For more information on environment variables, see the 663SET command and
the general discussion of the 131environment.

Use caution when removing environment variables, and especially when
using UNSET *.  Many programs will not work properly without certain
environment variables; for example, 4DOS itself depends on 138PATH and
134COMSPEC.

Options

!INDENT 5 5 0 5
     /M:  (Master) Remove the variable from the master environment rather
     than the local environment.  This option is only useful in secondary
     shells.

     /Q:  (Quiet) Prevents UNSET from displaying an error message if one or
     more of the variables does not exist.  This option is most
     useful in batch files, for removing a group of variables
     when some of the variables may not have been defined.

     /R:  (Read) Read environment variables to UNSET from a file.  This
     is much faster than using multiple UNSET commands in a batch file, and
     can be more selective than UNSET *.  The file format should be the same
     format as that used by the 663SET /R command.  If there is no filename
     argument and input is redirected, UNSET /R will read from stdin.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 681 VER
!TTY

Purpose:  Display 4DOS and operating system versions.

Format:   VER [/R]

          /R(evision level)
!TTY

Usage

Version numbers consist of a one-digit major version number, a separator, and
a one- or two-digit minor version number.  VER uses the default decimal
separator defined by the current country information.
VER command will automatically detect the operating system name and
version number.  For example:

     c:\> ver

     4DOS 7.00   Windows 98 4.10

VER uses the default decimal separator defined by the current country
information.

Option

!INDENT 5 5 0 5
     /R:  (Revision level):  Display the 4DOS and OS internal revision
     levels (if any), your 4DOS serial number and registered name, and
     whether DOS is loaded into the high memory area (HMA), is
     resident in ROM, or is in normal base memory.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 682 VERIFY
!TTY

Purpose:  Enable or disable disk write verification or display the
          verification state.

Format:   VERIFY [ON | OFF]
!TTY

Usage

DOS maintains an internal verify flag.  When the flag is on, DOS attempts
to verify each disk write by making sure that the data written to the disk
can be read back successfully into the computer.  It does not compare
the data in memory with the data actually placed on disk to fully verify the
disk write process.

If used without any parameters, VERIFY will display the state of the verify
flag:

     c:\> verify
     VERIFY is OFF

VERIFY is off when the system boots up.  Once it is turned on with the
VERIFY ON command, it stays on until you use the VERIFY OFF command or
until you reboot.

Verification will slow your disk write operations slightly (the effect is
not usually noticeable).
;---------------------------------------------------------------------------
!TOPIC 683 VOL
!TTY

Purpose:  Display disk volume label(s).

Format:   VOL [d:] ...

          d:  The drive or drives to search for labels.
!TTY

Usage

Each disk may have a volume label, created when the disk is formatted or
with the external LABEL command.  Also, every floppy disk formatted with DOS
version 4.0 or above, OS/2, or the 25Windows NT line has a volume serial
number.

The VOL command will display the volume label and, if available, the volume
serial number of a disk volume.  If the disk doesn't have a volume label,
VOL will report that it is "unlabeled."  If you don't specify a drive, VOL
displays information about the current drive:

     c:\> vol
     Volume in drive C: is MYHARDDISK

If available, the volume serial number will appear after the drive label or
name.

To display the disk labels for drives A and B:

     c:\> vol a: b:
     Volume in drive A: is unlabeled
     Volume in drive B: is BACKUP_2
;---------------------------------------------------------------------------
!TOPIC 684 VSCRPUT
!TTY

Purpose:  Display text vertically in the specified color.

Format:   VSCRPUT  row col [BRIght] [BLInk] fg ON [BRIght] bg text

          row:   Starting row number.
          col:   Starting column number.
          fg:    Foreground text color.
          bg:    Background text color.
          text:  The text to display.
!TTY

See also: 661SCRPUT.

Usage

VSCRPUT writes text vertically on the screen rather than horizontally.  Like
the SCRPUT command, it uses the colors you specify to write the
text.  VSCRPUT can be used for simple graphs and charts generated by batch
files.  See 892Colors and Color Names for details about colors and notes
on the use of bright background colors.

The row and column are zero-based, so on a standard 25 line by 80 column
display, valid rows are 0 - 24 and valid columns are 0 - 79.  VSCRPUT checks
for a valid row and column, and displays a "Usage" error message if either
value is out of range.

You can also specify the row and column as offsets from the current cursor
position.  Begin the value with a plus sign [+] to move down the specified
number of rows or to the right the specified number of columns before
displaying text, or with a minus sign [-] to move up or to the left.

If you specify 999 for the row, VSCRPUT will center the text
vertically on the display.  If you specify 999 for the column,
VSCRPUT will center the text horizontally.

VSCRPUT normally does not move the cursor when it displays the text.  However,
if you have set 572OutputBIOS to Yes in 4DOS.INI, VSCRPUT will leave the
cursor at the end of the displayed text.

The following batch file fragment displays an X and Y axis and labels them:

     cls bright white on blue
     drawhline 20 10 40 1 bright white on blue
     drawvline 2 10 19 1 bright white on blue
     scrput 21 20 bright red on blue X axis
     vscrput 8 9 bright red on blue Y axis

VSCRPUT normally writes text directly to the screen.  If you have anpresses any other key:

     inkey Enter a keystroke: %%key
     switch %key
     case A
        echo It's an A
     case B .or. C
        echo It's either B or C
     default
        e85 WHICH
!TTY

Purpose:  Display the command type and what it would execute.

Format:   WHICH command ...

          command:  One or more commands or filenames to query.
!TTY

Usage

WHICH displays information about internal and external commands, aliases,
files, and executable extensions.  The information it reports depends on
the type of command or file you specify.  For example:

     [c:\] which cdd buildtree test.btm test.exe donothing
     CDD is an internal command
     buildtree is an alias : cdd /s
     test.btm is a batch file : C:\test.btm
     test.exe is an external : C:\test.exe
     donothing is an unknown command

If a filename includes white space or special characters, it must be
enclosed in double quotes.

If the command is an abbreviated alias, WHICH will display the full name.
;---------------------------------------------------------------------------
!TOPIC 686 Y
!TTY

Purpose:  Copy standard input to standard output, and then copy the
          specified file(s) to standard output.

Format:   Y file ...

          file:  The file or list of files to send to standard output.
!TTY

See also: 670TEE, 052piping and 051redirection.

Usage

The Y command copies input from standard input (usually the keyboard) to
standard output (usually the screen).  Once the input ends, the named files
are appended to standard output.

For example, to get text from standard input, append the files MEMO1 and
MEMO2 to it, and send the output to MEMOS:

     c:\> y memo1 memo2 > memos

The Y command is most useful if you want to add redirected data to the
beginning of a file instead of appending it to the end.  For example, this
command copies the output of DIR, followed by the contents of the file
DIREND, to the file DIRALL:

     c:\> dir | y dirend > dirall

If you are typing at the keyboard to produce input text for Y, you must
enter a Ctrl-Z to terminate the input.
;---------------------------------------------------------------------------
; Command equates ----------------------------------------------------------
!TOPIC 688 =601 CHDIR
!TOPIC 691 =609 ERASE
!TOPIC 692 =639 LOADHIGH
!TOPIC 693 =644 MKDIR
!TOPIC 694 =655 RMDIR
!TOPIC 695 =658 RENAME
!TOPIC 700 =669 Case:  SWITCH keyword
!NOINDEX
!TOPIC 701 =669 Default:  SWITCH keyword
!NOINDEX
!TOPIC 702 =669 Endswitch:  SWITCH keyword
!NOINDEX
!TOPIC 705 =703 KSTACK.COM
!NOINDEX
!TOPIC 706 =704 BATCOMP.EXE
!NOINDEX
!TOPIC 707 =615 Iterate:  DO keyword
!NOINDEX
!TOPIC 708 =615 Leave:  DO keyword
!NOINDEX
!TOPIC 709 =615 Enddo:  DO keyword
!NOINDEX
!TOPIC 710 =634 Else:  IFF keyword
!NOINDEX
!TOPIC 711 =634 Elseiff:  IFF keyword
!NOINDEX
!TOPIC 712 =634 Endiff:  IFF keyword
!NOINDEX
!TOPIC 713 =671 Endtext:  TEXT keyword
!NOINDEX
;---------------------------------------------------------------------------
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 719 Error Messages
!NOINDEX

This section lists error messages generated by 4DOS, and includes a
recommended course of action where appropriate.

Error messages relating to files are generally reports
of 218errors returned by DOS.  You may find some of these messages
(for example, "Access denied") vague enough that they are not always
helpful.  4DOS includes the file name
in file error messages, but is often unable to determine a more accurate
explanation of these errors.  The message shown is the best information
available based on the error codes returned by DOS.

For some errors you are instructed to "restart the session or reboot the
system."  This means that you should attempt to correct the error by
closing and restarting the current session under Windows, OS/2, or a DOS
task switcher or multitasker.  Under DOS without a multitasker or task
switcher, you will probably have to reboot the system to correct the problem.

The following list includes all error messages, in alphabetical order:

!INDENT 5 0 5 0
4DOS.HLP file is out of date, please update it:  Your copy of 4DOS.HLP
appears to be one from an earlier version of 4DOS.  Check the date and
time on 4DOS.HLP.  Also check the 384InstallPath setting (if any) in
4DOS.INI, it may point to an old directory.

4DOS internal stack overflow:  You attempted to nest batch files or
commands like 615DO, 623EXCEPT, 626FOR, 633IF,
634IFF, 628GLOBAL, or 662SELECT too deep, and 4DOS ran
out of stack space.  Restructure your command, alias, or batch file, or use
the 648OPTION command or the 574StackSize directive in 4DOS.INI to
increase the internal stack size.

4DOS initialization error --:  An error occurred during the 4DOS
startup process.  Look up the rest of the message in this list for a more
specific explanation.

4DOS server error --:  An error occurred in communication between
4DOS's resident and transient portions.  A more specific error message
follows (the additional error message can be looked up in this list).

4DOS swapping failed, loading in non-swapping mode:  None of the
swapping options worked, so 4DOS loaded in non-swapping mode, which
requires about 245K more memory than swapping mode.  Check your Swapping
specification with the 648OPTION command or in 4DOS.INI, and/or free some
XMS or EMS memory or disk space.

4DOS unrecoverable error XX:  An error occurred in the resident portion
of 4DOS.  These errors will terminate secondary shells and, and may require
you to reboot the system or restart the session if they occur during a
primary shell or if 4DOS cannot continue.  The error codes are:

     BI     Bad function code.
     DI     Same as Disk swap file corrupted.
     DR     Same as Swap file read error.
     DS     Same as Swap file seek error.
     EI     Same as EMS mapping error.
     NS     No number for new shell.  You have started too many 4DOS
            secondary shells without properly exiting some of them,
            perhaps by closing DESQview windows rather than EXITing.
            Clean up any work in process and reboot the system or
            restart the session.
     PT     Illegal process termination.
     TS     Terminated inactive shell.
     XI     Same as XMS move failed.

Access denied:  You tried to write to or erase a read-only file, rename
a file or directory to an existing name, create a directory that already
exists, remove a read-only directory or a directory with files or
subdirectories still in it, or access a file in use by another program in a
multitasking system.

Address table missing:  Your 4DOS.COM file is invalid.  If you used an
executable file compression program on 4DOS.COM, the compression may not be
compatible with 4DOS.  Re-install 4DOS.COM from diskette, or download a new
copy.

Alias loop:  An alias refers back to itself either directly or
indirectly (i.e., a = b = a), or aliases are nested more than 16 levels
deep.  Correct your alias list.

Already excluded files:  You used more than one exclude range in a
command.  Combine the exclusions into a single range.

Attempt to exit from root shell:  Another program has probably
destroyed a portion of 4DOS's memory.  Reboot the system or restart the
session.

AUTOEXEC parameters too long, discarded:  The full pathname and
parameter list for AUTOEXEC.BAT was over 254 characters.  This is
usually due to data in the 375AutoExecPath and/or
374AutoExecParms directive in 4DOS.INI.  Reduce the amount of
data and reboot.

Bad environment:  The DOS environment has a bad structure, probably
because a program destroyed 4DOS's master environment space.  Reboot the
system or restart the session.

Batch file missing:  4DOS can't find the batch (.BAT) file it was
running.  It was either deleted, renamed, moved, or the disk was
changed.  Correct the problem and rerun the file.

Cannot locate 4DOS directory:  4DOS cannot find its own directory.
Check the 134COMSPEC path on the SHELL line in CONFIG.SYS (see
352Startup and Command Line Options for details).  Also check the
384InstallPath setting (if any) in 4DOS.INI -- it may point to an old
directory which no longer contains a complete set of 4DOS files.

Can't close tray:  4DOS can't close the tray of the specified drive,
because it was not recognized as a valid CD-ROM or DVD drive letter.
Specify a valid CD-ROM or DVD drive letter, followed by a semicolon.

Can't copy file to itself:  You cannot COPY or MOVE a file to itself.
4DOS attempts to perform full path and filename expansion before copying to
help ensure that files aren't inadvertently destroyed.

Can't create:  4DOS can't create the specified file.  The disk may be
full or write protected, or the file already exists and is read-only, or
the root directory is full.

Can't delete:  4DOS can't delete the specified file or directory.  The
disk is probably write protected.

Can't eject media:  4DOS can't eject the disc in the specified drive,
because it was not recognized as a valid CD-ROM or DVD drive letter.
Specify a valid CD-ROM or DVD drive letter, followed by a semicolon.

Can't get directory:  4DOS can't read the directory.  The disk drive is
probably not ready.

Can't make directory entry:  4DOS can't create the filename in the
directory.  This is usually caused by a full root directory.  Create a
subdirectory and move some of the files to it.

Can't open:  4DOS can't open the specified file.  Either the file
doesn't exist or the disk directory or File Allocation Table is damaged.

Can't remove current directory:  You attempted to remove the current
directory, which DOS does not allow.  Change to the parent directory and
try again.

Can't set up disk swap file:  The disk swap file
you specified cannot be opened.  The path or drive is invalid, the disk is
full, DOS is out of file handles, or there is a hardware problem.  Use the
648OPTION command or check 4DOS.INI to be sure your 391Swapping
directive is correct.

CD-ROM door open or CD-ROM not ready:  The CD-ROM (DVD) drive
door is open, the power is off, or the drive is disconnected.  Correct the
problem and try again.

CD-ROM not High Sierra or ISO 9660:  The CD or DVD is not recognized as a
data CD (it may be a music CD).  Put the correct CD or DVD in the drive and
try again.

Clipboard is empty or not text format:  You tried to retrieve some text
from the Windows clipboard, but there is no text available.  Correct the
contents of the clipboard and try again.

Clipboard is in use by another program:  4DOS could not access the Windows
or OS/2 clipboard because another program was using it.  Wait until the
clipboard is available, or complete any pending action in the other program,
then try again.  You may also receive this error if you attempt to use the
clipboard in the 025Windows NT line, which does not provide this
functionality to DOS programs.

Command line too long:  A single command exceeded 511 characters, or
the entire command line exceeded 511 characters during alias and variable
expansion.  Reduce the complexity of the command or use a batch file.  Also
check for an alias which refers back to itself either directly or
indirectly.

Command only valid in batch file:  You have tried to use a batch file
command, like DO or GOSUB, from the command line or in an alias.  A few
commands can only be used in batch files (see the individual commands for
details).

Command tail too long, truncated:  A program attempted to pass a
command in an improper format or a command longer than 126 characters to a
4DOS secondary shell.  This is probably a bug in the program from which
4DOS was loaded.  Contact the author of the program for technical assistance.

Contents lost before copy:  COPY was appending files, and found one of
the source files is the same as the destination.  That source file is skipped,
and appending continues with the next file.

Data error:  DOS can't read or write properly to the device.  On a
floppy drive, this error is usually caused by a defective floppy disk,
dirty disk drive heads, or a misalignment between the heads on your drive
and the drive on which the disk was created.  On a hard drive, this error
may indicate a drive that is too hot or too cold, or a hardware problem.
Retry the operation; if it fails again, correct the hardware or diskette
problem.

Data segment too large, truncating alias / history lists:  The
total amount of space required for aliases, history, directory
history, and the 4DOS stack exceeded the space available.  Reduce
the values of the corresponding directives in 4DOS.INI and then
reboot the system or restart the session.

Device not ready:  The specified device can't be accessed.

Directory stack empty:  POPD or DIRS can't find any entries in the
directory stack.

Disk swap file corrupted:  The 4DOS disk swapping file (4DOSSWAP.nnn or
xxxxxxxx.4SW) has been moved, deleted, or damaged by another program.
Reboot the system or restart the session.

Divide by zero:  The command or function you used tried to do a
division by zero.  Rearrange the expression, or pre-validate the input
numbers, to prevent the zero in the divisor.

Duplicate redirection:  You tried to redirect standard input, standard
output, or stand error more than once in the same command.

EMS deallocation failed:  4DOS can't deallocate EMS memory when exiting
from a secondary shell.  The EMS map has been corrupted or the memory area
used by 4DOS or the EMS driver has been destroyed by a program.  Clean up
any work in process and reboot the system or restart the session.

EMS mapping failed:  4DOS can't map EMS pages when swapping to or from
EMS.  The EMS map has been corrupted or the memory area used by the loader
or the EMS driver has been destroyed by a program.  Reboot the system or
restart the session.

Encrypted batch files require the runtime version:  Encrypted
batch files cannot be run under the regular command line version of
4DOS, the runtime version is required.  Run the file under the
runtime product, or obtain an unencrypted version from the author.

Environment already saved:  You have already saved the environment with
a previous 665SETLOCAL command.  You cannot nest SETLOCAL / ENDLOCAL
pairs.

Error in command-line directive:  You used the //iniline option to
place a 4DOS.INI directive on the secondary shell command line or on
the SHELL= line in CONFIG.SYS (see 352Startup and Command Line Options),
but the directive is in error.  Usually, a more specific error message
follows, and can be looked up in this list.

Error on line [nnnn] of [filename]:  There is an error in
3514DOS.INI.  The following message explains the error in more
detail.  Correct the line in error and restart 4DOS for your change to take
effect.

Error reading:  DOS experienced an I/O error when reading from a
device.  This is usually caused by a bad disk, a device not ready, or a
hardware error.

Error writing:  DOS experienced an I/O error when writing to a device.
This is usually caused by a full disk, a bad disk, a device not ready, or a
hardware error.

Exceeded batch nesting limit:  You have attempted to nest batch files
more than 10 levels deep.

Fatal error -- reboot the system or restart the session:  4DOS cannot
continue due to the previous error.  Reboot the system or restart the
session.

Fatal error, some directives may not have been processed:  An I/O error
occurred while reading your 4DOS.INI file.  There may be a physical problem
with data on the disk or a sharing error on a multitasking system.  Check
your 4DOS.INI file and try again.

File Allocation Table bad:  DOS  can't access the FAT on the specified
disk.  This can be caused by a bad disk, a hardware error, or an unusual
software interaction.

File exists:  The requested output file already exists, and 4DOS won't
overwrite it.

File is empty:  You attempted to use an empty file in 318@SELECT.  Correct
the file name or contents and try again.

File not found:  4DOS couldn't find the specified file.  Check the
spelling and path name.

General failure:  This is usually a hardware problem, particularly a
disk drive failure or a device not properly connected to a serial or
parallel port.  Try to correct the problem, or reboot and try again.  Also
see Data error above.

I/O error in [filename], some directives may not have been processed:
An I/O error occurred while reading 3514DOS.INI.  There may be a
physical problem with data on the disk or a sharing error on a multitasking
system.  Check your 4DOS.INI file and try again.

IDLE is disabled:  The BatteryMAX ($IDLE$) device driver has not been
installed.

Include file not found:  You used the Include directive in the 4DOS.INI
file, but the file you specified was not found or could not be opened.

Include files nested too deep:  You used the Include directive in the
4DOS.INI file, and attempted to nest include files more than three levels
deep.

Infinite COPY or MOVE loop:  You tried to 606COPY or
646MOVE a directory to one of its own subdirectories and used the /S
switch, so the command would run forever.  Correct the command and try
again.

Insufficient disk space:  606COPY or 646MOVE ran out of
room on the destination drive.  Remove some files and retry the operation.

Insufficient load space:  There is not enough room in 4DOS's internal
memory areas to include all of the options you requested in
3514DOS.INI.

Internal DOS error:  DOS encountered an internal bug and failed. Reboot
the system.

Invalid AUTOEXEC filename:  You specified an invalid path or filename
for the AUTOEXEC file with the /P: startup switch, or with the DOS_AUTOEXEC
setting in an OS/2 DOS session.  The default name will be used instead.
Correct the filename, then reboot the system or restart the session.

Invalid batch file:  The batch file is corrupted or improperly
115compressed or encrypted.  Retry with a new copy of the file.

Invalid character value:  You gave an invalid value for a character
directive in 3514DOS.INI.

Invalid choice value:  You gave an invalid value for a "choice"
directive (one that accepts a choice from a list, like "Yes" or "No") in
3514DOS.INI.

Invalid color:  You gave an invalid value for a color directive in
3514DOS.INI.

Invalid count:  The character repeat count for 638KEYSTACK is incorrect.

Invalid date:  An invalid date was entered.  Check the syntax and
reenter.

Invalid directive name:  4DOS can't recognize the name of a directive
in 3514DOS.INI.

Invalid DOS version:  You need a newer version of DOS to execute the
specified command.

Invalid drive:  A bad or non-existent disk drive was specified.

Invalid .INI file path or name, file not processed:  The path or name
for the initialization file on the SHELL= line in CONFIG.SYS, or on the
startup command line, is invalid.  Correct the @d:\path\inifile option
to name the correct file.

Invalid key name:  You tried to make an invalid 481key
substitution in 4DOS.INI, or you used an invalid key name in a keystroke
595alias or command.  Correct the error and retry the operation.

Invalid media type:  DOS can't read the disk.  Either the disk is bad, or
it has been formatted by a different operating system.  Reformat it as a DOS
disk.  Also see Data error above; the problems described there can
sometimes cause a non-DOS disk error rather than a data error.

Invalid numeric value:  You gave an invalid value for a
numeric directive in 3514DOS.INI.

Invalid parameter:  4DOS didn't recognize a parameter.  Check the
syntax and spelling of the command you entered.

Invalid path:  The specified path does not exist.  Check the disk
specification and/or spelling.

Invalid path or file name:  You used an invalid path or filename in a
directive in 3514DOS.INI.

Invalid startup switch, ignored:  You passed 4DOS an invalid option on
the SHELL= line in CONFIG.SYS or on the startup command line for a
secondary shell.  Correct the switch.

Invalid Swapping option or path:  The swap type or disk swap path in
the 4DOS.INI 391Swapping directive is invalid.  4DOS ignores the bad
swap type or path and attempts to scan the rest of the Swapping
specification for a valid option.  Multiple errors in the Swapping
directive will cause this message to repeat.  Use the 648OPTION command
or an editor to check the Swapping setting in 4DOS.INI, then reboot
the system or restart the session.

Invalid time:  An invalid time was entered.  Check the syntax and
reenter.

Invalid unit:  Generally caused by a disk drive hardware failure.

Keystroke substitution table full:  4DOS ran out of room to store
481keystroke substitutions entered in 4DOS.INI.  Reduce the number of
key substitutions.

KSTACK.COM not loaded:  You attempted to execute a 638KEYSTACK
command without loading KSTACK.COM.  See the KEYSTACK command for more
information.

Label not found:  A GOTO or GOSUB referred to a non-existent label.
Check your batch file.

Memory [allocation | deallocation] error:  4DOS can't allocate or
deallocate memory while loading, or while reserving or releasing memory for
internal use.  DOS memory allocation has been corrupted, or another
application has reserved memory incorrectly.  Reboot the system or restart
the session.

Memory destroyed:  The DOS memory control blocks have been corrupted.
Reboot the system or restart the session.

Missing ENDTEXT:  A 671TEXT command is missing a matching
ENDTEXT.  Check the batch file.

Missing GOSUB:  4DOS cannot perform the 659RETURN command in a
batch file.  You tried to do a RETURN without a 629GOSUB, or your
batch file has been corrupted.

Missing SETLOCAL:  An ENDLOCAL was used without a matching SETLOCAL.

No aliases defined:  You tried to display aliases but no aliases have
been defined.

No closing quote:  4DOS couldn't find a second matching back-quote
[`] or double-quote ["] on the command line.

No expression:  The expression passed to the %@EVAL variable function
is empty.  Correct the expression and retry the operation.

No file handle available:  This is an internal 4DOS disk swapping
error.  Change to another swapping method if possible.

No room for .INI file name:  4DOS does not have enough space to pass the
name of 3514DOS.INI to secondary shells; see String area overflow
for more details.  Any [Secondary] section in 4DOS.INI will be ignored in
secondary shells until the problem is corrected and the system or session
is restarted.

No UMBs; loading low:  The 639LOADHIGH (or LH) command can't find
any UMBs for your program.  The program is loaded into base memory.  LH and
LOADHIGH only work with MS-DOS 5.0 and above, when the DOS=UMB directive is
included in CONFIG.SYS and sufficient upper memory space is available for
the program.

No upper memory available, low memory will be used for [resident portion
| master environment | global aliases | global history | global directory
history]:  You asked 4DOS
to load the block of memory named in the message into a UMB via the
corresponding directive in 4DOS.INI (398UMBLoad,
395UMBEnvironment, 393UMBAlias, or 397UMBHistory), but no
UMB was available.  Check that your XMS driver is properly installed and/or
free up some UMB space in use by another program.

Not a directory:  The name passed to 655RD is not a directory.

Not an alias:  The specified alias is not in the alias list.

Not in environment:  The specified variable is not in the environment.

Not in swapping mode:  You attempted to turn swapping on or off with
the 668SWAPPING command, but 4DOS is loaded in non-swapping mode.

Not ready:  The removable disk drive door is open or the disk is not
fully inserted.  Close the door or fully insert the disk and try again.

Not same device:  This error usually appears in RENAME.  You cannot
rename a file to a different disk drive.

Out of environment/alias space:  4DOS has run out of space for
environment variables or aliases.  Edit the SHELL line in
352CONFIG.SYS or the 377Environment directive in 4DOS.INI to
increase the environment size, or the 373Alias directive in 4DOS.INI
to increase the alias list size.

Out of memory:  4DOS or DOS had insufficient memory to execute the last
command, or the memory control blocks have been destroyed.  If this error
occurs in a 4DOS secondary shell, return to the primary shell before
running the command.  Otherwise, try to free some memory by removing
memory-resident programs.

If the base memory (DOS RAM) figures reported by MEMORY are unreasonable,
the memory control blocks have probably been destroyed and you must reboot
the system or restart the session.  If you receive this error from DIR when
MEMORY shows sufficient memory for the directory you are displaying, memory
has probably been "fragmented," and contains a free area larger than 12K but
not large enough for the entire directory.  Use a memory mapping program
like PMAP, MAPMEM, or the DOS MEM utility to locate the fragmentation, and
experiment with your TSRs and applications to determine and remove its
cause.

Overflow:  An arithmetic overflow occurred in the 263@EVAL variable
function.  Check the values being passed to @EVAL.  @EVAL can handle 20
digits to the left of the decimal point and 10 to the right.

Primary shell uses disk swapping, settings will not be inherited:
You specified disk swapping for the primary shell (loaded in
CONFIG.SYS) under Windows 95/98.  This informational message tells
you that primary shell options, aliases, etc. will not be passed on
to secondary shells.  See the 391Swapping directive in 4DOS.INI for
additional information.

Printer out of paper error:  DOS detected an out-of-paper condition on one
of the printers.  Check your printer and add paper if necessary.

Read fault error:  DOS encountered a disk read error; usually caused by a
bad or unformatted disk.  Also see Data error above.

Region unavailable, using first available region for [resident portion |
master environment | global aliases | global history | global directory
history]:  You used a
3514DOS.INI directive to load the block of memory named in the
message into a specific UMB region, but that region was unavailable.  Check
the use of upper memory for device drivers and other programs loaded before
4DOS, and/or change the requested region number.

Sector not found:  BIOS disk error, usually caused by a bad or
unformatted disk.  Also see Data error above.

Seek error:  DOS can't seek to the proper location on the disk.  This
is generally caused by a bad disk or drive.  Also see Data error above.

Sharing violation:  You tried to access a file in use by another
program in a multitasking system or on a network.  Wait for the file to
become available, or change your method of operation so that another
program does not have the file open while you are trying to use it.

Specified .INI file not found:  The file specified with the @inifile
option on the 4DOS command line does not exist.

String area overflow:  4DOS ran out of room to store the text from
string directives in 3514DOS.INI.  Reduce the complexity of 4DOS.INI.

Swap file [seek | read | write] failed:  4DOS encountered an I/O error
while accessing the disk swap file (4DOSSWAP.nnn or xxxxxxx.4SW).  The disk
was changed, the file has been destroyed by a program, or 4DOS's memory
area has been overwritten by another program.  Reboot the system or restart
the session.

Syntax error:  A command or 241variable function was entered in
an improper format.  Check the syntax and correct the error.

Syntax error in region number or size:  You specified an invalid region
number or size in the 639LH / LOADHIGH command.  Correct the command.

Too many SETs in CONFIG.SYS:  The SET commands in your DR-DOS
CONFIG.SYS file exceeded the size of 4DOS's buffer area.  Reduce
the length of the commands.

Too many open files:  The operating system has run out of file handles.
Try increasing the FILES setting in CONFIG.SYS.

Unbalanced parentheses:  The number of left and right parentheses did
not match in an expression passed to the @EVAL variable function.  Correct
the expression and retry the operation.

Unknown command:  A command was entered that 4DOS didn't recognize and
couldn't find in the current search path.  Check the spelling or 138PATH
specification.  You can handle unknown commands with the UNKNOWN_CMD alias
(see 595ALIAS).

UNKNOWN_CMD loop:  The UNKNOWN_CMD alias (see 595ALIAS) called
itself more than ten times.  The alias probably contains an unknown command
itself, and is stuck in an infinite loop.  Correct the alias.

Variable loop:  A nested environment variable refers to itself, or
variables are nested more than 16 deep.  Correct the error and retry the
command.

Write fault error:  DOS encountered a disk write error; usually caused by
a bad or unformatted disk.  Also see Data error above.

Write protect error:  The disk cannot be written to.  Check the disk
and remove the write-protect tab or close the write-protect window if
necessary.

XMS deallocation failed:  4DOS could not deallocate XMS memory when
exiting a secondary shell.  XMS memory has been destroyed; reboot the
system or restart the session.

XMS move failed:  4DOS could not move data between base memory and XMS
memory while swapping itself.  XMS memory has been destroyed; reboot the
system or restart the session.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 720 Troubleshooting
!NOINDEX

These topics may help you to solve problems you are having with 4DOS:

     751Compatibility
     752Troubleshooting Compatibility Problems
     112Debugging Batch Files

Note that support is not offered for this 731free release of 4DOS.
;---------------------------------------------------------------------------
!TOPIC 731 Unsupported Free Version
!NOINDEX

JP Software does not offer technical support for this free version of 4DOS.
The best place to look for help is the comp.os.msdos.4dos Usenet newsgroup,
where other 4DOS users can respond.  The section on 720troubleshooting may
help you resolve compatibility and batch file issues on your own.

JP Software's advanced command processors for the 025Windows NT line,
204NT and Take Command, remain fully supported software.
;---------------------------------------------------------------------------
!TOPIC 732 Contacting JP Software
!NOINDEX

You can contact JP Software at the following addresses and numbers:

!NOWRAP
!INDENT 25 5 5 5
     Address             JP Software Inc.
!INDENT 25 25 25 5
                         12501 Coopers Ln
                         Worton, MD 21678
                         USA

!INDENT 25 5 5 5
     Phone               +1-410-810-8818
     Fax                 +1-800-595-8197
     Internet            Web site: http://jpsoft.com
!INDENT 25 25 25 5
                         FTP site:  ftp://jpsoft.com
                           E-mail:  sales@jpsoft.com
!WRAP
!INDENT 0

Note that technical support is not provided for this 731free release of
4DOS.
;---------------------------------------------------------------------------
!TOPIC 751 Compatibility
!NOINDEX

This section provides information on using 4DOS with a variety of other
software products.  It is intended for use whenever you have a question
about using another product with 4DOS, or suspect a compatibility
problem.

Our most common compatibility questions concern operating environments
and networks.  For information on commonly used products, see:

     791Microsoft Windows 95/98/ME
     761DOS (includes MS-DOS, PC DOS, and the DR-DOS family)
     781Microsoft Windows 3.xx
     811IBM OS/2 Warp (also covers earlier versions of OS/2)
     821Novell NetWare

For all other products see:

     841Other Products

The following general comments apply to all of the compatibility
information included in this help system.

If you are having trouble with any other product you should review the
information here, and also check the discussion of 752Troubleshooting
Compatibility Problems for diagnostic techniques that may apply to your
situation.

Virtually all of your software will work with 4DOS with no
trouble.  Inclusion of a product here does NOT mean there are compatibility
problems with it!  It only indicates that we have some information that
may be useful to you when you use the product with 4DOS.

We have made every effort to ensure that our compatibility information
is as accurate and up to date as possible.  Our information is based on
our own investigations, reports from 4DOS beta testers, technical
support calls, discussions with manufacturers of other products, and
reports from our customers.  Unfortunately, varying conditions between
systems or between software releases can easily invalidate the results
of previous tests.  Therefore we cannot guarantee that every item
included here is accurate for all systems or will remain accurate over
time; you may have to do your own testing to determine what works well
on your system with the software you own.
;---------------------------------------------------------------------------
!TOPIC 752 Troubleshooting Compatibility Problems
!NOINDEX

Any DOS program running on your computer can potentially interact with any
other program running at the same time.  Of course, most program interactions
are ones you want:  your print spooler intercepts printer output and saves it
to print later, or your disk cache intercepts disk requests and speeds them
up by retrieving data from memory.

If you've used the PC for any length of time, however, you'll know that you
can also get interactions you don't want.  If you load just the wrong
combination of TSRs and device drivers, your system may slow to a
crawl.  Perhaps you can't load your favorite Personal Information Manager with
Windows running.  And so on.

As publishers of a product that replaces part of the operating system, we're
very familiar with these issues -- not because 4DOS is more likely to cause
problems, but because it sometimes gets blamed first when a problem
appears.  Our technical support department has developed a set of reliable
techniques for finding out what's causing an apparent compatibility problem
with 4DOS and other software.

We are presenting these techniques here as a series of things to try when
there seems to be a compatibility problem.  Some may not make sense for the
particular problem you're investigating.  Others may not yield useful
results.  But as a group, they'll help you resolve many of the common
software interactions that do appear, whether with 4DOS or anything
else.  Before you get started, be sure to check 751Compatibility to see
if we've already solved the problem you're facing.

Some of our suggestions help you figure out what's going on, but aren't
intended to help you fix it.  For example, when we suggest that you remove
all your TSRs to look for the problem, we aren't suggesting that as a
permanent solution, but only as a diagnostic test.

The first thing to consider is whether the particular combination of software
that's not working used to work together.  If so, think carefully about what
you have changed and see if reversing the change solves the problem.  If it
does, then you can narrow your search, using the following techniques to find
out what it is about that specific change that is causing the problem.

Second, make sure that your problem can be reproduced relatively easily, and
make sure you know exactly what sequence of commands or other steps
reproduces it.  Most interactions are very easy to reproduce, but if you
think there's an interaction and it occurs once every 10 days, it's going to
be difficult to know when you have fixed it.  Also, the process of carefully
documenting how to reproduce a problem often helps you realize what the
problem is without further effort.

If you have a problem with a specific application hanging or working
improperly, and the above techniques don't help, then try reducing your
system configuration to the simplest possible level.  This is the single most
useful tool we know for finding compatibility problems.  To do so, use all of
the approaches listed below, and any other similar things you may be able to
think of about your particular system after reading our suggestions.  When
you're modifying 3514DOS.INI in an attempt to resolve problems, you may
find the 383INIQuery directive useful.  If you set INIQuery to Yes for a
section of 4DOS.INI, then 4DOS will prompt you for each line in that
section.  This allows you to test the effects of changing directives in the
.INI file without actually modifying the file for each test.

The troubleshooting approaches are divided into the categories:

!NOWRAP
     753Path Length
     754Environment Size
     755Testing for Interactions
     756Memory Allocation Conflicts
     757Memory Allocation and Microsoft Windows 3.xx
     758Advanced Configuration Options
!WRAP
;---------------------------------------------------------------------------
!TOPIC 753 Path Length
!NOINDEX

The first thing to do is to check the length of your 138PATH
variable.  4DOS lets you make it longer than the traditional limit
of 123 characters.  848Some programs can't handle long PATHs and may
behave strangely.  If your PATH is over the traditional limit,
reduce its size using the 649PATH, 622ESET, or 663SET command
and see if the application starts working.  If so, use a batch file
or alias to set up an alternate path for running that one program,
for example:

     setlocal
     path d:\myprog
     d:\myprog\myprog.exe
     endlocal

The 665SETLOCAL / 621ENDLOCAL pair saves and restores the environment;
when you're done, the old PATH will be restored automatically.
;---------------------------------------------------------------------------
!TOPIC 754 Environment Size
!NOINDEX

Next, check how much environment space is in use in your system.  The 4DOS
645MEMORY command reports the total environment space and the amount
free; a simple subtraction tells you how much is in use.  Some programs
simply don't work right if there's a lot of information in the environment
(these programs don't usually care how big the total environment space is,
only how much of it is actually in use).  In most cases, these problems show
up when the amount of space in use gets up to around 1K (1024) bytes or so,
but they can occur at any point.  To test for this, use the following simple
batch file:

     setlocal
     unset var1 var2 var3 ...
     [command to run the program in question]
     endlocal

where VAR1, VAR2, etc. are variables you can remove from the environment to
decrease the space in use before running the program.  If reducing the
environment space in use makes things work, contact the program's
manufacturer and report the problem; you have found a legitimate bug.  DOS
allows an environment of up to 32K bytes, and your program should be able to
work with an environment that large.  Until the manufacturer fixes the bug,
use the batch file above as a workaround.
;---------------------------------------------------------------------------
!TOPIC 755 Testing for Interactions
!NOINDEX

Before testing for software interactions, try booting your system with
COMMAND.COM, without changing anything else about your configuration (though
you may have to modify AUTOEXEC.BAT if it contains 4DOS-specific
commands).  If the problem remains, then it's not related to an interaction
with 4DOS.  Contact the manufacturer of the software that isn't working
properly to determine the cause of the problem.

To look for a multi-program interaction, you'll need to remove all the device
drivers and TSRs you possibly can and still have enough software present to
demonstrate the problem.  For example, you can't look for a network problem
if you don't load the network, but you probably can check it without your
disk cache running.  If you're running DOS, be sure you have a bootable
floppy disk handy before modifying your CONFIG.SYS and AUTOEXEC.BAT files to
remove drivers and TSRs.

If you run a partitioning disk driver, you probably can't remove it for
diagnostic purposes without temporarily losing access to some or all of your
hard disk.  The same may be true of disk compression programs like Stacker,
depending on the mode in which they are installed.  Most other device drivers
and TSRs can be removed without causing trouble.  Check your system and
software manuals if you are unsure of which programs can safely be removed.

Once you know what you can take out, don't skimp or guess where the
interaction might be.  Take out everything you possibly can from
CONFIG.SYS, 4START, and AUTOEXEC.BAT that loads or accesses another
program.  In CONFIG.SYS, remove all possible DEVICE and INSTALL
statements.  In AUTOEXEC.BAT, remove all the lines you can that load
memory-resident programs (and remember that some DOS utilities, like MODE,
can be memory-resident).

Of course, you should save copies of your configuration files before you
delete anything.  Better yet, use the REM command to remove lines temporarily
without deleting them.  REM can be used on any line in AUTOEXEC.BAT, in
4START, and in CONFIG.SYS if you are running DOS 4.0 or above.  (In earlier
DOS versions, REM will work in CONFIG.SYS but will also generate a harmless
"unrecognized command" message during bootup.)  If you want to remove
everything in AUTOEXEC.BAT you can rename it to another name (say
AUOTEXEC.SAV), and rename it back when you are done testing.

Clean out your configuration files all at once, not one line at a time.  If
that solves the problem, you're on the right track, and you can put the lines
back one at a time until you find the culprit.  If it doesn't solve the
problem, you won't waste time removing lines one by one.

If the problem isn't there under COMMAND.COM, try fiddling with the program's
configuration. If you were loading it high, try loading it low.  If you can
change the way it uses memory, try doing so.  If it's a driver that's used by
other programs (like your mouse driver) and is quite old, consider obtaining
an update from the manufacturer.  All of these techniques will help you
narrow down what it is about the program that's causing a problem.  Once you
have done that, you may have a simple workaround.

Some problems can be resolved by modifying the order in which you load
drivers and TSRs.  If you've found a problem with a particular driver or TSR,
if possible try loading it earlier or later than you were and see if the
problem goes away.

If you're running OS/2, the process of removing device drivers and TSRs is
usually simpler than under DOS.  You probably won't need to modify
CONFIG.SYS, but you may need to adjust the DOS Settings for the session in
which 4DOS is running (see 811IBM OS/2).  Try changing the amounts of
XMS, EMS, and DPMI memory available to the DOS session, removing drivers if
any are listed under DOS_DEVICE in your DOS Settings, and removing
memory-resident programs loaded in AUTOEXEC.BAT as described above.
;---------------------------------------------------------------------------
!TOPIC 756 Memory Allocation Conflicts
!NOINDEX

A memory allocation conflict is very simple.  It occurs when two (or more)
programs try to use the same memory, or when a program behaves differently
depending on where it is loaded in memory.  Inevitably, at least one of the
programs will operate incorrectly, report an error, or hang.  These conflicts
can be very hard to diagnose, because it's difficult to determine which
programs are actually causing the conflict, and the symptoms may appear to be
totally unrelated to the program responsible for the problem.

4DOS uses memory in a more complex way than COMMAND.COM.  It can use base,
XMS, or EMS memory, and store portions of itself and its data in UMBs (see
896How 4DOS Uses Memory for additional details).  COMMAND.COM does
not offer any of these capabilities.  This added complexity
makes it more likely that you'll encounter memory allocation conflicts with
4DOS.  This isn't because 4DOS is less reliable than other programs, it's
because the memory allocation conflict was there waiting to happen, and 4DOS
triggered it through its access to additional memory.

It's easy to check whether 4DOS's use of memory is a problem.  If you
configure 4DOS so that it swaps to disk, and disable all use of UMBs, then
4DOS uses only base memory, and (in terms of memory allocation) operates very
much like COMMAND.COM.  You can make this change in two simple steps.  First,
add a line containing the following 391Swapping directive to 4DOS.INI:

     Swapping = c:\

(change this if you prefer to swap to a different drive, but do not
use a RAM disk when you are testing for compatibility problems -- the RAM
disk itself could be part of the problem).  Second, remove any lines in
4DOS.INI which allocate UMBs (398UMBLoad, 395UMBEnvironment,
393UMBAlias, 396UMBFunction, and 397UMBHistory), or place a
semicolon at the start of such lines to temporarily turn them into comments.

If these steps solve the problem, you've found a memory allocation
conflict.  The next thing to do is remove all the drivers and TSRs you can
to see if you can determine where the conflict is.  For specific techniques,
see 754Environment Size.
;---------------------------------------------------------------------------
!TOPIC 757 Memory Allocation and Microsoft Windows 3.xx
!NOINDEX

If you use Microsoft Windows, there are some specific memory allocation
issues you need to consider.  When you run Windows 3.xx in 386
Enhanced mode, the Windows memory manager "takes over" from the
underlying DOS-based memory manager.  If the two programs don't see
memory in quite the same way, the conflict can produce some very
strange behavior.  For example, the same memory can be allocated
twice, or Windows can put portions of itself in areas that were
being used by 4DOS or your device drivers and TSRs. These problems
typically apply to upper memory, and not to EMS or XMS memory.  Any
of them can cause substantial difficulties in Windows DOS sessions.

To avoid such problems you need to systematically verify that Windows and
your memory manager are using the same information about upper memory.  You
can do so with this approach:

!INDENT 7 5 5 5
     * First, gather a list of all the areas of upper memory used by
     your hardware.  This may require consulting your hardware manuals.  Look
     for an explanation of the range of addresses used by each board,
     as a pair of 4-digit hexadecimal numbers, for example
     D400-D7FF. (Sometimes the addresses have a trailing zero, for example
     D4000-D7FF0.  In this case use only the first 4 digits.)  Some boards
     use no upper memory space at all.  Boards which may occupy space in upper
     memory include network interface cards, SCSI boards, sound cards, and
     scanner boards.  Some hard disk controllers and video boards also use
     upper memory space, including "Super VGA" and other high-resolution
     video boards.  Video boards may use different areas of upper memory
     depending on your display mode.  However, you don't usually need to
     consider the standard areas used by basic VGA boards.

     * Next, make sure you have excluded all the areas of upper memory
     from management by your memory manager.  The basic approach is to
     include a switch when you start up the memory manager, for example
     /X=D400-D7FF to exclude the range D400-D7FF.  See your memory manager
     documentation for the exact method.

     * Finally, locate the SYSTEM.INI file in your Windows directory.  Find
     the section of this file beginning [386Enh] and add an
     EMMExclude line to it for each range to be excluded, for example:

          EMMExclude=D400-D7FF

!INDENT 7 5 7 5
     The list in SYSTEM.INI should exactly match the exclude list
     given to your memory manager.
!INDENT 0

If this technique solves the problem, you're finished.  If not, also check
that any network you have installed is properly configured for
Windows.  Errors in network configuration under Windows may generate memory
allocation conflicts of their own, and can cause unusual behavior in Windows
DOS sessions even though the DOS sessions are not specifically accessing the
network.
;---------------------------------------------------------------------------
!TOPIC 758 Advanced Configuration Options
!NOINDEX

If none of the other techniques have proven useful, some of the
advanced directives in 4DOS.INI may help solve very rare configuration
problems.  However, unless you are an experienced DOS user and understand the
side effects of each directive, they should be used only as diagnostic tools
and not as a workaround or fix.  Any of the following can be tried for the
conditions indicated:

!INDENT 5 5 5 5
     568Inherit = No or 556Reduce = No:  If you have
     unexplained problems in starting secondary shells.

     436LineInput = Yes (or 664SETDOS /L1):  If you have
     memory-resident programs which do not recognize that you
     are at the prompt (see also 844Other Command Line Editors.)

     575SwapReopen = Yes:  If an application or network generates
     reproducible errors related to the 4DOS swap file (for example "Swap
     file seek failed" or similar errors).
;     555 MaxLoadAddress
;     557ReserveTPA            Control shell memory allocation
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 761 DOS
!NOINDEX

This section covers compatibility questions that may arise when running
4DOS with various versions of DOS, including external DOS programs.  Most of
the information here covers unusual situations and/or old versions of DOS,
and will not be needed by most users.

For information on MS-DOS 7.0, 7.10, or 8.0 (distributed with
Windows 95/98/ME), see 791Microsoft Windows 95/98/ME.

For information specific to DR-DOS (including PalmDOS, Novell DOS, or
Caldera OpenDOS), see 773DR-DOS family.

For information on other DOS-related topics, see:

     762Running 4DOS along with COMMAND.COM
     763Executing DOS Commands from Applications
     764APPEND
     135COPYCMD Variable
     765DBLSPACE and DRVSPACE
     136DIRCMD Variable
     766FASTOPEN
     767FORMAT /S and SYS
     16DOS HELP Command
     769MEMMAKER
     770DOS MOVE Command
     116REXX Support
     771DOS SELECT Command
     772SMARTDRV
;---------------------------------------------------------------------------
!TOPIC 762 Running 4DOS along with COMMAND.COM
!NOINDEX

You may find a very rare program which will not work under 4DOS,
but runs properly under COMMAND.COM.  If you have determined that
the problem cannot be solved through configuration changes or by
eliminating or reconfiguring a third program which is causing the
problem, use this section to see how to run 4DOS and COMMAND.COM
together in order to diagnose such a problem.

There are two methods of loading COMMAND.COM before another
program.  The first is to load it only when a specific program is
running.  This can be accomplished with the following command
(assuming COMMAND.COM is in the root directory of drive C:):

     c:\command /c progname options

where "progname" is the program name (with path if necessary) and
"options" are any parameters for the program.  This command will
run COMMAND.COM, load and run the program, and upon exit from the
program will exit from COMMAND.COM and return to 4DOS.  If this
is necessary to run a specific program, it can be defined as an
alias:

     alias progname `c:\command /c progname %&`

The "%&" passes all command line arguments on to the program.

With this method, if the program is large COMMAND.COM may need to
reload itself when the program exits.  It will not be able to do
so unless the 134COMSPEC is set properly.  If you experience
problems such as "Invalid COMMAND.COM" errors when using this
method, use a batch file like the following to run the program in
question (the SETLOCAL and ENDLOCAL cause COMSPEC to be restored
to its previous value after the program exits).  You will need to
modify this file if your copy of COMMAND.COM is not stored in the
C:\ directory:

     setlocal
     set comspec=C:\COMMAND.COM
     c:\command /c progname %&
     endlocal

The second method is more drastic:  you can start your system
under COMMAND.COM, then run 4DOS.  This approach is rarely
necessary, and will use about 4 - 5K of additional RAM for the
resident portion of COMMAND.COM.

The following steps will set your system up to boot with
COMMAND.COM, and run 4DOS automatically as part of the boot
process:

!INDENT 5 5 5 5
     (1) Set up the SHELL= statement in CONFIG.SYS to run
     COMMAND.COM, or leave it out entirely.  In other words, set
     it up just as you would if 4DOS were not on your system.

     (2) Separate your AUTOEXEC file into two parts:  part 1,
     which remains in AUTOEXEC.BAT, should contain any commands
     you wish to have COMMAND.COM execute before 4DOS is started.
     This might include loading any TSRs which you cannot get to
     load properly under 4DOS.  Part 2, which you must place in a
     separate batch file (we suggest the name 4DAUTO.BAT, but you
     can use any name you wish), should contain the commands you
     wish to have 4DOS execute when it is started.

     (3) Place the following line as the last line in the modified
     AUTOEXEC.BAT:

           4DOS parameters filename

     where "parameters" represents any necessary 4DOS parameters
     for your .INI file name, etc. (see the 352Startup
     topic in the online help for additional details), and
     "filename" is the name of the new batch file you created for
     part 2 of your old AUTOEXEC file.  Do NOT include a /P in the
     "parameters" or 4DOS will re-run AUTOEXEC and therefore load
     itself again, ad infinitum!

     (4) Be sure that KSTACK.COM is loaded in your AUTOEXEC.BAT
     file or your 4DOS startup file if you wish to use the 4DOS
     638KEYSTACK command.
!INDENT 0

This will load COMMAND.COM, execute the commands in AUTOEXEC,
load 4DOS, execute the commands in your new batch file, and then
give you the normal 4DOS prompt.

There is one drawback to this second approach:  because 4DOS is
not loaded with a /P, the EXIT command will return you to
COMMAND.COM if you inadvertently enter it at the primary shell
prompt.  You can get around this by including the /P parameter
despite the caution above, and then placing the following line at
the start of AUTOEXEC.BAT:

     if 01 == 1.0 quit

This line exits from AUTOEXEC.BAT only if it is being executed by
4DOS, preventing the infinite loop described above.
;---------------------------------------------------------------------------
!TOPIC 763 Executing DOS Commands from Applications
!NOINDEX

In general you should have no trouble running DOS commands or
"shelling to DOS" from within your applications.  If you do,
first check your 134COMSPEC setting, and check that enough memory is
available for 4DOS to execute as a secondary shell.  This should
resolve most problems with "shell to DOS" operations.

If those techniques do not resolve the problem, it may be due to
one of the issues covered below:  either the application was
developed with a compiler that does not handle the format of
4DOS.COM properly, or it is using interrupt 2E and you have
disabled interrupt 2E support.


Compilers and the Format of 4DOS.COM

If you have an application which can run DOS commands from
inside the application and that particular feature does not
work, try to determine if the application was developed with
Borland C or Lattice C.  Some older versions of these
compilers cannot properly execute 4DOS.COM to start a
secondary shell, because 4DOS.COM (despite its name) is
formatted as an EXE file, and the libraries shipped with
these compilers do not use the proper method to determine
what type of file they are=d:\4dos\4dos.exe

Then run the application in question and see if it works.  If
so, you can use the above workaround to run the application.
Be sure to contact the application vendor to see if they have
an update which corrects this problem.


Re-Enabling Interrupt 2E Support

COMMAND.COM contains an undocumented feature which allows
programs to execute DOS commands by passing the command
through software interrupt number 2E (hex).  Not many
programs use this feature, but full, 798documented support
for it is available within 4DOS for those circumstances where
it's needed.

Interrupt 2E support is normally enabled within 4DOS, but can
be disabled to save memory (INT 2E support requires about 100
bytes of resident memory).
If you have a program which is supposed to execute DOS
commands and it does not work under 4DOS, check your 4DOS.INI
file.  If you see a line like this:

     566FullINT2E = No

then you have disabled INT 2E support.  If the line is there,
try removing this line or replacing it with one reading:

     FullINT2E = Yes

to re-enable support for interrupt 2E, then reboot and test
whether your program works properly.
;---------------------------------------------------------------------------
!TOPIC 764 APPEND
!NOINDEX

General Information for All Operating Systems

(The considerations in using APPEND are different under MS-DOS /
PC DOS and under OS/2 2.0 and above.  Read this general
information, then see the appropriate section below for your
operating system.)

CAUTION:  In our opinion APPEND is a dangerous command.  It is
capable of "fooling" programs into thinking they are accessing
one file when they are really accessing another one with the same
name in a different directory.  This can either do just what you
want, or cause all sorts of trouble, depending on the
circumstances.  In particular, this behavior can cause 4DOS to
place descriptions which go with files in one directory in the
description file for another directory, because with APPEND
running 4DOS can't tell whether APPEND has opened a file
different from the one it asked for.

In MS-DOS / PC DOS 4.0 and above, and in OS/2 2.0 and above, the
APPEND /PATH:OFF switch mitigates this problem somewhat; in
particular it will keep 4DOS file description files from getting
mixed up between directories.  For this reason 4DOS will
automatically set this switch if it detects that you are running
APPEND under DOS 4.0 or above.

The /X switch can be used, and it will affect 4DOS directory
searches for many 4DOS commands (as it does for COMMAND.COM).
Please note that this makes APPEND very dangerous:  if you APPEND
a directory with /X and then (say) delete *.BAK when no such
files exist in the current directory, then the .BAK files in the
APPENDed directory will be deleted instead.

The APPEND /E switch will not work with 4DOS.


MS-DOS and PC DOS APPEND

If you run APPEND under MS-DOS or PC DOS, you must set up special
aliases to compensate for unusual problems in the design of
APPEND.  Unlike most other commands in MS-DOS and PC DOS, APPEND
has both an external portion and an undocumented internal
portion.  The first time APPEND is run the external portion is
executed, and loaded into memory as a TSR (memory-resident
program).  Subsequent uses of APPEND to adjust the APPEND path
use an undocumented internal interface between COMMAND.COM and
the TSR portion of APPEND.

4DOS does not support the internal portion of APPEND command
under MS-DOS or PC DOS.  This means that you cannot change the
APPEND path directly from 4DOS.  However you can still use APPEND
with 4DOS.

APPEND should initially be loaded in the usual way, from AUTOEXEC
or any other batch file, or from the command line.  However to
change the APPEND path after APPEND has been loaded for the first
time, you must run APPEND from COMMAND.COM, not from 4DOS.  To do
this, enter the following command (modify the command
appropriately if COMMAND.COM is not in the directory C:\):

     c:\command /c append [new path list]

You could also set up a 4DOS alias to do the above command for
you, for example:

     alias app `c:\command /c append`

which would be invoked with the command

     app [new path list]

If you must use APPEND to make certain applications work under
MS-DOS or PC DOS, we STRONGLY suggest that you set up the alias
described above, and load APPEND in AUTOEXEC.BAT with an empty
path.  Then, for each application, set up an alias to run it that
is similar to the following (this alias uses the "app" alias
defined below to run APPEND under MS-DOS or PC DOS):

     alias myprog `app c:\mydata^d:\util\myprog.exe^app ;`

This alias sets the APPEND path, runs the application, and clears
the APPEND path.  When used in this way APPEND is less likely to
cause trouble because it is disabled except when it is explicitly
needed.


APPEND and OS/2 DOS Sessions

If you run 4DOS in an OS/2 2.0 or above DOS session (VDM), APPEND
is fully supported and the techniques described above for MS-DOS
and PC DOS are not necessary.

If you must use APPEND to make certain applications work under
OS/2, we STRONGLY suggest that you load APPEND in AUTOEXEC.BAT
with an empty path.  Then, for each application, set up an alias
to run it that is similar to the following:

     alias myprog `append c:\mydata^d:\util\myprog.exe^append ;`

This alias sets the APPEND path, runs the application, and clears
the APPEND path.  When used in this way APPEND is less likely to
cause trouble because it is disabled except when it is explicitly
needed.
;---------------------------------------------------------------------------
!TOPIC 765 DBLSPACE and DRVSPACE
!NOINDEX

4DOS fully supports DBLSPACE and DRVSPACE compressed drives in
MS-DOS 6.x and above, and DRVSPACE compression in Windows 95/98/ME.
You can display and sort by compression ratios on these drives with
the DIR /C and /O:c switches (the same switches also work with
SELECT).

4DOS will display Windows 95/98/ME DRVSPACE compression ratios whether
you are in a "command prompt" boot (without the GUI loaded) or in
a full Windows 95/98/ME boot.  Windows 95/98/ME COMMAND.COM only
displays compression ratios when the GUI is loaded.
;---------------------------------------------------------------------------
!TOPIC 766 FASTOPEN
!NOINDEX

The MS-DOS / PC DOS FASTOPEN command generally works with 4DOS, but
does not properly detect renamed directories, and may have similar
problems when directories are removed.  This is a problem in
FASTOPEN, not in 4DOS.  (This problem does not exist in the
implementation of FASTOPEN under DR-DOS, which works considerably
different internally.)

If you use FASTOPEN under MS-DOS / PC DOS and rename a directory with
the 4DOS REN command, then do a DIR command, you may see the old name
and not the new one displayed; you may also occasionally have trouble
accessing files under the new name.  You can usually solve this problem
by including a 564DiskReset = Yes directive in
4DOS.INI.  If DiskReset = Yes does not work, the only other solution
we are aware of is to reboot your system after renaming a directory.

Our opinion is that, if you have the memory to support it, a disk
caching program will provide a much greater and more effective
performance improvement than FASTOPEN (but don't run both at the
same time!).
;---------------------------------------------------------------------------
!TOPIC 767 FORMAT /S and SYS Commands
!NOINDEX

The FORMAT /S and SYS commands in DOS 4 and above will copy
4DOS.COM to a newly formatted floppy disk and rename it
COMMAND.COM, which may not be what you want and is confusing at
best.  See the discussion of "4DOS and DOS" in the 4DOS
Introduction and Installation Guide for more information on this
issue.
;---------------------------------------------------------------------------
!TOPIC 769 MEMMAKER
!NOINDEX

4DOS is fully compatible with MEMMAKER.

MEMMAKER adds commands to the end of your AUTOEXEC.BAT file
during its operation, and removes them when it is finished.  If
for some reason you have used a QUIT command in AUTOEXEC.BAT,
remove it before running MEMMAKER.  Otherwise, MEMMAKER's
commands will not run and the memory optimization process will
not work properly.
;---------------------------------------------------------------------------
!TOPIC 770 DOS MOVE Command
!NOINDEX

DR DOS 6.0 and above as well as MS-DOS 6.0 or PC DOS 6.1 and above
all include an external MOVE command which is generally compatible
with the 4DOS 646MOVE command.

The syntax and features of the DOS MOVE command are slightly
different than those offered by 4DOS's MOVE, so batch files
written for one command may not work exactly the same way with
the other, especially if more advanced or complex features are
used.  If you write batch files which use both commands, check
the 4DOS and 65535external DOS documentation for your particular usage.
;---------------------------------------------------------------------------
!TOPIC 771 DOS SELECT Command
!NOINDEX

In MS-DOS / PC DOS 4.01 and below, a SELECT command was included.  This
external command is totally unrelated to the 4DOS internal SELECT
command.  If you need to use both, you can set up aliases to
adjust how the command names are handled.  For example, the
following two aliases set up SELECT to access the DOS 4.0
external SELECT command (assumed to be stored in C:\DOS\SELECT.EXE),
and SEL to access the internal 4DOS SELECT command:

     alias select c:\dos\select.exe
     alias sel *select
;---------------------------------------------------------------------------
!TOPIC 772 SMARTDRV Disk Cache
!NOINDEX

Under PC DOS 6.1 and above, and MS-DOS 6.20 and above, COMMAND.COM
instructs SMARTDRV to write all cached data to the disk before
the command prompt is displayed.

4DOS offers the same capability, but you must enable it by adding
the following line to your 4DOS.INI file:

     SDFlush = Yes

SDFlush works with PC DOS 6.1 and MS-DOS 6.20 and above as described
above.  In addition, SDFlush will work with MS-DOS 6.0 SMARTDRV.  You
may find this to be an improvement over MS-DOS 6.0 COMMAND.COM, which
does not offer a similar feature.
;---------------------------------------------------------------------------
!TOPIC 773 DR-DOS
!NOINDEX

4DOS will work properly as a command processor (including as the
primary shell) under DR DOS 3.31 - 6.0, including EZ-DOS 3.41, as well
as under PalmDOS 1.0, Novell DOS 7, Caldera OpenDOS 7.01, DR-DOS 7.02 - 7.03,
OEM DR-DOS 7.04 - 7.06 and later.  For brevity we refer to them all just
as "DR-DOS" here, unless we have to specify the exact version numbers.


Internal vs. External Commands

DR DOS 3.31 - 5.0's design makes the ASSIGN, MORE, and SUBST commands
internal (in MS-DOS / PC DOS they are external).  DR DOS 6.0 and PalmDOS 1.0
still have an internal MORE command.  4DOS supports all MS-DOS internal
commands, but does not have internal support for ASSIGN, MORE, and
SUBST.  To access these DR DOS internal commands when using 4DOS as
the command processor, you must set up aliases which run DR DOS's
COMMAND.COM.  The following 4DOS aliases accomplish this (adjust
these if COMMAND.COM is not in C:\):

     alias assign = `c:\command /c assign %&`
     alias more = `c:\command /c more %&`
     alias subst = `c:\command /c subst %&`

In Novell DOS 7, OpenDOS 7.01, and DR-DOS 7.02 and above, all these
commands were changed back to external commands, so the corresponding
aliases are not necessary.

For the MORE command, a much better alternative can be set up
by aliasing it to the 4DOS LIST command:

     alias more = list /s

This provides a scrollable, full-screen display rather than
the simple paged display offered by DR DOS (or MS-DOS) MORE.


Unsupported Commands

DR DOS 3.31 COMMAND.COM and above supports a number of commands not
supported by 4DOS, including APPEND and BATCH (DR DOS 3.31 - 3.41 only),
and DELQ, ERA, and ERAQ.  DR DOS 5.0 and above introduced HILOAD,
and DR DOS 6.0 and above added IDLE.  Most of these commands, however,
have similar expressions in 4DOS, and it is possible to either set up
aliases to emulate these commands to some degree with 4DOS commands,
or to temporarily invoke the original COMMAND.COM to handle them.  For
example ERA is a synonym to DEL, and DELQ / ERAQ are both
synonyms to DEL as well, but with the DR DOS COMMAND.COM /Q
(Query) option added (which is equivalent to 4DOS's /P (Prompt)
option.)  Since some of the DR DOS DEL / ERA / ERASE options clash with
4DOS DEL options, most of the following aliases invoke the
original COMMAND.COM to process them:

     alias batch = `%&`
     alias dbg = `c:\command /c dbg %&`
     alias delq = `c:\command /c delq %&`
     alias era = `c:\command /c era %&`
     alias eraq = `c:\command /c eraq %&`
     alias hiload = `lh %&`
     alias idle = `c:\command /c idle %&`


Incompatible Commands

Some of the options of the DR DOS DIR command are incompatible with
the 4DOS' DIR.

The SWITCH command found in DR DOS 6.0 and above uses a completely
different syntax than the later 4DOS SWITCH command.  You will have
to run batch files containing this command with COMMAND.COM, or rewrite
them to work with 4DOS constructions.  To make distinguishing between
these two commands easier in mixed batch files, DR-DOS 7.02 COMMAND.COM
and above has added DRSWITCH, which is a synonym to SWITCH.  One way
to avoid such problems is to rename all 4DOS specific batch files
to .BTM, leaving the .BAT extension for all DR-DOS COMMAND.COM
specific batch files.  You could then set up 4DOS.INI 477PathExt = Yes,
set up the 143PATHEXT environment variables to not include the .BAT
extension any more, and define an 082Executable Extensions for
.BAT instead:

     set pathext=.com;.exe;.btm
     set .bat = c:\command.com /C

This will let you continue to use all 4DOS features, except that
any .BAT files will be automatically executed by a temporary instance
of COMMAND.COM rather than 4DOS.

DR DOS 6.0 and above introduced an external screen saver LOCK, which
is totally unrelated to the 4DOS LOCK and UNLOCK commands under
Windows 95/98/ME.


CONFIG.SYS SET

DR DOS 6.0 and above allow you to put SET commands in CONFIG.SYS
to set environment variables.  Unless you specify 553DRSets = No in
4DOS.INI, 4DOS will retrieve this information and store it in the 4DOS
environment, as DR-DOS's COMMAND.COM does.  4DOS does not convert the
imported variable names into upper case, which may cause them to be
invisible to some programs.  This can be a feature, but sometimes it
is also confusing.  To avoid this, you will have to write the names
in upper case yourself in CONFIG.SYS.  DR-DOS 7.02 and above will
in several ways enforce a more traditional usage of variables during
CONFIG.SYS and will also automatically convert the variable names into
upper case, unless you specify SWITCHES=/L in CONFIG.SYS to reinvoke
the old behaviour.


CONFIG.SYS SHELLHIGH

DR-DOS 7.02 and above added a CONFIG.SYS SHELLHIGH directive, which
works identical to the traditional 352SHELL, except it takes
an additional parameter named SIZE=hhhh with a hex-value as an
argument.  This is used to control the pre-allocation of a portion
of the HMA area to load the command processor high, usually between
5K and 8K of HMA memory -- DR-DOS COMMAND.COM supports a /MH option
to load its permanent portion up into the HMA.  Since 4DOS cannot
load into the HMA, this area will effectively remain unallocated
(that is, free for other clients to use), but it will unnecessarily
cause the HMA to get fragmented.  In order to avoid this fragmentation
and increase chances to load more other drivers up into the HMA, it
may be a good idea to experiment with the SHELLHIGH SIZE=hhhh parameter
to minimize the HMA space reserved for the command shell, when using
4DOS instead of COMMAND.COM, e.g.:

     shellhigh size=20 c:\4dos\4dos.com ...
       or
     shellhigh size=20
     shell=c:\4dos\4dos.com ...


TASKMAX and TASKMGR

4DOS will work with DR DOS 6.0 TASKMAX and the later TASKMGR, which
comes with Novell DOS 7, Caldera OpenDOS 7.01, and DR-DOS 7.02 and
above, as long as you start new tasks according to the instructions
below.  When tracking down the best options for you to work with
TASKMGR please note, that TASKMGR /S in task switching mode behaves
similar to the older task switching TASKMAX, while EMM386 /MULTI
plus TASKMGR (without /S) in its preemptive multitasking mode works
completely different.  Actually, under the hood, there are two
different programs at work.

You may need to experiment with the 398UMBLoad directive
in 4DOS.INI when running TASKMAX / TASKMGR.  Depending on your
system configuration and your version of TASKMAX / TASKMGR, using
UMBLoad = Yes may make the system more or less stable.  We do
recommend that you use UMBLoad = Yes if it works on your
system, as this allows 4DOS better control over secondary
shell startups under TASKMAX / TASKMGR.

When using 4DOS with TASKMAX you generally can NOT use the
Ins key on the TASKMAX menu to start new tasks.  If you do,
your system will hang.  This is due to assumptions TASKMAX
must make when starting new tasks.  These assumptions are
valid for COMMAND.COM, but not for 4DOS.

Under Novell DOS 7, Caldera OpenDOS 7.01, and DR-DOS 7.02 and above,
you can avoid this problem easily, by telling TASKMGR to start a new
shell when a new task is initiated.  To do so, check the TASKMGR.INI
file for these lines:

     [Shell]
     Exec=False

Change the second line to read:

     Exec=True

Take care that the operating system specific NWDOSCFG, OPENDOSCFG, or
DRDOSCFG environment variable points to the directory, where the
TASKMGR.INI file is stored.  Once this is done, you should be able
to use Ins to start new tasks without any difficulties.

The method described above is not available under DR DOS 6.0; you
must use the TASKMAX /C command instead.  For example, this command:

     taskmax /c c:\4dos.com

will start a new secondary copy of 4DOS as a new task, and display
a prompt.  The same approach should be used when starting any task
which needs a command processor.  To start a task which runs a
.BTM or .BAT file, use a command like this:

     taskmax /c c:\4dos.com /c startwp.bat

This tells 4DOS to run the specified batch file, and exit
automatically (removing the task from the task list) when the
batch file is done. If you have tasks you start regularly using the
approach described above, use a batch file or a set of 4DOS aliases
to help automate the process.


Floating drives

Under DR DOS 3.31 - 6.0 (up to 1992 issues), 4DOS fully supports the
DR DOS CD / CHDIR "floating drive" synin time zone and
     in the file time storage method between the local and remote
     systems.  Be sure to do some non-destructive testing (e.g. with
     /N) before depending on this
File Passwords

4DOS includes support for DR-DOS file passwords.  However, the command
syntax used to access files with passwords is slightly different in 4DOS
than in the DR-DOS COMMAND.COM.

The character used to separate passwords from filenames under DR-DOS
is a semicolon [;], which 4DOS uses to separate parts of an
080include list.  Therefore, to avoid confusion with include lists,
4DOS requires the use of two semicolons to separate the password and
filename in any command which supports wildcards.  For example, to delete
the file MYDATA which has the password "fred", you would type:

     del mydate;;fred         for 4DOS

4DOS directory-related commands like 644MD and 601CD do not use
wildcards.  Those commands, and DR-DOS external commands which accept the
"filename;password" syntax, use only a single semicolon.

DR-DOS hides files which are password-protected.  This means that you must
use 4DOS command switches which allow processing of hidden files (606COPY
/H, 609DEL /Z, 612DIR /A, 626FOR /A, 646MOVE /H, and 662SELECT
/A) to access a password-
protected file under DR-DOS.

Passwords are not automatically preserved when copying or moving a file with
4DOS.  However, the hidden attribute will be preserved.  This means that if
you move or copy a password-protected file and want it to be visible in its
new location or under its new name, you will have to manually remove the
hidden attribute with 596ATTRIB.

For example, to password-protect the file MYDATA, copy it to drive A:, and
then delete it:

     c:\> password mydata /r:fred
     c:\> copy /h mydata;;fred a:
     c:\> del /z mydata;;fred

To unprotect the password-protected file MYDATA:

     c:\> password mydata;fred /n
;---------------------------------------------------------------------------
!TOPIC 781 Microsoft Windows 3.xx
!NOINDEX

Under some circumstances you may find that Windows overrides the
environment size specified in your 4DOS.INI file, and creates a
smaller environment.  This can leave insufficient environment
space for your 4DOS sessions running under Windows.  If you
experience this problem, edit the SYSTEM.INI file in your Windows
directory, and find the section labelled [NonWindowsApp].  Add
the following line to this section:

     CommandEnvSize = 0

This tells Windows not to force a particular environment size,
which will allow 4DOS to set the size itself.

If you set up a .PIF file for 4DOS, be sure to allow your 4DOS
sessions access to the same type of memory used to swap your
primary shell.  If you do not, your Windows sessions may not be
able to retrieve aliases and the command history from the primary
shell.  For example, if the primary shell swaps to XMS memory,
and you set the XMS memory limit to 0 in the .PIF file, your 4DOS
sessions under Windows may start without inheriting aliases and
history from the primary shell.

If you set up a .PIF file please note that the 4DOS MEMORY command
will report the maximum amount of EMS memory which Windows can
theoretically make available in that window.  Because Windows
provides a virtual memory capability, this number may be much
larger than the size of physical RAM.  For example, if you set
the EMS Limit in your .PIF file to -1, Windows will report total
EMS memory of 64 MB to 4DOS as this is the theoretical limit on
Windows' virtual memory manager.  Virtual memory figures which
give the appearance of excess memory are a feature of Windows,
and not a bug in 4DOS.

Also see the Troubleshooting section 757Memory Allocation and Microsoft
Windows.
;---------------------------------------------------------------------------
!TOPIC 791 Windows 95/98/ME
!NOINDEX

This topic explains how to use 4DOS with Windows 95/98/ME.  See the
following subtopics and related topics for complete details:

!INDENT 30 5 5 5
     792Boot Sequence            Background information on how Windows 95
     and 98 start.

     793Installing 4DOS          Explains how to install 4DOS as the primary
     shell so it loads when Windows 95/98 boots.

     794Starting 4DOS            Explains how to start 4DOS from the
     Windows 95/98/ME Graphical User Interface.

     941File Systems and Names   Describes the file systems and file
     name conventions supported by 4DOS, including information on using
     Windows 95/98/ME long file names.

     081LFN File Searches        Explains how 4DOS searches for files on
     drives which support Windows 95/98/ME long file names.

     795Installing KSTACK        Notes on how to install KSTACK.COM so that
     the KEYSTACK program will work properly with Windows 95/98/ME.

     796Using "MS-DOS Mode"      Information on using 4DOS in
     Windows 95/98's "MS-DOS Mode."

     765Using DRVSPACE           Information on using Microsoft's disk
     compression technology with 4DOS.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 792 The Windows 95/98 Boot Sequence
!NOINDEX

In order to understand the different methods for installing 4DOS you may
find it helpful to learn a little about the Windows 95/98 boot sequence
(if you are not interested in these details, skip to the next section).

Modified versions of the standard MS-DOS startup programs are used to
boot Windows 95/98.  These programs look for CONFIG.SYS and AUTOEXEC.BAT
just as under previous versions of MS-DOS.  If CONFIG.SYS is not
present, Windows 95/98 will load the appropriate Real mode DOS device
drivers automatically, then start WIN.COM, which loads the Windows
32-bit drivers and GUI.  If CONFIG.SYS is present, the MS-DOS startup
portion of Windows 95/98 will process it (while displaying a graphical
Windows 95/98 startup screen).  Certain drivers required by Windows 95/98
(e.g. HIMEM.SYS) will be loaded automatically even if they are not
listed in CONFIG.SYS, but otherwise CONFIG.SYS works just as it does
under previous versions of MS-DOS.

If you use the default command processor, COMMAND.COM, it will be loaded
automatically at the end of CONFIG.SYS if needed to process
AUTOEXEC.BAT, then the GUI is loaded as described above.  If you use a
SHELL command in CONFIG.SYS to load a different command processor (such
as 4DOS), it will be loaded just as under previous versions of MS-DOS, and
can then invoke the Windows GUI if desired (see below for details).
However the SHELL command is ignored if AUTOEXEC.BAT is not present.

Some aspects of the boot process are controlled by the file MSDOS.SYS,
which is now an ASCII file which functions as a .INI file for DOS
itself.  For example you can control whether the GUI is automatically
loaded with the BootGUI setting in the [Options] section of MSDOS.SYS,
and you can automatically display a standard startup options menu by
setting BootMenu=1 in the [Options] section (you can also display this
menu by pressing F8 when you see the "Starting Windows 95 ..." or
"Starting Windows 98 ..." prompt).  You may also want to set Logo=0 to
avoid hooking a variety of interrupts that can create incompatibilities
with BEEP, DELAY and the /W option of INKEY in AUTOEXEC.BAT.  MSDOS.SYS
is a hidden, system, read-only file; to edit it from DOS use a sequence
like this:

     c:\> attrib -rhs msdos.sys
     c:\> edit msdos.sys
     c:\> attrib +rhs msdos.sys
;---------------------------------------------------------------------------
!TOPIC 793 4DOS as the Primary Shell under Windows 95/98
!NOINDEX

The best way to configure 4DOS for Windows 95/98 is to add a standard
SHELL command to the end of the Windows 95/98 CONFIG.SYS file.  For
example:

     SHELL=C:\4DOS\4DOS.COM C:\4DOS /P

The second directory name and the /P should always be used.  (If you find a
previous SHELL= line for COMMAND.COM, be sure to remove it or add "REM " at
the start to convert it to a comment.)

[NOTE:  If you reinstall Windows 95/98 or install a later build over an
earlier one, your SHELL line will be removed from CONFIG.SYS by the
Windows 95/98 installation process.  To correct this simply boot the
new version, go to a 4DOS prompt (your desktop with its 4DOS icon is
typically preserved when you upgrade), and use EDIT or another ASCII
editor to put the SHELL line back in CONFIG.SYS, then restart
Windows 95/98.  You can also boot with F8 and select the "Command
Prompt Only" boot option, which will give you a COMMAND.COM prompt.  At
this point use an ASCII editor to modify CONFIG.SYS and add the SHELL=
line for 4DOS, then reboot.]

When 4DOS is loaded as the primary shell in CONFIG.SYS it will start the
Windows 95/98 GUI automatically (except when you select the "Command
prompt only" option from the Windows 95/98 boot menu).  If you want
4DOS to display a prompt without starting the GUI, edit MSDOS.SYS as
described above and change the line reading BootGUI=1 to read
BootGUI=0.  You can then use the WIN command to start the GUI when you wish.

Some users find it convenient to set BootGUI=0, then add commands
similar to the following at the end of AUTOEXEC.BAT:

     inkey /w5 Press X for prompt, or wait for Windows ... %%key
     if "%key" != "X" win
     unset /q key

These commands start Windows automatically unless you press the X key
within 5 seconds after the message is displayed.  You can interrupt the
5-second delay by pressing any other key.  This gives you a convenient
way to go directly to a prompt if you wish, but otherwise starts Windows
automatically.

Please note that the Windows 95/98 directory (usually C:\WINDOWS) must be
in your 138PATH for the above examples to work.  If it is not, the WIN
command may not be recognized.  Generally under Windows 95/98 it is best
to include the Windows 95/98 directory in your PATH.

If you load Windows 95/98 in "safe mode" your startup files (CONFIG.SYS
and AUTOEXEC.BAT) are ignored, and 4DOS will not be loaded as the primary
shell (safe mode is for troubleshooting and is selected by pressing F5
during the boot process, or by pressing F8 and selecting a safe mode
boot from the menu).  In most cases you should not load 4DOS after
the GUI starts when Windows 95/98 is running in "safe mode", because DOS
applications often do not work properly in "safe mode."

If you select other boot modes from the F8 menu (e.g. "step by step" or
"command prompt only") the 4DOS primary shell will load, and will handle
the option you have selected.  The only exception is that if you select
step by step mode and then answer "N" (or Esc) when prompted whether to
process AUTOEXEC.BAT, the SHELL line will also be ignored and
COMMAND.COM will be loaded rather than 4DOS (this is a Windows 95/98
behavior unrelated to 4DOS).
;---------------------------------------------------------------------------
!TOPIC 794 Starting 4DOS from Windows 95/98/ME
!NOINDEX

The simplest method for running 4DOS from the Windows GUI is to
create a new shortcut on the desktop.  To do so click with mouse button 2
in any open area of the desktop.  On the popup menu click New, then
Shortcut.  Fill in the drive and path for 4DOS.COM, and any other items
you wish to set (no specific settings are required for 4DOS).  Use the
Change Icon button to assign the standard 4DOS icon, in the file
4DOS.ICO, to the shortcut.

Once the shortcut is created 4DOS will start when you double-click the
corresponding icon on the desktop.  You can place any necessary commands
or other directives (e.g. @ininame to name a specific .INI file) on the
startup command line just as you would under DOS or Windows 3.1; see
352Startup for details.

If 4DOS is started in this way, and is not installed as the primary
shell (whether because you have no CONFIG.SYS and AUTOEXEC.BAT and
therefore do not load a primary shell, or because you use COMMAND.COM as
your primary shell), then it will not inherit aliases or other startup
settings.  In this case you must use the 4START file to load aliases
and perform other startup tasks.  To avoid this problem we recommend
that you install 4DOS as the primary shell (see above) and load your
aliases etc. at system startup, just as you would under DOS.

We do not recommend the use of disk swapping under Windows 95/98/ME.  If
you do use disk swapping aliases and other settings may not be inherited
properly in some cases, especially when 4DOS is the primary shell.  The
best setup is to install 4DOS as the primary shell, and to use XMS
swapping for all shells.  You can set this swapping type with the
following line in 4DOS.INI:

     Swapping = XMS

If you start Windows in "safe mode" in most cases you should not load
4DOS after the GUI starts.  DOS applications often do not work properly
in "safe mode."
;---------------------------------------------------------------------------
!TOPIC 795 Installing KSTACK in Windows 95/98/ME
!NOINDEX

If you want to load KSTACK.COM (required for the 638KEYSTACK command)
under Windows 95/98/ME, it should be loaded separately for each 4DOS
window.  To do so, include the KSTACK command on the startup command line
when you set up the corresponding shortcut(s).  For example, the command
line for your shortcut might read:

     c:\4dos\4dos.com c:\4dos\kstack.com

This will load KSTACK when the 4DOS window is opened, then display a
prompt.

If you install KSTACK in AUTOEXEC.BAT it will not work properly when
multiple 4DOS windows are open -- stacked keystrokes will "bleed
through" from one window to another.  To prevent this, create your shortcut
for the 4DOS window to load KSTACK using the /I option:

     c:\4dos\4dos.com c:\4dos\kstack.com /I

This option will force a separate copy of KSTACK.COM to be loaded for your
4DOS window even if there is a current copy of KSTACK in memory.
;---------------------------------------------------------------------------
!TOPIC 796 Using "MS-DOS Mode"
!NOINDEX

Windows 95, 98 and ME allow you to run programs in "MS-DOS Mode."  In
this mode Windows is shut down and the entire computer is
devoted to running a single MS-DOS program.  When the program is
finished, Windows reboots.

You can start a specific program in MS-DOS mode by checking the appropriate
box on the Advanced screen in that program's Properties dialog.  4DOS
generally is not involved when specific, individual programs are run
this way.

When you shut down Windows one option is to "Restart the computer in
MS-DOS mode."  If you select this option Windows will shut down and
COMMAND.COM will start.  To use 4DOS (rather than COMMAND.COM) when this
option is selected, you must adjust the "Exit to DOS.PIF" file as follows:

!INDENT 7 5 5 5
     * Open (double-click) the My Computer object on the desktop,
     open the drive where Windows is loaded (usually drive C:),
     and open the WINDOWS folder.

     * Find the item in the WINDOWS folder labeled "Exit to DOS"
     (this refers to the file "\WINDOWS\Exit to DOS.PIF")

     * Click on this item with mouse button 2, then click the
     Properties selection on the pop-up menu

     * Change the field which names COMMAND.COM so that it refers
     to 4DOS.COM (including the drive and path)

     * Close the Properties dialog and the other windows
!INDENT 0

Once this change is made the "Restart the computer in MS-DOS mode" option
will load 4DOS, not COMMAND.COM.  If you use this option, type EXIT when
you are done, and Windows will reboot.

4DOS itself does not need to run in MS-DOS mode.  However if you want to
create an object which starts 4DOS in MS-DOS mode for some special purpose,
you can use the approach described above.  Simply create a shortcut for
4DOS as described in 794Starting 4DOS, and check the MS-DOS Mode box
on the Advanced screen in the shortcut's Properties dialog.
;---------------------------------------------------------------------------
!TOPIC 811 IBM OS/2
!NOINDEX

4DOS works properly as the shell in OS/2 DOS sessions under OS/2 2.0, 2.1,
2.11, 3.0, and 4.0, including OS/2 Warp, OS/2 for Windows, and eComStation.

4DOS offers almost unlimited flexibility for your OS/2 DOS sessions, and has
been specifically designed to take advantage of OS/2 features wherever
possible.  However, to use DOS, 4DOS, and OS/2 successfully requires some
planning if you want to get all the power possible out of each operating
environment.

These sections explain some of the planning you should do and some of the
techniques you can use to get everything working together correctly:

     812Configuring 4DOS for OS/2
     817"Temporary" VDMs
     8184DOS and OS/2 Boot Management Options
     819Resolving "Cannot find OSO001.MSG" Error

In these topics, we assume that you want to use 4DOS as your command
processor in all of these situations.  Also, we assume that you have
installed 4DOS in the C:\4DOS directory (alter the SHELL= and DOS_SHELL
settings in the examples appropriately if 4DOS is installed in a different
directory).

If you are using OS/2's Dual Boot or Boot Manager, you will have (at least)
two copies of CONFIG.SYS and AUTOEXEC.BAT on your computer, one for booting
OS/2 and OS/2 DOS sessions, and the other for booting DOS without OS/2.
See 8184DOS and OS/2 Boot Management Options for details on where
these two sets of files are stored.  Unless otherwise specified, references
in this section to CONFIG.SYS and AUTOEXEC.BAT refer to the OS/2 versions
of these files.
;---------------------------------------------------------------------------
!TOPIC 812 Configuring 4DOS for OS/2
!NOINDEX

Under OS/2, you can have multiple objects which start DOS sessions, also
called Virtual DOS Machines (VDMs).  These may include objects in the
Command Prompts window, objects for "migrated applications," objects for
DOS and Windows applications, and objects for batch files.

Assuming you set up your VDM objects as described here, 4DOS is loaded as a
primary shell each time a DOS session starts.  4DOS will process 4DOS.INI,
execute your 4START file if you have one, and execute AUTOEXEC.BAT.  When the
session is closed with the EXIT command, 4DOS will run your 4EXIT file if you
have one.  You can start any number of DOS sessions and (within the limits of
system resources) have as many running simultaneously as you like.

This is fundamentally different from what happens when you boot your computer
under DOS or OS/2 1.x.  In these environments there is only one 4DOS primary
shell, AUTOEXEC.BAT is only executed once each time you boot, and so on.
OS/2 version 2.x and above give you much more flexibility, but that
flexibility requires planning to get the most out of 4DOS.

For example, you can have all your DOS sessions use the same AUTOEXEC.BAT
file, or you can have different versions of AUTOEXEC.BAT for different
sessions.  The same is true of the other startup and exit files (4DOS.INI,
4START, and 4EXIT).  The sections below discuss how to set
up objects for your DOS sessions, and how to arrange your startup and exit
files so that 4DOS will do just what you want it to in each DOS session.

     813Settings for DOS Sessions
     814Configuring DOS Sessions for 4DOS
     815OS/2 DOS Sessions and 4DOS.INI
     816OS/2 DOS Sessions and Startup Files

;---------------------------------------------------------------------------
!TOPIC 813 Settings for DOS Sessions
!NOINDEX

Each VDM object contains its own information about how to start DOS for that
session.  In essence, each object has its own CONFIG.SYS file built into
it.  The information attached to an object which indicates how to start DOS
is called its DOS Settings.

You can modify these settings using OS/2's Properties dialogs.  To do so,
click the right mouse button in the object.  When the popup menu appears,
click the left mouse button on Properties.

Once the Properties dialog is open, use the Program page to modify the
object's program name, startup directory, and command line parameters.
The Session page lets you set the session type.  Other pages let you
adjust other configuration data for the object.

To modify the DOS settings, use the button with that legend on the Session
page of the notebook.  Clicking on this button opens the DOS settings dialog
box.  To modify an individual setting, click on the setting name in the list
box at the left, then click on the value window to the right and enter the
new value.  Settings with choice values (such as "On" and "Off") will show
buttons for the value, rather than a text window.

In a new object, each DOS setting starts out with a default value taken from
your CONFIG.SYS file.  For settings which have no corresponding command in
CONFIG.SYS, OS/2 uses a built-in default value.

For example, the DOS_SHELL setting, which specifies the command processor to
use for a DOS session, defaults to the value on the SHELL= line in
CONFIG.SYS.  Changing the SHELL= line changes the default DOS_SHELL value for
all new DOS sessions (as usual, changes to CONFIG.SYS are only effective
after you reboot the system).

However, the HW_TIMER setting (which tells OS/2 whether to allow the session
to manipulate the hardware timer), always defaults to OFF.  The default
cannot be changed in CONFIG.SYS.

Modifying a setting whose default is specified in CONFIG.SYS, such as
DOS_SHELL, breaks the "link" between that setting and the default in
CONFIG.SYS.  After the modification, changes made to the default in
CONFIG.SYS will not affect the object at all.

For example, to set up 4DOS as your default DOS command processor for OS/2
DOS sessions you might include this line in the OS/2 CONFIG.SYS file:

     SHELL= C:\4DOS\4DOS.COM C:\4DOS /P

If you then create a new DOS session object, its DOS_SHELL setting will
reflect the value from the SHELL= line.  Now suppose you modify the DOS_SHELL
setting for that object so that it reads:

     C:\4DOS\4DOS.COM C:\4DOS /L /P

At this point the "link" between your object and CONFIG.SYS is broken.  If
you move 4DOS to a different directory and modify the SHELL= line in
CONFIG.SYS, the object's DOS_SHELL setting will not be changed, and the
object will no longer work properly.  In order to correct this you will have
to manually modify the DOS_SHELL setting for that object.

You can return any DOS setting to the current default value at any time.  To
do so, open the DOS Settings dialog box, highlight the setting name, and
click on the Default button.  This replaces the value of the setting with the
value OS/2 read from CONFIG.SYS when you last booted, or with the value from
OS/2's standard defaults.  For settings which have a default in CONFIG.SYS,
this re-establishes the link between the object and CONFIG.SYS, and
subsequent changes you make in CONFIG.SYS will again be reflected in the
setting for that object each time you reboot.
;---------------------------------------------------------------------------
!TOPIC 814 Configuring DOS Sessions for 4DOS
!NOINDEX

To create a VDM object that gives you a standard 4DOS prompt, first place an
asterisk [*] in the Program Name field (on the Program page in the
Properties dialog).  This tells OS/2 to load the DOS command processor and go
to a prompt instead of running a specific DOS application.  Then go to the
Session page and set the session type to DOS Full Screen or DOS Window.

Next, click on the DOS Settings button and set up the DOS settings for the
object.  4DOS will run properly with default DOS settings, but you may want
to check that the DOS_SHELL setting is correct, because this setting
determines which command processor OS/2 will load when the object is used to
start a session.

DOS_SHELL is formatted just like the SHELL= line in CONFIG.SYS (see
352Starting 4DOS), but without the characters "SHELL=".  The DOS_SHELL
setting should always include the 134COMSPEC path.  For example, you
might set DOS_SHELL to:

     C:\4DOS\4DOS.COM C:\4DOS /P

If you've set 4DOS as the shell in CONFIG.SYS, any new VDM
objects you create will automatically use the correct DOS_SHELL setting for
4DOS.  However, VDM objects which existed before you modified CONFIG.SYS may
list COMMAND.COM in the DOS_SHELL setting.  To correct the setting so that
4DOS is used for these objects, modify DOS_SHELL in each object to point to
4DOS, as shown in the example above, or change DOS_SHELL back to the default
value with the Default button.

You can customize any object with optional 4DOS command line switches, such
as @ininame, or //iniline (see 352Starting 4DOS for more
details).  These switches can be placed at the end of the DOS_SHELL setting,
or in the Parameters field in the Program window.

For example, your Program page might have the following settings for a
standard 4DOS prompt, using a special .INI file for this session:

     Program Name:       *
     Parameters:         @C:\4DOS\OS2VDM.INI
     Working Directory:  C:\

You can run any alias, internal command, DOS application, or batch file
directly from a 4DOS VDM object.  To do so, place the command to be executed
as the last item in the Parameters field for the object.  4DOS will execute
the command and then display a prompt.  4DOS will execute the command after
it processes your 1094START file (if any) and AUTOEXEC.BAT.

If you precede the command name with /C, 4DOS will exit and return
to the OS/2 desktop when the command is finished.  This is a "temporary" VDM,
described in more detail in 817"Temporary" VDMs.  You
can also make 4DOS exit when the command is complete by invoking a batch file
or alias which ends with the 624EXIT command.

You can create an object which runs a DOS program by placing the program name
(including drive and path) in the object's Program Name field.  When you
select the object, OS/2 will automatically start a temporary VDM to run the
program.  See 817"Temporary" VDMs for additional details.

Once you have created a 4DOS object on your desktop, you may wish to create a
menu item on the desktop menu to run it.  You can do so using OS/2's menu
editing facilities.  If you do, when you start 4DOS from the menu OS/2 will
pass the name of the desktop directory as a command line argument to
4DOS.  This directory name will appear to 4DOS as a COMSPEC path or a
command to be executed, and may result in an error message when the session
is started from the desktop menu.  To avoid this, add a single % sign in
the Parameters field for the object.  The % sign will prevent OS/2 from
passing the directory name, but will be treated as a null parameter by 4DOS.
;---------------------------------------------------------------------------
!TOPIC 815 OS/2 DOS Sessions and 4DOS.INI
!NOINDEX

Each time you start a DOS session, 4DOS will search for 4DOS.INI in the
directory where 4DOS.COM is stored, then in the root directory of the boot
drive.

In most cases, the best strategy is to put 4DOS.INI in the same directory as
4DOS.COM and make sure your 134COMSPEC setting is correct as described
above.  4DOS will use this 4DOS.INI file by default for all DOS sessions.

To use a different .INI file for sessions started from a particular object,
include an @ininame parameter on the DOS_SHELL setting for that
object as described in the previous section.  Be sure to include the full
path and name of the file.  To modify specific 4DOS.INI settings for sessions
started from an object, use one or more //iniline parameters on the
DOS_SHELL setting for the object.  For objects with a [*] in the
program name field, the @ininame or //iniline parameters
may be placed at the beginning of the Parameters field if you wish, rather
than in the DOS_SHELL setting.

You can also use the @ininame parameter on your SHELL= line in the
OS/2 CONFIG.SYS file to change the default location of 4DOS.INI for
all DOS sessions run under OS/2.  If you do so, remember that
changes made in CONFIG.SYS will only take effect after your next reboot, and
will not affect existing objects whose DOS_SHELL setting has been changed
from its default value.

See 352Starting 4DOS for more information on using the @ininame and
//iniline parameters.
;---------------------------------------------------------------------------
!TOPIC 816 OS/2 DOS Sessions and Startup Files
!NOINDEX

Each time you start a DOS session, 4DOS will search for 4START and 4EXIT in
the directory where 4DOS.COM is stored, then in the root directory of the
OS/2 boot drive.  It will search for AUTOEXEC.BAT in the root directory of
the OS/2 boot drive.  Therefore, the same 4START, 4EXIT, and AUTOEXEC.BAT
files will normally be used for all DOS sessions.  You can override these
defaults with the 3724StartPath and 375AutoExecPath directives in
3514DOS.INI.

To select different 4START, 4EXIT, and AUTOEXEC.BAT files for a particular
object, place the files for that object in a directory that is not
one of the default directories described above.  Then create a new 4DOS.INI
file for that object, using the 3724StartPath and /
or 375AutoExecPath directives
to point to the new directory, or use a //4StartPath or //AutoExecPath
directive in the DOS_SHELL setting or parameters field for the object (see
352Starting 4DOS for information about using the "//" parameters).

To disable the default 4START, 4EXIT, or AUTOEXEC.BAT files for a particular
object without selecting alternate files, use the techniques described above
to tell 4DOS to load these files from a directory where they do not
exist.  All three files are optional, so if they do not exist in the
directory specified by 4StartPath or AutoExecPath, they will not be executed.

For more information on 4START and 4EXIT, see 109Automatic Batch Files.
;---------------------------------------------------------------------------
!TOPIC 817 "Temporary" VDMs
!NOINDEX

So far, we have discussed starting a VDM to run 4DOS and get to the DOS
prompt.  OS/2 version 2.x and above also lets you start a temporary VDM, for
example to run a DOS application or batch file from a desktop object.

In a temporary VDM, 4DOS is still loaded as the primary shell even though it
is being invoked to run just a single command or application.  This primary
4DOS shell is also a "transient" shell that exits (back to OS/2) when its job
is done.  Temporary VDMs are created automatically by OS/2 if you set up an
object with the Program Name set to the name of a DOS application.  You can
also start them yourself by using a /C  (see 352Starting 4DOS)
in the Parameters field for a standard 4DOS object.

For example, to create a temporary VDM to run your word processor you might
set up an object like this:

     Program Name:       E:\WORDPROC\WP.EXE
     Parameters:         [blank]
     Working Directory:  D:\LETTERS

You usually won't want a temporary VDM to load all the memory-resident
utilities and execute all the commands that you want when you are setting up
a DOS prompt.  Most often, you will want to set up a simple VDM, run the
command, and exit as quickly as possible.  The 4DOS internal variable
220%_TRANSIENT makes it easy to do just that.  The beginning of your
AUTOEXEC.BAT file could look like this:

     iff %_transient == 1 then
          call setpath
          call aliases
          quit
     endiff

This fragment calls other batch files to set up the path and aliases, but it
does not load TSRs.
;---------------------------------------------------------------------------
!TOPIC 818 4DOS and OS/2 Boot Management Options
!NOINDEX

When you install OS/2, you are given a choice of making it the only operating
system on your computer, or retaining a DOS boot capability as well.

If you retain a DOS boot capability, OS/2 offers two different methods for
switching between DOS and OS/2:  Dual Boot and Boot Manager.  The way you
configure 4DOS to work with OS/2 depends partly on whether you retain a DOS
boot capability on your computer, and, if so, which method you choose.

Dual Boot is invoked with the BOOT command (the program BOOT.COM distributed
with OS/2).  If you use Dual Boot, you will have one copy of CONFIG.SYS and
AUTOEXEC.BAT available on your boot drive when you boot in DOS mode and
another version available when you boot in OS/2 mode.  BOOT.COM works by
swapping the DOS and OS/2 versions of CONFIG.SYS and AUTOEXEC.BAT, as well as
other system data, then rebooting the computer.

Boot Manager uses a different approach.  It lets you install DOS on one hard
drive partition and OS/2 on another partition.  When you boot the computer,
Boot Manager displays a menu and lets you pick which operating system to
boot.  Each partition will have its own versions of CONFIG.SYS and
AUTOEXEC.BAT.

The difference between these approaches is the location and availability
of files.

If you use Dual Boot, the system always boots from the same drive, whether
you are booting DOS or OS/2.  The CONFIG.SYS and AUTOEXEC.BAT files are
switched back and forth as you switch from one operating system to the
other.  The set of files that is in use at any given time is stored in the
root directory of the boot drive, and the set not in use is stored in the
\OS2\SYSTEM directory.

If you use the Boot Manager, the files for DOS reside on one drive (for
example, C) and those for OS/2 are on another drive (for example, D).  The
files are not moved when you switch operating systems.  In both cases, you
can keep the startup files synchronized or independent to meet your own
needs.


CONFIG.SYS

Setting up CONFIG.SYS is very simple, whether you are using Dual Boot or Boot
Manager.  Modify both the DOS and OS/2 CONFIG.SYS files for 4DOS as described
352Starting 4DOS.  The two files remain separate, and any changes to
common items (for example the name of the directory where 4DOS is stored,
used in the SHELL= command) must be made in both files.


AUTOEXEC.BAT

With AUTOEXEC.BAT, you have more flexibility.  Whether you use Dual Boot or
Boot Manager, you will have two standard AUTOEXEC.BAT files:  one for
starting 4DOS under a DOS boot and one for OS/2 DOS sessions.

If you want different commands in AUTOEXEC.BAT for a DOS boot and OS/2 DOS
sessions, you can keep the two files separate and distinct.  Just be sure to
update both files whenever you make changes to the commands they have in
common.  You can also 599CALL other batch files from each copy of
AUTOEXEC.BAT to handle common commands.

You may find that many of the commands in the two AUTOEXEC.BAT files are the
same and that it is more convenient to maintain a single file.  The following
paragraphs explain how to do so.

If you use the Boot Manager, you can put all of your instructions in one file
and start it from the other.  For example, if DOS boots from drive C: and
OS/2 boots from drive D:, your AUTOEXEC.BAT on drive D: could simply be:

     cdd c:\
     autoexec.bat

On a Dual Boot system the startup files are moved each time you boot, so you
cannot start one file from the other as you can with Boot Manager.  If are
using Dual Boot and you want to use the same commands in AUTOEXEC for both
DOS and OS/2, you must put all of your commands into a third file (for
example, C:\SYSTART.BAT), and CALL that file from both the DOS and OS/2
AUTOEXEC.BAT files.

You can also use the 375AutoExecPath directive in 4DOS.INI to force 4DOS
to look in a particular directory for AUTOEXEC.BAT regardless of whether it is
started from an OS/2 DOS session or from a DOS boot, and regardless of the
boot drive.

If you keep commands for both boot modes in a single AUTOEXEC.BAT file, you
can use the internal variable 194%_DOSVER to separate commands to be
executed during a DOS boot from those for an OS/2 DOS session.  %_DOSVER
will be 20 or above for OS/2 DOS sessions.  For example:

     iff %_DOSVER ge 20.0
        rem  Commands for OS/2 DOS go here
     else
        rem  Commands for native DOS go here
     endiff


4DOS.INI, 4START, and 4EXIT

Handling 4DOS's startup and exit files is a little different.  Unlike
CONFIG.SYS and AUTOEXEC.BAT, the other startup files won't be swapped for you
when you switch operating systems with Dual Boot, and they won't be
automatically stored on separate partitions if you use the Boot Manager.  4DOS
normally looks for these files in the directory where 4DOS.COM is stored, so
the same files will be used for both a DOS boot and OS/2 DOS sessions.

To set up one 4DOS.INI file for DOS and another for OS/2 DOS sessions, use
the @ininame parameter on the SHELL= line in CONFIG.SYS (see
352Starting 4DOS).  For example, you might configure the SHELL= line for
DOS to load the default file (4DOS.INI in your 4DOS directory), and use the
@ininame parameter on the SHELL= line in the OS/2 CONFIG.SYS file to
select a different .INI file for OS/2 DOS sessions.  To do so, use a line
like this for DOS:

     SHELL=C:\4DOS\4DOS.COM C:\4DOS /P

And one like this for OS/2 (enter this on one line):

     SHELL=C:\4DOS\4DOS.COM C:\4DOS @C:\4DOS\4DOSOS2.INI /P

To select different 4START and 4EXIT files for DOS and for OS/2 DOS sessions,
place one set of files in a different directory (not the directory where
4DOS.COM is stored).  Then either set up a different 4DOS.INI file for that
boot mode as described above, using 3724StartPath to point to the new
directory, or use a //4StartPath directive on the SHELL= line in CONFIG.SYS
for that boot mode.  For example, this line in an OS/2 CONFIG.SYS file sets
4DOS as the command processor, and tells 4DOS to look for 4START and 4EXIT
in the C:\4DOS\OS2START directory (enter this on one line):

     SHELL=C:\4DOS\4DOS.COM C:\4DOS //4STARTPATH=C:\4DOS\OS2START /P

You can also keep commands for both boot modes in a single 4START or 4EXIT
file, and use 194%_DOSVER to separate the commands to be executed during
a DOS boot from those for an OS/2 DOS session.
;---------------------------------------------------------------------------
!TOPIC 819 Resolving "Cannot find OSO001.MSG" Error
!NOINDEX

If you see a message like "Cannot find OSO001.MSG" when running
external utilities like TREE or DISKCOPY in OS/2 DOS sessions,
you probably need to include the line:

     loadhigh append c:\os2;c:\os2\system

in your AUTOEXEC.BAT file used by these DOS sessions, or set up
the append path in an alias or batch file used to run such
programs (change the drive letter if OS/2 is installed on a
different drive).  Be sure to read the notes and cautions on
764APPEND before using this command.
;---------------------------------------------------------------------------
!TOPIC 821 Novell NetWare
!NOINDEX

For information on diskless workstations see 822NetWare Diskless
Workstations.

The discussion below covers certain
specific problems; if your copy of 4DOS is working properly with
NetWare, you may not need to read it at all.

Some versions of NetWare may occasionally produce a "pipe not
found" message when loading under 4DOS.  This message refers to
NetWare features related to COMMAND.COM, and does not apply to
4DOS; the message can be ignored.

If you use the 4DOS FOR (@filename) command or the %@FILEOPEN and
%@FILEREAD variable functions to process lines from a file, you
may find that the read is terminated after the first line.  This
is because NetWare is closing the file before 4DOS is finished
with it.  To work around this problem, add the following line to
your NET.CFG or SHELL.CFG file (SHELL.CFG is used in older
versions of NetWare, and NET.CFG in more recent versions):

     EOJ=OFF

In certain extremely rare circumstances using EOJ=OFF can leave
files open on your server if an application does not close them
properly.  We have never seen this problem occur in practice but
you may wish to keep it in mind if you must use EOJ=OFF to
prevent NetWare from closing files you are processing.

If you use 4DOS input redirection in a .BAT file which resides on
a NetWare drive, you may experience incorrect file assignments on
some systems.  When this occurs, an application run from within
the batch file, or a secondary shell run from such an
application, may loop forever attempting to read lines from the
batch file rather than accepting input from the keyboard.  For
example:

     copy /r *.* g: < YES
     wp
     rem  Now if the user shells from WP, the system will
     rem  loop forever reading lines from the batch file or
     rem  blank lines at the prompt.

This problem occurs because NetWare does not handle file
assignments properly when 4DOS input redirection is used in a
.BAT file.  You can work around it in several ways:

!INDENT 7 5 5 5
     * Change the batch file to a .BTM file.

     * Place the file BTM mode with the LOADBTM command at any
     point prior to the use of input redirection.

     * Move the file to a non-NetWare drive.

     * User reports indicate that adding a line which does a
     "dummy" output redirection just before the input redirection
     will prevent the problem from occurring.  For example:

!INDENT 7 5 7 0
          echo This is junk > junk.dat
          copy /r *.* g: < YES
          wp
          del junk.dat
!INDENT 0

When loading a secondary 4DOS shell under NetWare you can swap to
a network drive if you wish, but you MUST set SwapReopen = Yes in
4DOS.INI (see 575SwapReopen), or NetWare will close the file and
4DOS will halt with a swap file error.  You can also avoid this
problem by swapping to EMS, XMS, or a local hard disk or RAM disk.

The 398UMBLoad directive in 4DOS.INI is compatible with NetWare.
The 395UMBEnvironment directive is compatible with NetWare 3.11 and
above, but not with earlier versions.
;---------------------------------------------------------------------------
!TOPIC 822 NetWare Diskless Workstations (Novell)
!NOINDEX

4DOS can be set up to run properly on Novell NetWare diskless
workstations which boot from the server.  To do so, you must make
several changes to 4DOS.INI and your other startup files as
detailed below.  The goal of all these changes is to ensure that
there is NO access to the boot drive after the network software
is loaded.

In the discussion below, the term "boot image" refers to files on
the A: drive image set up to boot the workstation.  This text
assumes that your 4DOS files are in the server directory
F:\SYSTEM\4DOS; be SURE to substitute the appropriate path for
your network!

The 4DOS directory on the server should contain at least a copy
of 4DOS.COM, 4HELP.EXE, and 4DOS.HLP.  In this description we
assume other files like secondary copies of 4START and 4DOS.INI
are stored there as well.  You can move any of these files to
another network directory if you change the corresponding
directive below.

To set up 4DOS for your Novell NetWare diskless workstation use the
following steps:

!INDENT 5 5 5 5
     (1) Place a copy of 4DOS.COM into the boot image and be sure the
     SHELL command in the boot image CONFIG.SYS looks like this:

          SHELL=\4DOS.COM @\4DOS.INI /P

     (2) Create a boot image 4DOS.INI file if you don't have one.  Add
     these lines to the file:

          3724StartPath=\
          375AutoExecPath=\
          384InstallPath=F:\SYSTEM\4DOS\
          571NextINIFile=F:\SYSTEM\4DOS\4DOS.INI

     This forces secondary copies of 4DOS to read the .INI file from
     the network, and not from the boot drive.  Any directives which
     you might normally put in the [Secondary] section of 4DOS.INI
     should go into this file (see step 7), and not in the 4DOS.INI
     file that is part of the boot image.

     (3) If you want a 4START file for the primary shell, create one
     and make it part of the boot image.

     (4) Rename your boot image AUTOEXEC file to AUTOEXEC.BTM.  4DOS
     reads each line of a BAT file separately, and keeping AUTOEXEC as
     a BAT file will therefore cause access to the boot image drive
     after the network is loaded.

     This advice violates the usual rule that TSRs should not be
     loaded from a BTM file.  As a result you will have a small "hole"
     in memory when AUTOEXEC is done.  Generally such holes waste a
     small amount of memory, but cause no other trouble, and users
     have not reported any ill effects from this approach.

     (5) Be sure that in AUTOEXEC.BTM you switch the current drive and
     directory to a network drive and directory at some point before
     the file terminates, for example with a command like CDD F:\.
     Otherwise, the current drive will remain the boot drive and 4DOS
     will attempt to access that drive.

     Also be sure that you set the 134COMSPEC variable to the copy of
     4DOS on the network, for example:

          SET COMSPEC=F:\SYSTEM\4DOS\4DOS.COM

     If you don't, secondary shells will not work properly from
     applications run on the workstation.

     (6) Create a new boot image AUTOEXEC.BAT file with one line in it
     which reads:

          AUTOEXEC.BTM

     This transfers control to the AUTOEXEC.BTM file as soon as 4DOS
     starts.

     (7) Create the secondary .INI file <4DOS path>\4DOS.INI (the one
     referred to in the NextINIFile directive in step 2 above), and
     put at least the following line in it:

          4StartPath=F:\SYSTEM\4DOS\

     This forces 4DOS to find 4START and 4EXIT for secondary shells on
     the network drive, and prevents it from attempting to look for
     these files on the boot drive.  There need not be a 4START or
     4EXIT file in this directory, but if you do want to use 4START or
     4EXIT for secondary shells they must be in the specified network
     directory.

     Any other 4DOS.INI directives for secondary shells should also go
     into this file, and not in the 4DOS.INI file that is part of the
     boot image.

     (8) If you wish to swap secondary shells to a network drive add
     this line to the secondary 4DOS.INI file:

          575SwapReopen=Yes
!INDENT 0

After these changes are made, generate a boot image and set up the
diskless workstation normally.  4DOS should start and operate properly
when you boot the workstation.
;---------------------------------------------------------------------------
!TOPIC 841 Compatibility (Other Products)
!NOINDEX

This section includes compatibility information on a range of software
product types and individual products.  Because some products are listed
by type rather than, or (rarely) in addition to, specific listings by
product name, you should check the lists below carefully to see where
any particular product may be covered.

Virtually all of your software will work with 4DOS with no trouble; Most
of the information here covers unusual situations and will not be needed
by most users.  Inclusion of a product in this section does NOT mean
there are compatibility problems with it!  It only indicates that we
have some information that may be useful to you when you use the product
with 4DOS.


Product Types:

     842ANSI Drivers
     8434DOS Swapping and RAM Disks
     8444DOS and Other Command Line Editors
     8454DOS and EXE File Compression Programs
     8464DOS Help and Mouse Drivers
     847NDIS Network Drivers

     848Products Requiring Short PATH
     [includes old versions of CADStar PCB (Racal-Redac), Checkit
     (Touchstone), Computer Select CD-ROM (Ziff-Davis), RenderMan
     (AutoDesk), VINES Network (Banyan), and Word for Windows 6.0
     (Microsoft)]


Specific Products:

!INDENT 5 5 5 5
     The information below is listed alphabetically by product, with
     manufacturers' names included.  Items marked with two asterisks
     [**] after the product name contain information supplied by users,
     and have not been tested by JP Software.

     Many popular software products are not covered here.  If a program
     does not appear here, it simply means that as far as we know no
     additional information is necessary or useful when using that
     program with 4DOS.
!INDENT 0

     8611DIR+ (Bourbaki) [**]
     862Bookshelf CD-ROM (Microsoft) [**]
     863DESQview (Quarterdeck, now Symantec)
     864DOORWAY BBS Software
     865Epsilon (Lugaru Software) [**]
     866FASTIO (Cyrix) [**]
     867FoxPro (Microsoft) [**]
     868Hijaak (Inset Systems)
     869LapLink (Traveling Software) [**]
     870QEMM and QRAM (Quarterdeck, now Symantec)
     871RoboComm Communications Software [**]
     872Software Carousel (SoftLogic Solutions)
     873Stacker (Stac Electronics, Novell, Caldera, IBM)
     874SuperStor (AddStor, Novell, IBM)
     875TSRCOM Utilities (TurboPower Software)
     876UltraVision (Personics)
     877XyWrite (XyQuest / The Technology Group) [**]
;---------------------------------------------------------------------------
!TOPIC 842 ANSI Drivers
!NOINDEX

If you have trouble with screen scrolling in 43-line or 50-line
mode, try a different version of ANSI.  We have had good results
with PC Magazine's free utility ANSI.COM, and with the ANSI-UV.SYS
program distributed with the UltraVision EGA / VGA enhancement
software.

Some display-related device drivers may "fool" 4DOS into thinking
an ANSI driver is present when this is not the case.  If this
happens you will see ANSI strings like "[2J" displayed on-screen
when you use the 604CLS and 605COLOR commands.  To correct the
problem, place an 412ANSI = No directive in 4DOS.INI, or
a 664SETDOS /A2 command in AUTOEXEC.BAT.

Similarly, 4DOS may not be able to detect some ANSI drivers, in
which case the colors you set with CLS and COLOR will not be
"sticky" (i.e. they will be lost when you run an application, or
otherwise change the display color).  To correct the problem,
place an 412ANSI = Yes directive in 4DOS.INI, or a 664SETDOS /A1
command in AUTOEXEC.BAT.

For information on ANSI see 915ANSI Commands.
;---------------------------------------------------------------------------
!TOPIC 843 Swapping to RAM Disks
!NOINDEX

In order to swap the primary shell to a RAM disk the RAM disk
must be completely defined in CONFIG.SYS via a DEVICE= statement
(most RAM disks are set up this way).  RAM disks completely or
partially defined in AUTOEXEC.BAT (such as the RAM disk / cache
combination in Multisoft's PC Kwik Power Pak, or Ciriaco Garca
de Celis' BITDISK) cannot be used for swapping the primary shell,
because AUTOEXEC.BAT has not been executed at the time that the
root shell is loaded, and hence the RAM disk does not exist at
that point.  In some cases, this can be worked around by initializing
the RAM disk via an INSTALL= statement in CONFIG.SYS (supported
since MS-DOS / PC DOS 4.0 or above, and DR DOS 3.41 or above),
but this does not work in all circumstances.

Caution:  Do not use disk swapping on resizeable RAM disks if
you plan on resizing the RAM disk at runtime.  Such drivers do
not normally have options to preserve the contents of the disk while
resizing, with the fatal consequences of loosing the swap file and
therefore 4DOS being unable to swap in again.

;---------------------------------------------------------------------------
!TOPIC 844 4DOS and Other Command Line Editors
!NOINDEX

Programs such as Anarkey (Moderne Software), PCED (Cove Software),
ReDOS (Multisoft), or the built-in command line history facility
available under DR DOS 3.40 and later (configurable by the DR-DOS
CONFIG.SYS HISTORY directive) will work properly with 4DOS.

However these programs require the use of 664SETDOS /L1 to operate,
which will disable 4DOS's command recall and command line
editing.  In most cases you will be able to switch back and forth
between 4DOS editing and the other editor by toggling the SETDOS
/L state.

When another editor is used 4DOS's command history will be maintained,
and can be viewed with the 4DOS 632HISTORY command, but will not be
available for recall until a SETDOS /L0 is executed.  4DOS
aliases, executable extensions, and other features will be active
regardless of the SETDOS /L state.  101Aliases will be processed
after any processing done by the other editing program.  You must
use care with other programs that provide an aliasing capability
to avoid confusion if a command is expanded by both the other
program and 4DOS!
;---------------------------------------------------------------------------
!TOPIC 845 4DOS and EXE File Compression Programs
!NOINDEX

4DOS and several of its associated programs -- OPTION.EXE, 4HELP.EXE,
and BATCOMP.EXE -- can be compressed using an executable packer like
PKLITE, LZEXE, DIET, or UPX.  If you want to customize 4HELP's
operation using HELPCFG, you must run HELPCFG before compressing;
HELPCFG will not be able to modify a compressed copy of 4HELP.EXE.
;---------------------------------------------------------------------------
!TOPIC 846 Mouse Compatibility with 4DOS HELP
!NOINDEX

The 4DOS HELP system depends on correct operation of your mouse
driver.  If your mouse doesn't work in HELP, or you have trouble
with mouse "droppings" (characters left behind by the mouse
cursor), be sure you have the most up to date working version of
your mouse driver that is available.

Users of Microsoft serial and PS/2 mice may notice a long delay
when the HELP system starts.  This is due to the long
initialization time required for these mice, and is a function of
the mouse driver, not the HELP system.  If you don't use the
mouse in HELP and want to speed up HELP startup, set
380HelpOptions = /X in 4DOS.INI.  This will disable all mouse access
in the HELP system.
;---------------------------------------------------------------------------
!TOPIC 847 NDIS Network Drivers
!NOINDEX

Under 4DOS, some NDIS network drivers may hang your system when
the NETBIND program is run in AUTOEXEC.BAT.  This is because
these drivers use memory without allocating it, and 4DOS is then
unable to avoid overwriting the memory used by the drivers.  When
NETBIND runs it attempts to use the corrupted memory area, and
the system hangs.  If you have this problem, you can solve it
using the following steps:

!INDENT 5 5 5 5
     (1) Add this line to 4DOS.INI:

          555MaxLoadAddress=448

     (2) Make sure that NETBIND is the FIRST external program to
     run after 4DOS starts.  Do not run ANY other external program
     prior to NETBIND, in either 4START or AUTOEXEC.

     (3) If you cannot run NETBIND first, add a SWAPPING OFF
     command at the beginning of AUTOEXEC, and a SWAPPING ON
     command immediately before NETBIND is run.  However, we
     strongly recommend that you run NETBIND first if at all
     possible.
!INDENT 0

Many NDIS drivers do not exhibit this problem; if your NDIS
drivers work properly, there is no need to make the changes shown
above.
;---------------------------------------------------------------------------
!TOPIC 848 Programs Requiring Short PATH
!NOINDEX

The following programs contain bugs which prevent them from
working properly if you have a 138PATH which is over 128 characters
long.  Since 4DOS allows you to create a PATH up to 506
characters long this can appear to be a conflict between the
program involved and 4DOS (see also: 753Path Lengths).  If your
path is longer than 128 characters, reduce its size using
the 649PATH or 622ESET command and see if the application
starts working.  If so, use a batch file or alias to
set up an alternate path for running that one program, for example:

     setlocal
     path d:\myprog
     d:\myprog\myprog.exe
     endlocal

The 665SETLOCAL / 621ENDLOCAL pair saves and restores the environment;
when you're done, the old PATH will be restored automatically.


!INDENT 5 5 5 5
     CADStar PCB (Racal-Redac):  [**]  CADStar PCB will hang your
     system if it is started with a path longer than 128 characters.

     Checkit (Touchstone):  [**]  Checkit version 3 requires a
     path length under 128 characters.

     Computer Select CD-ROM (Ziff-Davis):  [**]  Computer Select
     cannot find its help program if your PATH is over 128
     characters long.

     RenderMan (AutoDesk):  RenderMan will hang your system if it
     is started with a PATH longer than 128 characters.

     VINES Network (Banyan):  [**]  VINES' installation may not
     work properly if your PATH is longer than 128 characters.

     Windows 3.0 (Microsoft):  The Windows 3 Setup Applications
     option, which scans your disk drives for applications to be
     added to Windows program groups, will not work properly if
     your PATH is more than 128 characters long.  This problem is
     fixed in Windows 3.1.

     Word for Windows 6.0 (Microsoft):  The Word for Windows
     version 6 help system will not work properly if your PATH is
     more than 128 characters long.  This problem is fixed in Word
     for Windows 6.0a and above.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 861 1DIR+ (Bourbaki)
!NOINDEX

1DIR+ will work properly under 4DOS in its partially resident or
EMS modes when set up as described below.  It will work in its
fully resident mode but cannot reliably exit back to 4DOS once
started.

If your copy of 1DIR+ is set up for fully resident mode, you can
load it into memory under 4DOS to switch it to partially resident
or EMS mode.  To do so, from the directory where you normally run
1DIR+, type the commands:

     setdos /l1
     1dirplus

When 1DIR+ starts go to the "Wonder" / "Setup" menu and switch
the mode to partially resident or EMS.  Hit Esc to exit, and take
the "Exit/Save" option (not "Save/Reset").  Back at the main
menu, exit with "Wonder" / "Exit".  At this point the system will
probably hang.  Reboot your computer.  You should then be able to
run 1DIR+ as described below.

The above steps only need to be done once, when you install or
re-install 1DIR+.

Once 1DIR+ is set to EMS or partially-resident mode, you can
start it from 4DOS using the following alias:

     alias 1dir `setdos /L1 ^ 1dirplus`

The SETDOS /L1 is necessary to allow 1DIR+ to send command lines
to 4DOS.

You must do a SETDOS /L0 when you are done with 1DIR+ in order to
get normal 4DOS command-line editing back.  You can NOT do this
within the alias above, as 1DIR+ returns to 4DOS in order to
accomplish its work, and you don't want to switch back to /L0
mode until 1DIRPLUS has been removed from memory.  If, after
exiting from 1DIR+, you find that 4DOS's command line editing and
history are unavailable, it is because you forgot to do the
SETDOS /L0.  If you go in and out of 1DIR+ regularly aliases like
the following can be used to make the process quick:

     alias 1d `setdos /L1 ^ 1dirplus`
     alias 1e setdos /L0

If you run batch files from the 1DIRPLUS "compose" feature, you
may find that INPUT commands in the batch file don't work
properly unless they are preceded by SETDOS /L0.  You must also
do a SETDOS /L1 before the end of the batch file, or 1DIRPLUS
won't pop up properly when the batch file is finished.  For
example:

     setdos /l0
     input Enter your name:  %%name
     setdos /l1
;---------------------------------------------------------------------------
!TOPIC 862 Bookshelf CD-ROM (Microsoft)
!NOINDEX

Microsoft Bookshelf uses the environment variable CDPATH, which
is also used (for a totally different purpose) by 4DOS.  If you
are using MS Bookshelf and want to set a 049CDPATH variable for
4DOS, set 144_CDPATH instead.  4DOS will search for _CDPATH first;
when it is found, 4DOS will use it, and ignore CDPATH.
;---------------------------------------------------------------------------
!TOPIC 863 DESQview (Quarterdeck, now Symantec)
!NOINDEX

4DOS works well as both the primary shell loaded before DESQview,
and as the secondary shell loaded inside any DESQview window.

To use 4DOS as a secondary shell with DESQview, you must add it
to your DESQview "Open Window" menu.  To do this, select the Add
a Program option, then press the "O" key (for Other Program).
Press Enter and you will get an Add a Program window.  You'll
need to modify settings on the standard first screen, and on the
second "advanced options" screen.  Set the Program Name to
C:\4DOS\4DOS.COM (adjust the drive and path for your own
computer).  Set the Parameters to whatever 4DOS startup options
you want, but do not use /C or /P.  For other DESQview
parameters, the defaults are workable with the following changes:

To run 4DOS in a full-screen window:

    Writes Text Directly to Screen:    Y    (screen 1)
    Virtualize Text / Graphics:        N    (screen 1)
    Close on Exit to DOS:              Y    (screen 2)
    Uses its Own Colors:               Y    (screen 2)

To run 4DOS in a window smaller than the full screen:

    Writes Text Directly to Screen:    N    (screen 1)
    Virtualize Text / Graphics:        Y/T  (screen 1)
    Close on Exit to DOS:              Y    (screen 2)
    Uses its Own Colors:               Y    (screen 2)

4DOS is written to be "DESQview-aware", and will not "bleed
through" to other windows when running full-screen commands such
as HELP, LIST, or SELECT.

You should normally exit a DESQview 4DOS window with the EXIT
command, rather than with the Close option on DESQview's main
menu.  If you do use the Close option while at the 4DOS prompt,
4DOS will be notified of your action and will clean up its
resources (for example, the shell number and disk swap file in
use in that window).  However this notification has a side-effect:  it
disables the Quit option on the DESQview main menu
(this is a feature of DESQview).  To disable the notification and
reenable the Quit option, you can use a DVCleanup = No directive
in 4DOS.INI.  If you do so, be sure to exit 4DOS windows with the
EXIT command to avoid leaving stray swap files on your disk or
inadvertently using up 4DOS shell numbers.

Some users report that DESQview uses all upper memory space when
it loads, leaving no upper memory available to 4DOS.  If you have
398UMBLoad and / or 395UMBEnvironment set to Yes in 4DOS.INI, this
will result in a couple of harmless error messages when 4DOS is
started under DESQview.  To eliminate these messages, place the
following lines at the end of 4DOS.INI:

     [Secondary]
     UMBLoad = No
     UMBEnvironment = No

DESQview includes the ability to assign "logical drives" to
subdirectory paths to make access to commonly used directories
easier, or to support older applications that can't handle
subdirectories.  This is similar to the DOS SUBST command.  4DOS
commands like DIR and COPY may not work as you expect on DESQview
logical drives, because DESQview does not support certain
standard DOS calls which 4DOS uses to determine whether a name
you enter is the name of a file or a subdirectory.  If you are
using specific filenames without wildcards, 4DOS commands will
generally work properly on DESQview logical drives.  However
problems may occur with "implied wildcards" (for example, when
4DOS interprets DIR A* as DIR A*.*), filename completion, and
other wildcard file access.  We know of no circumstances where
these problems would cause a loss of data.  However for the sake
of safety, when using DESQview logical drives we suggest you use
the /N switches on commands like COPY and MOVE to verify the
command's operation before files are actually modified.

Under 4DOS, the DESQview DOS Services option will not work in its
default configuration.  To make DOS Services work under 4DOS, you
must first create a batch file, DOSSERV.BAT, in your DESQview
directory to run DOS Services under COMMAND.COM.  (We are
assuming that DESQview is in directory C:\DV and COMMAND.COM is
in directory C:\; you will need to modify the settings below if
your system is configured differently.)  The batch file is:

     set comspec=c:\command.com
     c:\dv\dosserv
     c:\command
     exit

Then, make the following changes on the DESQview change a program
screen for DOS Services (items marked ** are on the second page
of the screen):

     *   Memory Allocation = 128K or greater
     *   Program Name = C:\DV\DOSSERV.BAT (modify from
         previous value of C:\DV\DOSSERV).
     **  Close on Exit to DOS = N
     **  System Memory = 10K or greater
     **  Allow Close Window = N

Once these steps are taken, you should be able to open the DOS
Services window normally.  However you will not be able to close
it with a close window command.  Instead, go to the window where
DOS Services allows you to compose a DOS command, and type EXIT
to close the window.
;---------------------------------------------------------------------------
!TOPIC 864 DOORWAY BBS Software
!NOINDEX

DOORWAY uses the caret [^] in certain command line arguments.  4DOS will
interpret this symbol as a command separator, and will
not pass the line to DOORWAY properly.  You can work around this
problem by changing your 4DOS command separator permanently (with
the CommandSep directive in 4DOS.INI) or temporarily when
starting DOORWAY (with the SETDOS /C command), or by using the
4DOS escape character (Ctrl-X) before each caret in the DOORWAY
command line.
;---------------------------------------------------------------------------
!TOPIC 865 Epsilon (Lugaru Software)
!NOINDEX

Epsilon can run 4DOS as a concurrent process, and pass commands
to 4DOS for execution.  In this mode it traps 4DOS's input
requests and feeds the keystrokes to 4DOS.  However it does not
feed backspaces etc. -- only actual characters.  This means that
editing of input isn't seen by 4DOS.  To fix the problem, either
run 4DOS as a shell, and not as a concurrent process, or use a
SETDOS /L1 for the copy of 4DOS that is run under Epsilon.

To use the more flexible SETDOS /L1 approach you must use
4START.BAT (or .BTM) to set up the SETDOS /L1 before running
Epsilon.  Epsilon sets the environment variable EPSRUNS=Y
whenever it starts a secondary shell; you can use this variable
to set up 4START to work with Epsilon.  Place the following line
in 4START to issue the SETDOS /L1 command in a secondary shell
started by Epsilon, but ignore it otherwise:

     if "%epsruns"=="Y" setdos /l1
;---------------------------------------------------------------------------
!TOPIC 866 FASTIO (Cyrix)
!NOINDEX

The FASTIO hardware utility (distributed with some systems
containing Cyrix microprocessors) contains a bug which can hang
your system if FASTIO is run under 4DOS.  The hang will occur any
time Ctrl-C or Ctrl-Break is pressed after FASTIO runs.  This bug
has been fixed by Cyrix; contact your system vendor for a
corrected version of FASTIO.
;---------------------------------------------------------------------------
!TOPIC 867 FoxPro (Microsoft)
!NOINDEX

FoxPro works well with 4DOS, but may have trouble if 4DOS or the
master environment is loaded high (in a UMB).  If you experience
compatibility problems between FoxPro and 4DOS, try removing any
395UMBEnvironment = Yes line in 4DOS.INI; if that doesn't help, try
removing any 398UMBLoad = Yes line as well.
;---------------------------------------------------------------------------
!TOPIC 868 Hijaak (Inset Systems)
!NOINDEX

4DOS is generally compatible with Hijaak.  However the DOSCAP
utility can sometimes interfere with 4DOS's disk swap file,
causing the system to hang.  If you experience a problem with
DOSCAP and disk swapping, configure your system to swap to EMS or
XMS memory.
;---------------------------------------------------------------------------
!TOPIC 869 LapLink (Traveling Software)
!NOINDEX

LapLink's "self-cloning" feature may not work properly with
4DOS's CTTY command.  If you need to use the self-cloning
feature, start a temporary copy of COMMAND.COM first (see
"Running 4DOS along with COMMAND.COM" at the beginning of this
file for details).
;---------------------------------------------------------------------------
!TOPIC 870 QEMM and QRAM (Quarterdeck, now Symantec)
!NOINDEX

Both QEMM and QRAM are compatible with 4DOS, and will allow you
to load the 4DOS resident code and the master environment into high
DOS memory (UMBs) via the 398UMBLoad and 395UMBEnvironment directives
in 4DOS.INI.  For these directives to work with QRAM
you must have QEXT loaded also (this is the normal method of
loading QRAM).

QEMM's Stealth mode is compatible with 4DOS, but can decrease
general system stability on some systems.  If you have unusual
problems or system hangs with Stealth turned on, try turning it
off and see if the problems clear up (this is the procedure
recommended by Quarterdeck in their Stealth documentation).

If you use FILES.COM to load part of the DOS file handle table
into high memory, you must follow Quarterdeck's recommendations
and keep a minimum of FILES=8 in CONFIG.SYS.  Lower values may
cause 4DOS to hang during boot, especially if disk swapping is
used.

If you use QEMM's OPTIMIZE and your AUTOEXEC has 4DOS-specific
commands like GLOBAL, IFF, aliases, etc., OPTIMIZE will recognize
them based on the 4DOS.CMD file distributed with QEMM.  This
ASCII file contains a simple list of 4DOS commands.  If you have
a version of 4DOS.CMD created before 4DOS 6.0 was released, you
may want to make it complete by adding the following new
commands:  DIRHISTORY, ECHOERR, ECHOSERR, OPTION, SWITCH, TOUCH, and
TREE.  To use 4DOS.CMD it must be renamed to OPTIMIZE.NOT before running
OPTIMIZE; see your QEMM documentation for details.

If you have used aliases to redefine standard internal commands
like COPY (for example, to ensure that COPY always prompts you
before replacing an existing file), QEMM's OPTIMIZE may not
always work properly because the commands will not perform as it
expects.  Before running OPTIMIZE you may want to temporarily
disable any 4DOS aliases (e.g., with a REM on the line(s) in
AUTOEXEC.BAT or 4START which load the aliases).

QEMM OPTIMIZE may attempt to use a LOADHI command on the SHELL=
line in CONFIG.SYS to load 4DOS into upper memory.  4DOS was
designed to load itself into upper memory, and memory managers
sometimes cannot load 4DOS there correctly.  Therefore 4DOS works
best if its own directives (UMBLoad etc.) are used instead of
LOADHI.  In some cases your system may hang if you try to load
4DOS into upper memory with LOADHI.  To prevent OPTIMIZE from
placing a LOADHI command on your SHELL= line, and allow 4DOS to
load itself into upper memory, use the /NOSHELL switch when you
start OPTIMIZE, for example:

     optimize /noshell

This problem does not affect the use of LOADHI with other
programs.  It only occurs if LOADHI is used to load 4DOS itself.

If you load 4DOS or 4DOS data blocks into upper memory, you can
specify a particular upper memory region with UMBLoad and other
similar directives in 4DOS.INI, as long as you also have DOS=UMB
enabled in CONFIG.SYS.  QEMM offers similar region selection
capability for the command processor through its LOADHI command,
and this may be enabled automatically when you run OPTIMIZE (you
can find out by checking the SHELL= line in CONFIG.SYS to see if
it begins with a LOADHI command placed there by OPTIMIZE).

Neither of these methods of region selection is optimal.  If you
use 4DOS region selection you must use DOS=UMB, which may not
give the optimum arrangement for memory-resident programs and
device drivers.  However QEMM region selection with LOADHI uses
some unusual techniques which may not work with 4DOS (your system
may hang when 4DOS loads), depending on your configuration.

There are three ways to work around this problem:

!INDENT 5 5 5 5
     (1) Allow OPTIMIZE to select a region for 4DOS and use LOADHI
     to put it there.  If this causes a system hang, use one of
     the other techniques.

     (2) Set up the SHELL= line without LOADHI and load 4DOS
     normally.  Then enable DOS=UMB and use the 4DOS region
     selection capability (UMBLoad=n, etc.) in 4DOS.INI.

     (3) Set up the SHELL= line without LOADHI and load 4DOS
     normally.  Then allow QEMM to load 4DOS into the first
     available region by setting UMBLoad=Yes, etc. in 4DOS.INI.
!INDENT 0
;---------------------------------------------------------------------------
!TOPIC 871 RoboComm Communications Software
!NOINDEX

If you have trouble shelling out of RoboComm (for example, to use
an external protocol like DSZ), try increasing the setting for
Files and Extract memory to 256K.
;---------------------------------------------------------------------------
!TOPIC 872 Software Carousel (SoftLogic Solutions)
!NOINDEX

The information below applies to all versions of Software Carousel.

Software Carousel will not work properly with 4DOS loaded as the
primary shell.  It is designed with the assumption that
COMMAND.COM is the system command processor, and contains logic
which specifically depends on COMMAND.COM and the way it is
written, and which actually modifies the copy of COMMAND.COM in
memory.  This makes it impossible to write a program which works
properly as an alternate command processor loaded underneath
(i.e. before) Software Carousel.

However, 4DOS can be run without difficulty inside a Software
Carousel partition, if the instructions below are followed.

When loading 4DOS into a Carousel partition, the best method is
to leave the 134COMSPEC set to COMMAND.COM when Carousel is loaded.
4DOS should then be set up in the Carousel options file just like
any other program.  For example, to load 4DOS into partition 1:

     d:\path\4DOS.COM [parameters] [filename]

where:

     d:\path         is the drive and path where 4DOS.COM is located

     [parameters]    is any 4DOS command line parameters (/E,
                     @ininame, etc.; do NOT use /P here)

     [filename]      is the name of a batch file to be executed
                     when the partition is started

To use different 4DOS.INI files for different Software Carousel
partitions, use the "@ininame" parameter in the "parameters"
section of your Carousel setup to invoke a specific file.  For
example, the parameters could be set to @D:\WP\4DOSWP.INI to use
that initialization file for the WP partition.

Because 4DOS can only be loaded in a partition when running
Software Carousel, and not as the primary command processor,
if you use disk swapping you will probably want to use the
576UniqueSwapName directive in 4DOS.INI to avoid swap file name
conflicts.
;---------------------------------------------------------------------------
!TOPIC 873 Stacker (Stac Electronics, Novell, Caldera, IBM)
!NOINDEX

4DOS fully supports Stacker compressed drives, including the stand-alone
Stacker versions from Stac, the issue of Stacker shipping with Novell DOS 7,
Caldera OpenDOS 7.01, and DR-DOS 7.02 and above, as well as the issue of
Stacker bundled with IBM PC DOS 7.0 and PC DOS 2000, including all
DPMS-enabled versions.  The 4DOS DIR and SELECT commands cannot display
compression ratios on Stacker drives, because certain information required
for this function is not readily available to 4DOS under the current
Stacker software.
;---------------------------------------------------------------------------
!TOPIC 874 SuperStor (AddStor, Novell, IBM)
!NOINDEX

4DOS fully supports SuperStor compressed drives, under all, the
stand-alone SuperStor and SuperStor-Pro versions from AddStor,
the issue of SuperStor bundled with DR DOS 6.0 as well as the
DPMS-enabled version found in some later issues of DR DOS,
as well as SuperStor/DS as bundled with some versions of
IBM PC DOS 6.x.  You can display and sort by compression
ratios on SuperStor drives with the DIR /C and /O:c switches
(the same switches also work with SELECT).
;---------------------------------------------------------------------------
!TOPIC 875 TSRCOM Utilities (TurboPower Software)
!NOINDEX

The TSRCOM utilities will work properly with 4DOS as long as you
use TSRCOM version 2.6 or later.  The current release is version
3.5 or later, and is available on the 4DOS Utility Disk and on
many bulletin boards and on-line systems.

If you use TSRCOM's MARK and RELEASE to manage your TSRs, 4DOS
swapping (as set with the SWAPPING command) must be in the same
state when RELEASE is run as it was when MARK (or FMARK) was run.
This is a characteristic of the design of MARK and RELEASE (or
any other such products), and not a bug.  If you do not observe
this rule (for example, if you run MARK with SWAPPING OFF in
AUTOEXEC and later run RELEASE from the prompt with SWAPPING ON),
you may receive unusual error messages or hang your system.  The
same restriction applies to MARKNET and RELNET.
;---------------------------------------------------------------------------
!TOPIC 876 UltraVision (Personics)
!NOINDEX

The DE program distributed with UltraVision is written
specifically for COMMAND.COM, and cannot be used to set directory
colors with 4DOS.  Use 4DOS's built-in directory colorization
instead.
;---------------------------------------------------------------------------
!TOPIC 877 XyWrite (XyQuest / The Technology Group)
!NOINDEX

The "shell to DOS" capability of earlier versions of XyWrite
(published by XyQuest) shells to COMMAND.COM, even if you have
your 134COMSPEC variable set to 4DOS.  The only way we know of to
work around the problem is to make a copy of 4DOS.COM and call it
COMMAND.COM.  If you do this, be sure to save the real
COMMAND.COM in another directory in case you need it for another
purpose.  Some users have reported that the same problem occurs
with Signature, a newer word processor from XyQuest.

XyWrite 4, from The Technology Group (the successor to XyQuest)
uses the shell specified by COMSPEC, and has no known
compatibility problems with 4DOS.
;---------------------------------------------------------------------------
!TOPIC 891 Miscellaneous Reference Information
!NOINDEX

For additional reference information see:

     892Colors and Color Names
     893Keys and Key Names
     894Popup Windows
     895Executable Files and File Searches
     896How 4DOS Uses Memory
     915ANSI Commands
     797Relocating 4DOS
     798Technical Information for Programmers
     799Keywords Used by 4DOS
;---------------------------------------------------------------------------
!TOPIC 892 Colors and Color Names
!NOINDEX

You can use color names in several of the directives in the 3514DOS.INI
file and in many commands.  The general form of a color name is:

     [BRIght] [BLInk] fg ON [BRIght] bg [BORder bc]

where fg is the foreground or text color, bg is the background
color, and bc is the border color.

The available colors are:

     Black          Blue           Green          Red
     Magenta        Cyan           Yellow         White

Color names and the words BRIght, BLInk, and BORder may be shortened to the
first 3 letters.

You can also specify colors by number instead of by name.  The numbers are
most useful in potentially long .INI file directives like ColorDir, where
using color names may take too much space.  The following numbers are
recognized:

        0 - Black     8 - Gray (bright black)
        1 - Blue      9 - Bright blue
        2 - Green    10 - Bright green
        3 - Cyan     11 - Bright cyan
        4 - Red      12 - Bright red
        5 - Magenta  13 - Bright magenta
        6 - Yellow   14 - Bright yellow
        7 - White    15 - Bright white

Use one number to substitute for the [BRIght] fg portion of the color name,
and a second to substitute for the [BRIght] bg portion.  For example,
instead of bright cyan on blue you could use 11 on 1 to save space in a
ColorDir specification.

There are several subtleties that complicate the use of colors and color
names.  In order to understand them, you will need to read through the
restrictions described below.  These restrictions are due to the design of
your PC video hardware, BIOS, and video drivers, and are not inherent in
4DOS.  Some of the restrictions are complex, so feel free to skip over
those that do not apply to color combinations you use.

Some restrictions depend on the display "mode."  4DOS can run in either
full-screen display mode, when 4DOS is using the entire
screen and has more direct control over the video hardware; or in windowed
display mode, when it appears in a window as part of a graphical display
under Windows or OS/2.


Color Errors

A standard color specification allows sixteen foreground and eight
background colors (sixteen if bright backgrounds are enabled, see below).
However, most video adapters and monitors do not provide true renditions of
certain colors.  For example, most users see normal "yellow" as brown, and
bright yellow as yellow; many also see normal red as red, and "bright red"
as pink.  Color errors are often much worse when running in windowed mode
(see above), because the graphical environment that created the window may
not map the text-mode colors the way you expect.  These problems are
inherent in the monitor, video adapter, and driver software.  They cannot
be corrected using 4DOS color specifications.


Border Colors

In order to use border colors, you must have a color video adapter.

4DOS can only accept border colors in the 604CLS and 605COLOR
commands, and in the 471StdColors directive in 4DOS.INI.  Border
colors will be ignored, or will cause an error, if they are used elsewhere.

Border colors do not work in windowed mode, and will be ignored if used in
a windowed session under Windows or OS/2.


Blinking Text and Bright Background Colors

The interactions between blinking characters, bright backgrounds, and your
display mode can be complex.  You will need to understand them if you use
either attribute in your color specifications.

The effects of blinking and bright background color specifications depend
partly on whether you are in full-screen or windowed display mode.


Full-Screen Display Mode

Full-screen display mode uses the entire screen for 4DOS or your
application.  This mode is the only one available in DOS; it is
available as an option for text-mode sessions in Windows and OS/2.

In full-screen display mode your video hardware can be configured via
software commands to display either blinking text, or text with a
bright background, but not both.  This is due to the design of PC video
hardware, and is not a software restriction.

In full-screen display mode, the configuration of your video adapter can
be controlled by 4DOS with the 461BrightBG directive in the 4DOS.INI
file or the 664SETDOS /B command.  If you set BrightBG = No or use
the SETDOS /B0 command, 4DOS will configure the video adapter for blinking
text, and all characters on the screen with the blink / bright background
flag set will blink.  If you set BrightBG = Yes or use SETDOS /B1, 4DOS
will configure the video adapter for bright background colors, and the
characters will be displayed with a bright background instead of blinking.

Because there is only one flag for each character to specify both blinking
text and bright background color, it doesn't matter which attribute you use
when you specify the color.  Whether you specify blinking text or a bright
background, you will see the same thing on your screen.  For example, these
two 605COLOR commands will always produce the same results:

     color blink white on blue
     color white on bright blue

If bright backgrounds are enabled, both commands will produce white text on
a bright blue background.  If blinking text is enabled, both commands will
produce blinking white text on a blue background.

If you don't use BrightBG or SETDOS /B, or if you use SETDOS /B2, 4DOS will
not attempt to configure your video hardware.  Most video adapters default
to blinking text in full-screen mode, but this can be changed by application
programs.  If you use BrightBG or SETDOS /B, 4DOS will configure the hardware
each time it displays the prompt.


Windowed Display Mode

Windowed display mode uses a window on the screen for 4DOS or your
text-mode application.  It is available for command processor sessions
and most applications running under Windows or OS/2.

In windowed mode, 4DOS cannot control your hardware to select blinking or
bright backgrounds.  Instead, Windows and OS/2 both display bright
background colors, regardless of the BrightBG or SETDOS /B setting.
They do not provide a way to display blinking characters in windowed mode.
As an example, the two commands given above would both display white text on
a bright blue background when run in windowed mode.


Switching Modes

Windows and OS/2 allow you to switch any DOS or other text-mode session
between full-screen and windowed mode.  For example, when running 4DOS
in a DOS session under Windows, you can switch modes by pressing
Alt-Enter.  Switching modes will usually alter color rendition, as
you switch between direct interaction with the video board (in
full-screen mode) and the color mapping provided by your graphical
environment (in windowed mode).  In addition, switching modes may alter
the display of blinking text and bright background characters as described
above.

If BrightBG is set to Yes, bright background colors will be preserved when
you switch modes.  However, if BrightBG is set to No, the display will
shift from blinking text in the full-screen mode to bright background
colors behind that text in the windowed mode.  This effect can be
disturbing; you may need to take it into account if you write batch files
or aliases which may be used in either mode.
;---------------------------------------------------------------------------
!TOPIC 893 Keys and Key Names
!NOINDEX

Key names are used to define keystroke 595aliases, in several
3514DOS.INI directives, and with the 638KEYSTACK command.  The
format of a key name is the same in all three uses:

     [Prefix-]Keyname

The key prefix can be left out, or it can be any one of the following:

     Alt    followed by A - Z, 0 - 9, F1 - F12, or Bksp
     Ctrl   followed by A - Z, F1 - F12, Tab, Bksp, Enter, Left, Right,
              Home, End, PgUp, PgDn, Ins, or Del
     Shift  followed by F1 - F12 or Tab.

The possible key names are:

     A - Z          Enter          PgDn
     0 - 9          Up             Home
     F1 - F12       Down           End
     Esc            Left           Ins
     Bksp           Right          Del
     Tab            PgUp

All key names must be spelled as shown.  Alphabetic keys can be specified
in upper or lower case.  You cannot specify a punctuation key.

The prefix and key name must be separated by a dash [-].  For example:

     Alt-F10        This is okay
     Alt F10        The space will cause an error

If you prefer, you can use a numeric value instead of a key name.  Use the
ASCII code for an ASCII, extended ASCII, or control character.  Use the
scan code preceded by an at sign [@] for extended key codes.  For example,
use 13 for Enter, or @59 for F1.  In general, you will find it easier
to use the names described above rather than key numbers.  See
911ASCII and Key Codes for an explanation and list of ASCII and key codes.

Some keys are intercepted by your operating system or BIOS and are not
passed on to 4DOS.  For example, Ctrl-S pauses screen output
temporarily, and on some systems Ctrl-P toggles Print Echo mode (where
text displayed on the screen is automatically echoed to the printer).  Keys
which are intercepted by DOS or the BIOS generally cannot be assigned to
aliases or with 481key mapping directives, because 4DOS never
receives these keystrokes and therefore cannot act on them.

You also may not be able to use certain keys if your keyboard is not 100%
IBM-compatible, or if your keyboard driver or 842ANSI driver does not
support them.  For example, on some systems the F11 and F12 keys are not
recognized; others may not support unusual combinations like Ctrl-Tab.
These problems are rare; when they do occur, they are usually due to DOS
and/or your keyboard or ANSI driver.
;---------------------------------------------------------------------------
!TOPIC 894 Popup Windows
!NOINDEX

Several features of 4DOS display popup windows.  A popup window may be used
to display filenames, recently-executed commands, recently-used directories,
the results of an extended directory search, or a list created by the SELECT
command or the @SELECT internal function.

Popup windows always display a list of choices and a cursor bar.  You can
move the cursor bar inside the window until you find the choice that you wish
to make, then press the Enter key to select that item.

Navigation inside any popup window follows the conventions described below.
Additional information on each specific type of popup window is
provided where that window is discussed.

You can control the color, position and size of most popup windows from
the Windows page of the 648OPTION dialogs.  You can also control
these features with directives in the .INI file, including 440PopupWinLeft,
PopupWinTop, PopupWinWidth, and PopupWinHeight, and
464PopupWinColors.  The 048extended directory search window has its
own specific .INI 417directives and corresponding separate choices in                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       