c:\test\> _





4DOS Versions
4NT Versions
4OS2 Versions
4DOS Tips & Tricks
4DOS Docs
4DOS Batches, Aliases, Functions
  B. Schneider's
  K. Meinhard's
4DOS Links
4DOS Tools



DOS Alternatives

DOS Hardware

DOS Tools

DOS Programs

DOS Gems


Search Engines

Contact me

Back to Homepage

4DOS V3.nn  Version History

This page can be downloaded in MS-Word .doc format.

4DOS Change Log - this log describes changes and bug fixes to version 3.nn of 4DOS

Version 3.0, 3/7/90
General Enhancements:


Installation and Configuration

  • The 4DOS loader (4DOS.COM) has been completely rewritten. It now takes a little under 3K of low memory (less than COMMAND.COM!). In version 2.21 it required close to 5K.
  • 4DOS now supports swapping to XMS extended memory. In order for it to work you must have an XMS driver such as HIMEM.SYS loaded, or an equivalent program such as 386MAX or QEMM 5.0.
  • The resident portion of 4DOS and the master environment can now be loaded high if your hardware and software support XMS Upper Memory Blocks (UMBs). If both options are used 4DOS's low-memory footprint can be reduced to as little as 256 bytes. See the options section below for details.
  • The 4DOS loader now distinguishes processor types more carefully when loading the EXE file. 4DOS286.EXE (which in fact runs on any 80186 / 188 or later processor) will now automatically be loaded for all processors other than 8086 / 88. This should make NEC V20 / V30 systems run 4DOS286 automatically.
  • The loader now displays the size of the swap area being used in K, e.g. "EMS swapping initialized (80K)".
  • IF 4DOS is swapping to EMS and your EMS driver supports the LIM EMS 4.0 specification, EMS swapping blocks will be named 4DOS:nnn where nnn is the shell nesting level (000 for the primary shell). Previously the blocks were unnamed. They will remain unnamed on EMS 3.2 systems.
  • Errors detected by the low memory portion of 4DOS are now quite cryptic, to save space in low memory. They all read simply "4DOS error XX". See the Error Messages appendix in the manual for the meaning of the codes.

Aliases and Environment:

  • Aliases are now in a separate block, whose size is defined with the new SHELL and 4DSHELL parameter /A:nnnn. You will need to add this parameter, and probably reduce your environment size accordingly.
  • Since aliases are in a separate block, there is little need to swap out the master copy of the environment to save space. Therefore 4DOS defaults to a memory-resident master environment (formerly selected with the /M command line option), whether you specify the environment size with /E or /M.

Command Line Options:

  • The new /A:nnnn switch specifies the size of the alias buffer, in
  • The history and environment limits have been changed. The new values for environment, aliases, and history are (all in bytes):

                Min   Max   Default
                ----- ----- -------
    Environment 256   32000  512
    Aliases     256   32000 1024
    History     256    8192 1024


  • The /M switch is obsolete, but will still be accepted. It is equivalent to /E.
  • /E:nnnn may be followed by U (/E:nnnnU) to load the master environment into a UMB in high DOS memory. See the information on /U below regarding hardware/software compatibility and UMB access.
  • The new /U switch requests that 4DOS load its resident portion into an Upper Memory Block (UMB) at the high end of DOS memory. You must have the appropriate hardware and XMS driver software for this option to work; if you don't the resident portion will simply be loaded normally in low memory. See COMPAT.DOC for the latest details on what hardware and software is required for 4DOS to access UMBs.

Technical Information on Installation:

  • 4DOS.COM has been modified to set the PSP memory size, rather than relying on DOS to do it properly. This allows 4DOS's swapping mode to work properly in the OS/2 compatibility box.
  • The critical error and ctrl-C / ctrl-break handlers are now in low memory all the time. Previously they were in high memory, and switched to low memory when an application was run. This should solve some compatibility problems with programs that wanted these handlers to be in low memory and/or to have their addresses fixed, rather than changing each time an application was run.
  • 4DOS now hooks interrupt 2E (in the primary shell only). Some programs use this to find the root command processor and/or global master environment. Note 4DOS does NOT process INT 2E in any way, it just returns. But it does hook it.

Features and Usage

General Features:

  • "4DOS286" is now compiled in 186-compatible mode to assure compatibility with NEC V20/V30 microprocessors. This does not affect the speed or size of the EXE file.
  • The functions that accept multiple arguments (COPY, MOVE, DEL, RENAME, etc.) no longer abort on an error - they will continue processing the remainder of the arguments, and then return an error. This will allow things like DEL *.BAK to continue when a read-only file exists among the .BAK files and cannot be deleted.
  • SHARE / LAN support has been added for all file I/O. (For example, LIST and TYPE open their files in "deny write" mode; other systems can still read the files, but can't write them while LIST and TYPE are using them). This change should be transparent to most users but will improve compatibility on some networks.
  • The ctrl-C / ctrl-Break handler has been cleaned up and should be more reliable.
  • 4DOS now supports the DOS 4.0 DOSSHELL command without the use of special batch files, COMMAND.COM, etc.
  • A bug in the 4DOS beep subroutine could cause the beep issued for an invalid keystroke or any other reason to stay on indefinitely when running a multitasker with background processing active (e.g. DESQView, VM/386), or when using PC Magazine's ANSI.COM version 1.2. This has been fixed.
  • 4DOS now issues a specific interrupt just after displaying the prompt and before accepting input. This allows TSRs to tell when 4DOS is back at the prompt. The interrupt call is an INT 2F with AX = 0D44Eh. Any routine intercepting this should preserve at least the SI, DI, BP, SP, DS, ES, and SS registers.
  • The program name passed to DOS for external programs is now set to upper case. Previously some external programs could not find their own name as they were not written to handle lower case. This resulted in errors in finding overlay files and other similar problems.
  • If the screen width in the BIOS is 0, 4DOS now defaults to 80, to accommodate the TI Professional.
  • The date, time, and thousands separator characters are now set by the default country definition (in DOS 3+). Previously the country definition only affected the date and time format.
  • Previously 4DOS sometimes failed to ask ask "Cancel batch file" when aborting via ^C from an external program. This has been fixed.

Command Line Editing:

  • The ^D (delete) command now displays the previous history command after deleting the current one.
  • A new command, ^E (end), moves to the last entry in the history list and displays it.
  • Filename completion (F9 / F10 keys) has two changes:
    • The F8 key will now return the previous matching filename if you go past the filename you want in the list.
    • When scanning the directory for filename completion 4DOS now starts with the name you type (if any) and appends a "*.*" if no extension is given (as it used to), and also a "*" if an extension is given (that's the new part). This makes names like "FILE.E" expand as "FILE.E*".

Command Parsing:

  • The command line parser has been completely rewritten. (The  parser is the part of 4DOS that reads your commands and analyzes them for aliases, environment variables, program names, switches, etc.). It now supports multiple commands and redirection more gracefully. Specific changes are listed below:
  • When entering multiple commands on the line, each command is parsed just before it is executed. (This is true at the prompt, in aliases, and in batch files.) Previously all commands on the line were parsed before any of them were executed.
  • As a result, environment variable and alias changes made in one command now take effect immediately, and will affect the parsing of commands later on the same line. Previously these changes did not take effect until the entire line had been parsed.
  • The 255-character command limit now applies to each individual command as it is expanded, and to the original command line. Previously the entire command line after alias and variable expansion had to fit within 255 characters as well.
  • EXCEPT, FOR, GLOBAL, IF, and SELECT now accept aliases as the command argument.
  • Filename parsing has been modified to allow a forward slash ("/") as a path separator in most places. However commands which use "/" for switches may still get confused if you use this construct.
  • "Whitespace" (delimiter) characters (;=,) following the command name are no longer skipped for the first command line argument, but still are for the second argument onwards. This allows commands like "XYZ,,,,," to pass white space characters (comma is a whitespace character in DOS) correctly to an external program.
  • The parser's memory handling has been rewritten to eliminate "stack overflow" errors with long aliases.
  • You can now disable the saving of a specific command to the history list by prefacing the command with "@".
  • Filenames ending with a "\" are now assumed to be directory names, i.e., "C:\4DOS\" is equivalent to "C:\4DOS\*.*". This allows you to force 4DOS to consider something to be a directory name rather than a file name if there may be ambiguity.
  • Alias expansion will now take place even when the first item on the line is an environment variable. Previously executing "%var" as a command would not work when the variable contained an alias name.
  • ECHOing of the command line now occurs before piping. This allows commands like "echo y | del *.*" to work when ECHO is on.  Previously these commands would pipe the ECHO command itself, instead of the Y, to the following command, and the command would not behave properly.
  • The parser has been modified to not treat parentheses as special characters; FOR, EXCEPT, and SELECT have been modified to do their parentheses parsing internally. This fixes a problem with renaming files whose names start with a left parenthesis.


  • Alias expansion has been changed slightly. Previously, if you had variables in an alias (%1, %2, ...) then once variable substitution was complete 4DOS would discard the remainder of the command line. Now, 4DOS discards the command line up to and including the highest referenced variable, and appends the rest of the line to the end of the expanded command.

Batch Files:

  • A new extension to support "in memory batch files" has been added (.BTM = "batch to memory"). The features of .BTM files are:

    • The file will be loaded into memory and then executed without requiring further disk I/O. This will be 2 - 5x faster than the approach used for .BAT files (to retain compatibility with COMMAND.COM), where the file is closed and reopened for each line.
    • You can now remove the disk containing an original .BTM file without having to worry about the "Missing batch file" message.
    • .BTM files are limited to 64K bytes in size.
    • Do not load TSRs (memory-resident programs) from a .BTM file. If you do the memory released when the .BTM file is done will leave a "hole" in memory below the TSR. This is not harmful, but it wastes memory.
    • Self-modifying batch files can NOT be converted to .BTM files.
    • 4START can now be a .BAT or .BTM file.
  • Batch file variable %0 now returns the batch file name as it was entered on the command line, in upper case, just like COMMAND.COM. This should fix compatibility problems with some installation batch files.
  • The %# variable has been added to batch files. It returns the number of command line arguments (%1 - %n).

I/O Redirection:

  • Redirection is now fully nestable. For example, invoking a batch file XYZ with "XYZ > OUT.DAT" will redirect all output from the batch file to OUT.DAT unless additional redirection is encountered   within the batch file.
  • The EXCEPT, FOR, GLOBAL, and SELECT commands now handle I/O redirection when processing begins for the second command (previously it was handled when the EXCEPT, FOR, GLOBAL, or SELECT was processed). In FOR, this allows you to redirect output to a file whose name depends on the FOR variable.
  • Redirection of STDERR only has been added. The syntax is ">&> filename" to redirect STDERR to a file, or ">>&> filename" to append STDERR to a file.
  • 4DOS now checks for duplicate redirection (i.e., "DIR > 1.DAT > 2.DAT"). Previously duplicate redirection would end up with output permanently redirected to never-never land once the command was finished.

Environment Variables:

  • VERY IMPORTANT: The 4DOS internal variables (CWD, CWDS, DOSVER, etc.) are now prefixed with an underscore (_). This should reduce conflicts with your own environment variables of the same name. You must modify any batch files or aliases which use these variables or they will not work properly with 4DOS 3.0. The only variables 4DOS uses which are NOT prefixed with an underscore are the ones which are actually inserted in the environment: PATH, COMSPEC, 4DSHELL, TMP, etc.
  • Many new internal variables have been added; see the manual and README.DOC for an up-to-date list of all variables. Additions include:

    %? Exit code of last external program
    %_bg, %_fg Current screen colors
    %_cpu CPU type
    %_cwp, %_cwps Like %_cwd and %_cwds but without the drive
    %_shell Current shell nesting level
  • Variables you insert into the environment with SET or in any other way now override 4DOS internal variables of the same name (%_CWD, %_DATE, etc.).
  • A new internal "function variable" type has been added. These functions allow you to parse strings. See the manual for full details. The functions are:

    %@ext[filename] Get extension part of filename
    %@full[filename] Get full file name
    %@len[string] Get the length of a string
    %@line[filename,n] Get line n from a file (see README.DOC, not described in manual)
    %@name[filename] Get name part of filename
    %@path[filename] Get path part of filename
    %@search[filename] Search the path
    %@substr[string,start,len] Extract a substring
  • The '$' character has been added to the valid variable name
    character list.
  • The new syntax %[varname] will accept any sequence of characters as a valid environment variable name for expansion. This will override both the assumption that a variable is a batch or alias argument if it starts with a digit, and the restrictions on what characters are normally considered part of a variable name.


  • ALIAS: Lines beginning with a colon (":") are now ignored in ALIAS /R files; this allows you to add comments to the files.
  • ATTRIB: No longer changes subdirectory attributes unless the new /D(irectory) switch is used.
  • BEEP: Now uses the default duration of 2/18 second if no duration is specified. Will no longer hang with the speaker on when a task switch occurs in a multitasking system (DESQView, VM/386, etc.).
  • CD and CDD: Added support for Netware-like args "..." to change to the directory two levels up, "...." to go three levels up, etc.
  • CLS: Now allows color specification if ANSI.SYS is installed, e.g. CLS BRIGHT WHITE ON BLUE.
  • COLOR: This is a new command to set the screen colors. You must have an ANSI driver (ANSI.SYS or equivalent) loaded.
  • COPY: There are a number of changes:

    • Three switches have been added: /Q(uiet) to turn off the display of files copied, /R(eplace) to prompt before overwriting an existing file, and /U(pdate) to copy the file only if the target doesn't exist or is older than the source.
    • /A and /B are now COMMAND.COM-compatible: When copying to a character device (e.g. PRN), /A or /B anywhere on the line will treat all files in the specified mode. When copying to a file, the /A and /B switches apply only to the immediately previous filespec (whether it is for source or target), and all subsequent ones on that line. (Note that if you are copying multiple files and mix /A and /B on the same line, all kinds of things can happen. None of them are "wrong" but they may not be what you want.)
    • A problem with DOS 2 not recognizing source devices properly has been fixed.


  • CTTY: Now uses the DOS get line call (INT 21h function 0Ah) to get input. This should permit crude line editing with the backspace and ESC keys. Even this level of line editing was not possible under the old CTTY.
  • DEL: Two switches have been added. /Q(uiet) turns off the display of files deleted. /Y(es) skips the "Are you sure" prompt for commands like "DEL *.*" -- use it with caution!.
  • DELAY: This is a new command. It waits specified number of seconds and then continues; it can be used to delay for an external event in a batch file.
  • DESCRIBE: This command now lists only normal and read-only files and directories, and does not not list hidden / system files.
    Also the file description write is now to 2 - 20 times faster,  depending on the size of the description file.
  • DIR: There are many changes:
    • /4 is a new switch to give a 4-column directory display.
    • /A(ttrib) display format has been changed to use standard 1-column format, with the attributes in place of the file description.
    • /V(ertical) sort now creates newspaper-style columns when invoked along with /2, /4, or /W and /P(ause). Previously DIR /2VP (for example) would create two long columns, not divided by page.
    • DIR now has an "include list" format, e.g. DIR *.WKS+*.DAT to display all specified files in one list. Previously without the "+" there would be two separate lists displayed.
    • The directory scan now allocates memory in larger blocks.  This should speed up DIR a bit on 8088 systems, and improve reliability on some networks which couldn't handle many small memory allocation requests properly.
    • Internal memory allocation for DIR has been rewritten so that the limit on the number of files it can handle is now based only on available memory. The previous limit was just over 1000 files.
    • Subdirectory sizes are now excluded from the summary totals.  This gets around a bug in Netware 386 which returns about 2 billion bytes as the size of a subdirectory!
    • If the file time is exactly 00:00:00 no time is displayed, just like under COMMAND.COM.
  • DRAWBOX, DRAWHLINE, DRAWVLINE: These new commands draw boxes and lines on the display. Color control is included, and connectors are generated automatically when two lines intersect.
  • ESET: When editing aliases with truncated names the whole alias is now displayed. For example if you have an alias WHER*EIS and say ESET WHER the editing line will now show the whole name, WHER*EIS, not just WHER like it did before.
  • FOR has several changes:
    • A slight change in variable parsing was made to emulate COMMAND.COM, which only allows FOR variables to be 1 character long. When these variables had other text added to them 4DOS couldn't find the variable name. Single-character FOR variables will now work properly with text appended to the variable name (e.g. FOR %%X IN (A B C) DO COPY %%Xfile D:).
    • The DO in the FOR syntax is now optional.
    • FOR variables may now be specified either as %%var or %var whether the command is issued at the prompt or from a batch file. Previously two percent signs were required in either place.
  • GOTO and GOSUB: These commands now take effect immediately when there are multiple commands on a single line.
  • HISTORY: A new switch, /R(ead) allows you to read the history from a file (generally this will be one created via HISTORY > filename.
  • IF: There are new IF conditions which allow you to test for file attributes (including volume label), monitor and video card types, free memory of various types (DOS, EMS, XMS, extended), free disk space, file size, and existence of an alias.
  • IFF: This is probably the single most powerful new feature of version 3.0. It is a block-structured command allowing IFF / THEN / ELSE / ELSEIFF structures in batch files and aliases. The syntax is straightforward:

    IFF condition then

    See the manual for further details.


  • INKEY: A new switch has been added, /Wn (wait), to wait up to n seconds for a reply. If the time elapses without any entry, the  command returns without modifying the variable. /W0 returns immediately whether or not a keystroke is pending, and thus can be used to test for a pending keystroke.
  • INPUT: A /W has switch has been added as for INKEY. /W0 returns immediately if no keystroke is pending, and waits for the rest of the string if a keystroke is pending.
  • KEYSTACK: A longstanding bug has been fixed. KEYSTACK was randomly trashing a word somewhere in memory. While this was rarely causing trouble, the fix may help with some KEYSTACK compatibility problems.
  • LIST: There are several changes:
    • The function keys have been changed. F1 (search) and F2 (search again) have been changed to F5 and F6 to avoid confusion with HELP. F4 (print file) has been changed to F7. There are two new switches. /S(TDIN) gets input from standard input instead of a file. This allows you to pipe the output from another command to LIST for full-screen viewing, e.g. DIR | LIST /S. /W(rap) wraps all lines at the right side of the screen, which is useful for viewing non-text files.
    • EGA and VGA display speed has been increased.
    • The Ctrl-Right Arrow and Ctrl-Left Arrow keys can now be used to shift left or right 40 columns at a time (the arrow keys alone shift 8 columns at a time as before).
  • LOG: This is a new command which allows you to log all commands entered at the prompt to a log file, with date and time stamps. You can enables or disable logging, write text to the log file, and set its name.
  • MEMORY: The display includes several new items: the total and free XMS memory; whether the High Memory Area (HMA, a part of the XMS specification) is free; the total and free alias space, and the history list size.
  • MOVE: There are two new switches: /Q(uiet) turns off the display of files moved; /R(eplace) prompts before overwriting an existing file.
  • PATH: The path is now saved in upper case to work around a Novell Netware bug. The bug causes loss of the local path when mapping network drives, if the local path is stored in lower case.
  • PROMPT: Now checks for a null current directory to prevent displaying garbage when the current drive is changed to a drive that isn't ready. Also there are some changes to the "$" strings you can use:
    • --> $a (ampersand) has been removed to avoid a problem with ProComm, which uses $a as an invalid character in order to generate a space in the prompt. If you need an ampersand in your prompt, just use the "&" character instead of $a.
    • $xd: is a new function which displays the current directory for the specified drive. For example, to display the current directory on drive E:, include $xe: in the prompt string.
    • Using $Xd: instead of $xd: will display the directory in upper case.
    • $z is a new function which displays the 4DOS shell nesting level (0 for the primary shell, 99 for memory-resident copies of 4DOS).
  • PUSHD / POPD: The directory stack now discards the oldest entries when full and "wraps around" -- previously an error was generated if the directory stack overflowed. Also, PUSHD now supports Netware-like args as in CD and CDD: "..." to change to the directory two levels up, "...." to go three levels up, etc.
  • REN: The new /Q(uiet) switch turns off the display of the files renamed.
  • REM: Remarks are now parsed before alias and variable expansion, so you can have any number of unmatched quotes in the REM statement without an error message. Previously any unmatched quotes would cause a "No closing quote" error.
  • SCRPUT: This new command to writes text directly to the screen, and includes color control and cursor positioning.
  • SELECT: There are several changes:
    • Files can now be marked with the spacebar, and pressing the spacebar or "+" on a marked file will unmark it. The F1 key will call up 4DOS HELP from inside SELECT.
    • SELECT now has an "include list" format, e.g. SELECT COPY (*.WKS+*.DAT) A: to display all specified files in one list.  Previously without the "+" there would be two separate lists displayed.
    • The SELECT header has been redesigned. The entire command you typed is now displayed on the second line, instead of just the filespec (if you have more than about 64 characters in the command line, the display will be truncated). The header now shows the length of the command line as well; this is especially useful when using SELECT with [] as it is easy to get the command line to long for external commands (126- character limit) or internal commands (255 characters).
    • It is now possible to use SELECT with only one parameter, e.g. SELECT (*.BAT) to choose a batch file to run.
    • A bug which sometimes hung the system in SELECT if the command line got too long has been fixed.
  • SET has two new switches: /P(ause) pauses after each page of display; "/R filename" reads the environment variables from a file (similar to ALIAS /R).
  • SETDOS: There are five new switches:
    • /A(NSI) forces 4DOS to assume ANSI.SYS is installed, even if it appears not to be. /A1 enables this, /A0 returns to automatic detection of ANSI.SYS and is the default.
    • /I(nternal) is used to disable or re-enable a 4DOS internal command. /I-cmd disables "cmd", /I+cmd re-enables it.
    • /L(ine input) forces 4DOS to read input one line at a time, instead of the usual one character at a time. This may be necessary for compatibility with some programs; see COMPAT.DOC for details. /L1 enables line input; /L0 disables it and is the default.
    • /U(pper) forces all filenames to be displayed in upper case in all commands and error messages. /U1 forces upper case; /U0 is the default and enables lower case output.
    • /W sets the DOS and 4DOS switch character. This new switch is described in README.DOC, but is not included in the manual. Be sure to read the cautionary note in README.DOC before using this switch!
  • SHIFT: This command has been modified to prevent execution except while in a batch file.
  • SWAPPING: This is a new command which turns swapping ON or OFF.  Turning swapping off locks the transient portion of 4DOS in high memory. This improves performance on systems running disk swapping, especially when running lots of little programs (e.g. during AUTOEXEC). Turning swapping off will not close the disk swap file or deallocate reserved EMS or XMS memory. Entering the command with no arguments displays the current swapping status.
  • TIME: Now supports the COMMAND.COM "AM / PM" syntax as well as 24-hour time syntax. Also a bug was fixed which caused the hundredths of a second to be set to random values, some good, some not so good.
  • UNSET: This new command removes environment variables (like UNALIAS does for aliases). To clear the entire environment, use "UNSET *" -- but do so with caution, it will remove PATH, COMSPEC, and other essential information!
Version 3.01, 5/22/90
General Enhancements:
  • Disk swapping should no longer cause occasional system hangs if the Ctrl-C or Ctrl-Break key is hit while 4DOS is swapping itself in from disk (i.e. when exiting an application).
  • CLS, LIST, and SELECT are no longer affected by a video BIOS bug in old IBM PCs.

Command Line Options:

  • Either / or - may be used as the switch character on the 4DOS command line (eg SHELL=4DOS -S:E instead of /S:E, etc.).
  • Option files (@filename):

    The new @filename option allows you to put 4DOS options into a disk file instead of specifying them on the SHELL= line in CONFIG.SYS. This gets around a bug in DOS which limits the length of the SHELL= line.

    The file specified in the "@filename" option can have more than one line, and is limited to a total of 255 characters in the file, not 128. A file invoked with @filename can have another @filename inside it. Wherever @filename occurs, all options placed after it are ignored, so it must be the last item present.
  • Alias size (/A):

    Aliases are now in a separate block, whose size in bytes is defined with the new SHELL and 4DSHELL parameter /A:nnnn. You will need to add this parameter, and probably reduce your environment size accordingly.

    The /A switch supports the same incremental syntax used with /E, i.e. /A+n. When used in 4DSHELL this allows you to guarantee a specified amount of free alias space in
    secondary shells.
  • Environment size (/E):

    4DOS now defaults to a memory-resident master environment (formerly selected with the /M command line option). The /M switch is therefore obsolete, but will still be accepted. It is equivalent to /E.

    /E:nnnn may also be followed by S (/E:nnnnS) to swap the master copy of the environment; this is equivalent to the 4DOS version 2 /E option. This will save a small amount of low memory, but may not be compatible with all applications, and will not work with any application that needs to modify the master environment.

    /E:nnnn may be followed by U (/E:nnnnU) to load the master environment into a UMB in high DOS memory. This switch is subject to the same compatibility restrictions as /U (below).
  • Reduced swap size:

    4DOS will normally reduce the space used to swap a secondary shell by retrieving static information from the primary shell's swap area. This reduces secondary shell swap size from 68K or more to about 20K. This feature will not work if the total of your alias, history, and environment sizes in the secondary shell is larger than that specified for the primary shell, or if the size of DOS memory has been reduced when the secondary shell is started (e.g. by a program like DESQView that reserves some memory at the top end of DOS memory). In such cases secondary shells will require
    a full-size swap area. The size of the swap area is dis played in the "swapping initialized (nnK)" message when 4DOS starts.
  • Disk swapping (/S:D):

    The default location for disk swap files in secondary --> shells is now in the root directory of the drive specified in the COMSPEC environment variable (the drive where 4DOS.COM is stored). If you want disk swap files to go to another drive or directory, use the "/S:Bd:\path" or "/S:Dd:\path" settings in the 4DSHELL environment variable (see page 25 of the manual). This should cut down on swap file clutter, yet leave you with complete control over swap file location.
  • Load high (/U):

    The new /U switch requests that 4DOS load its resident portion into an Upper Memory Block (UMB) at the high end of DOS memory, reducing low memory usage to 256 bytes.

    The /U switch requires 386MAX, QRAM, or QEMM 5.0 or above. It may not be compatible with all other software products. See COMPAT.DOC for full details on compatibility.

Features and Usage

General Features:

  • 4DOS now has better support for non-English characters in filenames, environment variables, and aliases.
  • Most of the changes in version 3.0 to allow shareable file access on networks have been removed, because some networks and a few popular programs (e.g. SHARE and FASTOPEN) couldn't handle them properly. SHARE/LAN support is now provided where possible, but is avoided in many places where it has been found to cause trouble. This change should eliminate most or all I/O redirection problems on networks.
  • A number of changes have been made to increase 4DOS's execution speed, and reduce its size slightly. Speed improvements are primarily in the areas of file access (particularly .BAT files)and environment variable and alias expansion. They may not be noticeable on higher-speed systems.
  • 4DOS can now correctly handle text files (.BAT or .BTM files, files to be LISTed or TYPEd, etc.) which have CR/LF, CR only, or LF only at the end of each line. Previously not all of these line terminators worked correctly.

Command Line Editing:

  • You can now enter characters that would normally be interpreted by the line editor as a command (e.g., Ctrl-D or Ctrl-K). To do so precede the character with an ASCII 255 (hold down the ALT key and enter 255 on the numeric keypad, then release the
    ALT key). To enter the ASCII 255 itself into the line, you must enter it twice.
  • The cursor shape will now be changed properly when you hit the Ins key to switch editing modes. Previously if SETDOS specified a block cursor in the default mode it would not be changed to an underline when Ins was hit.



  • Fixed a bug in alias expansion which occurred when a "%" was the
    last character on the line.

Batch Files:

  • See the commands section below for information on the new LOADBTM command, which allows any batch file to work as a BTM file some or all of the time.
  • Batch files can now be nested 6 levels deep (the previous limit was 4).

I/O Redirection:

  • 4DOS now checks for duplicate redirection (i.e., "DIR > 1.DAT > 2.DAT"). Previously duplicate redirection could hang the system.
  • The system will no longer hang if a command specifies input redirection after output redirection.

Environment Variables:

  • In order to support subtraction in the new %@EVAL function (see below) 4DOS will no longer accept a "-" in the name of an environment variable to be expanded, unless the name is enclosed in brackets [].
  • Three new internal variables have been added:

    %_dow The day of the week as a string (Mon,Tue, etc.)
    %_rows The height of the screen
    %_columns The width of the screen

  • A new function, %@eval, has been added. The syntax is:


    Where "expression" is any arithmetic expression. The expression can include any of the following elements:

parentheses, which may be nested
unary + or - operators
multiplication and division operators: *, /, and %% (modulo)
addition and subtraction operators: + and -
environment variables, variable functions, and constants

The elements of an expression are processed with the precedence shown above. For example, 5*3+2 is treated as (5*3)+2 rather than 5*(3+2). Examples of the use of %@eval are:

Increment a variable: set a=%@eval[%a+1]

Perform environment variable arithmetic:


set c=%@eval[(%a*2) + (%@len[%b]-5)*7]

Evaluate expressions in IF:

if %@eval[%@substr[%_time,0,2] %% 12] == 0 echo 12:00!

Set up a simple command line calculator:

alias calc `echo The answer is: %@eval[%&]`

  • Another new function, %@INDEX[string1,string2] returns the position of string2 within string1 (string2 can be as small as a single character). The first position in string1 is numbered 0. If there is no match, the function returns -1.
  • When expanding environment variables 4DOS will display a "Variable loop" error if you nest variable functions too deep, or define variables which refer back to themselves.

Technical Information:

  • 4DOS.COM now closes file handles 5 - 29 when it starts. This should solve problems with programs that pass open file handles to a secondary shell.
  • 4DOS now generates two different INT 2F calls to allow TSRs to tell when 4DOS is back at the prompt. These calls have AX = D44Eh. The first occurs immediately before displaying the prompt, with BX = 0; the second occurs after displaying the prompt and immediately before accepting keyboard input, with BX = 1. Any routine intercepting these calls should preserve at least the SI, DI, BP, SP, DS, ES, and SS registers.


  • ALIAS: ALIAS /R can now read multiple files, for example:

    alias /r alias1 alias2 alias3
  • CD and CDD: Modified to allow forward slashes (/) in path names.
  • COPY: There are several changes:

    Problems with appending files in binary mode have been fixed.

    The way that COPY accesses files has been modified to minimize or eliminate problems with the MS-DOS APPEND command.

    The /R and /U switches are now ignored if the target is a device.

    A ^Z (end of file mark) is now properly added to the target file when it is in ASCII mode.
  • DEL: Speed has been improved somewhat, especially on
    non-cached disks.
  • DESCRIBE: 4DOS description files will no longer get mixed up
    between directories when running reasonably-behaved data pathing
    utilities like DPATH.
  • DIR: Changed to display directory totals even when the "File not
    found" message is displayed. Changed the /F and /H switches so
    they don't conflict with each other.
  • DRAWBOX: Styles 3 and 4 now work properly.
  • FOR: Now aborts when a nested batch file CANCELs. Also, fixed a
    bug that was causing FOR variables to be ignored inside double
  • GLOBAL: Added a /Q(uiet) switch to disable the display
    of "GLOBAL: pathname".
  • GOTO inside an IFF statement now cancels all IFF parsing,and assumes you've branched completely outside the IFF construct. If you haven't, you will get "Unknown command" errors on subsequent ELSE, ELSEIFF, and ENDIFF statements (see examples below). Also fixed a bug which prevented GOTO from branching to the end of the file from within a GOSUB subroutine.

    iff "%1"=="Y"
    copy file1 a:
    goto done <--- Legal - branches outside the
    else IFF block
    copy file2 b:
    goto test <--- Illegal - branches within IFF
    endiff block
    [do some other work here]
  • HELP: There are several changes to HELP:

    There are many corrections and additions to the text, including a complete ASCII table.

    A new "soft pagination" capability enables many commands to be displayed completely on one screen if using more than 25 lines, but paginates in a logical spot if using a 25-line screen.

    HELP is now DESQView-aware and should run properly in a less than full screen DESQView window.

    HELP now accepts up to 16 pages per topic and 32 crossreferences per topic, to allow 4MAKE users to install longer topics inside the help file.

    Three new environment variables have been added to give you better control over HELP:

    4HELP Specifies the full path and file name for the help program to be loaded when F1 is pressed. If not used, 4DOS will look for HELP.EXE in the current directory and then on the PATH. 4HELP affects only F1, NOT the HELP command; if you need to change how the HELP command works as well, use an alias (see example below).

    4HELPF Specifies the full path and file name for the help text file. If not used, HELP will search for DOS.HLP in the directory specified in 4HELP (if any), then in the current directory and on the path.

    4HELPC Specifies control switches for HELP.EXE. At present the only switch is /R, which disables dynamic window resizing and forces all text screens to be displayed at the full screen height.

    For example, the following commands load HELP.EXE (which has been renamed to 4DHELP.EXE) from directory D:\4DOS when F1 is pressed, set up an alias to load this same program when the HELP command is used, load the help text file from RAMdisk drive I:\, and disable dynamic window resizing:

    set 4help=d:\4dos\4dhelp.exe

    alias help d:\4dos\4dhelp.exe
    rem The above could also use "alias help %[4help]"
    set 4helpf=i:\dos.hlp
    set 4helpc=/r
  • IF: There are several corrections to the description in the manual. Some of these errors are present only in early copies of the manual:

    The DOS memory size option is named DOSMEM, not DOSFREE.

    The tests which check a numeric value (EMS, DOSMEM, etc.) use the same relational operators as the string tests, as shown in the examples. For example, the syntax for EMS should read:

    EMS relop n[K|M]

    where "relop" means EQ, GE, GT, etc. The "relop" is optional for ERRORLEVEL, but required for all other numeric tests.

    The MONITOR and VIDEO tests also require a relational operator (==, EQ, or NE) as described above for numeric tests.

    The IF ATTRIB test has an additional option: "N" tests for no attributes set (i.e. all of the other attributes are off).

    IF ATTRIB volname V will only work if the volume name refers to the root directory, and if there is a period after the eighth character in volume names of nine characters or more (e.g. to test for volume "MYFILES0107" in drive A:, use
    IF ATTRIB A:\MYFILES0.107 V ...).

    * Two tests are missing from some copies of the manual:

    IF DISKFREE relop n
    Tests the disk free space on the current drive.
    Cannot be used to test other drives.

    IF FILESIZE filename relop n
    Tests the size of the specified file.

    For example:

    if diskfree gt 40M echo Plenty of room
    if filesize myfile.dat gt 360K echo It won't fit!
  • IF: String comparisons will now be done numerically if both values being compared begin with a digit. This allows you to do true arithmetic tests. For example:

    set aa=027
    set bb=20
    if %aa gt %bb ... This test will succeed because it will compare the numeric values 27 and 20.
    if "%aa" gt "%bb" ... This test will fail because it will compare the alphanumeric values "027" and "20", and the "02" will appear 'smaller' (alphanumerically) than "20".
  • IF: The ATTRIB test for a volume label has been changed to get around a bug in DOS, and should now recognize labels correctly.
  • IFF: ELSE and ENDIFF will now be recognized properly even if they are not followed with whitespace.
  • INPUT: Fixed a bug with very long variable names and/or input text.
  • KEYSTACK: There are two changes:

    KEYSTACK now supports a new symbol, !, to clear keystrokes from the typeahead buffer, as well as anything in the KEYSTACK buffer. For example:

    keystack ! @59

    will clear the typeahead buffer before stacking the @59 (F1)

    Some programs will not interpret stacked keystrokes properly unless they contain both the correct ASCII value and the correct keyboard "scan code". For example, if you attempt to KEYSTACK an "Enter" using ASCII code 13 (carriage return) and see a small musical note instead, the program you are running probably needs the scan code to interpret the keystroke properly.

    KEYSTACK now supports the entry of scan codes for standard ASCII keys. To enter the scan code, multiply it by 256 and add it to the ASCII code. Using the same example, the scan code for the Enter key is 28, so the full value for this key would be 28*256+13 = 7181. With some programs you will find that KEYSTACK 7181 works when KEYSTACK 13 does not (or vice versa). Experimentation is required to get the correct value. A full discussion and table of scan codes is beyond the scope of this document, but is available in many basic PC books.
  • LIST: There are several changes:

    Changed the search and print keys to use letters instead of function keys: F(ind), N(ext), and P(rint). This avoids conflicts when you wish to redefine the function keys for other purposes.

    Added a new switch, /H, to strip the high bit of each character, for displaying WordStar documents and other similar files.
  • LOADBTM: This is a new command. It will switch the current batch file to and from .BTM mode. The syntax is:


    LOADBTM ON loads the entire file into memory and processes the following lines as a .BTM file. LOADBTM OFF unloads the file from memory and processes the following lines one by one like a .BAT file. Both commands can be used regardless of the file's original extension.

    LOADBTM will allow you to have a single batch file for both COMMAND.COM and 4DOS, and select .BTM mode via a statement like:

    if "%@eval[2+2]" == "4" loadbtm on

    Since the %@eval function does not exist under COMMAND.COM, the IF test will fail there and the rest of the line will be ignored. Under 4DOS where %@eval exists, the LOADBTM ON will be executed.

    LOADBTM will also allow you to load TSRs from a .BTM file by switching it into .BAT mode, loading the TSRs, and switching back to .BTM mode. However note that, depending on what the file does, such mode switching can erase much of the speed gained by using a .BTM file in the first place.
  • LOG: Fixed a problem which caused a ^C to occasionally hang the system when LOG was ON. Also changed LOG to automatically switch LOG OFF if it couldn't open the log file.
  • MOVE: Now returns an "Access denied" error if you try to move files to a character device. Also the way that MOVE accesses files has been modified to minimize or eliminate problems with the MS-DOS APPEND command.
  • REM: Will now be echoed if ECHO is ON.
  • SET: SET /R can now read multiple files, for example:

    set /r env1 env2 env3
  • SETDOS: There are two changes:

    /S now resets the cursor shape immediately, so it can be used to hide the cursor while in a batch file.

    /U1 should now properly return uppercase filenames in all instances.
 Version 3.02, 9/7/90
General Enhancements:
  • When starting a shareware copy of 4DOS there is a 1/2-second, two-tone beep to identify this as a shareware copy, followed by a 3-second delay to allow reading of the shareware reminder message. Beginning with version 3.02, you can skip this
    delay by pressing any key.

Features and Usage:


  • Several changes have been made in 4DOS's file handling to eliminate problems with incomplete redirected output files on Novell networks.
  • There is a small speedup in description processing for the file commands (COPY, DEL, MOVE, and REN).
  • The "?" character in filename wildcards now matches zero or more characters like COMMAND.COM instead of one or more like previous versions of 4DOS. Thus "DIR A?." will match both the files "A" and "AA"; before it would only match "AA". This change adjusts 4DOS to work the way COMMAND.COM works instead of the way COMMAND.COM is documented to work.
  • The F3 key now works like COMMAND.COM, so you can type part of a line and hit F3 to get the rest of the previous line.



  • The ECHO state is now inherited properly when batch files chain. In version 3.01 the echo state was inherited properly on a CALL, but not on a chain.

Environment Variables

  • One new internal variable has been added:

    %_ndp Returns:
    0 if no coprocessor is installed
    87 for an 8087
    287 for an 80287
    387 for an 80387

    There are a few minor errors or points which are not clear in the list of variable functions in some versions of the manual:

    When using variable functions they must be preceded (and optionally followed) by a percent sign, like all other environment variables. For example the "ext" function is referenced as %@ext[filename] or as %@ext[filename]%.

    The correct spelling for the string length function is "%@len", not "%@length".

    The %@line function is missing from early copies of the manual. This function returns the nth line of a file. The first line of the file is numbered 0.

    In the %@substr function, the first character is numbered 0, and the correct syntax is "%@substr[string,start,length]" not "%@substr[string,start,end]".
  • Commas will now be ignored by %@eval. This will allow (for example) %@eval[10,000 * 3] to get the expected result. It will also allow %@eval to work on the output of a command like FREE, which contains embedded commas. Also %@eval will give a "Divide by zero" error message if you try to use 0 as a denominator for division or modulo calculation; previously it would give an error for the modulo, but return the numerator as the result for the division.
  • %@substr can now handle quotes around the "string" argument. Double quotes and back quotes are equivalent in this context, and the quote characters DO count when determining which characters are placed in the substring. This capability allows you to get substrings of strings which contain commas. For example:

    %@substr["Mon, Aug 27, 1990", 1, 3]

    will return "Mon". Previously the commas would be seen as argument separators, even if they were within a quoted string.
  •  3.02 [p 42] Two new variable functions have been added:

    %@upper[string] Returns the string converted to upper case.

    %@lower[string] Returns the string converted to lower case.
  • Both 4DOS.COM and the 4DOS EXE files now check for version mismatch (e.g. trying to use version 3.01a 4DOS.COM with a version 3.02 EXE file). Previously this testing was done by 4DOS.COM only, so a mismatch could go undetected in some circumstances.
  • Divide by zero handling has been removed from 4DOS, allowing standard DOS divide by zero handling to take place. The 4DOS divide by zero handler was not providing any advantage and could occasionally fail to recover properly from division errors in
    application programs.
  • Cursor positioning during command line editing will now take place in the current video page, rather than assuming page 0. This should fix minor cursor positioning problems with programs that shell to DOS with the video adapter set somewhere other than page 0 (like Turbo Debugger).
  • Handling of the Abort response to a critical error during a 4DOS command has been modified to solve some obscure problems with changing floppy disks after Aborting from a disk error.


  • DESCRIBE: Problems with missing <cr>s in description files have been solved. These problems did not cause any trouble within 4DOS, but 3rd-party description editors were confused by them.
  • DIR: The time separator character will now be correct when the country code is set for outside the US. Previously it was hardcoded as a colon.

Problems with occasional "Out of memory" errors and missing description displays in DIR have been resolved. However, if you fragment DOS memory (for example by loading two TSRs, then unloading the first but not the second) you can get "Out of memory" errors in larger directories as DIR tries to expand the memory it is using to store your filenames and descriptions. If this occurs, determine the cause of the fragmentation and resolve it.

  • IF and IFF: The string tests will now work correctly even if the string contains an "=" sign (which is one of the IF test characters) or a "/" (which is the 4DOS switch character). Also the EMS test now returns the correct value (0) if there is no EMS driver present. In version 3.01 it would return a random value.
  • LIST: The switches now work properly when specified without spaces, eg as /WS or /W/S. Previously they required a space (/W /S) to work correctly.
  • SETDOS: The COMPOUND character (SETDOS /C) can now be any ASCII character except those specified in the manual as not allowed. Previously characters above ASCII 127 would not work as the separator.

Help System

  • The text has been modified in many places. An ANSI table has�been added along with the APPEND, FASTOPEN, GRAPHICS, KEYB, NLSFUNC, RECOVER, and REPLACE commands, and more information on HELP itself. The explanations of JOIN and SUBST are more detailed. All resident commands now show their DOS 3.3 resident size. Several minor typographical errors have been corrected.
  • HELP has two switches which can be set temporarily on the command line (in version 3.02), or "permanently" -- until explicitly changed -- via the 4HELPC environment variable (see below). When switches are set on the command line they can be placed before or after the topic name (if any), so for example these two commands are equivalent:

    help copy /r
    help /r copy

    The switches are:

/BW: Forces HELP to display all text in monochrome colors, to support the use of monochrome monitors attached to color video boards (e.g. use of a composite monochrome monitor on a CGA system). If you have such a system you will probably want to set the /BW switch permanently as shown under 4HELPC below.

/R: Disables dynamic window resizing and forces all text screens to be displayed at the full screen height for those who prefer an unchanging display window size.

 Version 3.03, 4/12/91
General Enhancements:
  • 4DOS will now preserve leading whitespace on the command tail for external commands, and pass no whitespace to the command if that's how the line is entered. For example, the command:


    will pass "/c" to MYPROG; previously an extra space (" /c") was passed. This should fix occasional problems with programs that can't handle leading whitespace.
  • There is one additional character which can be used after the 4DOS escape character (the escape character is normally ctrl-X): a "t" will mean the ASCII TAB character, so that:


    will place a TAB on the line (^X means the single character ctrl-X, which appears on your screen as an upward-pointing arrow).

Command Line Editing:

  • TAB has been added as a synonym for F9, and Shift-TAB as a synonym for F8. Also the F3 key will now put the cursor at the end of the command line after recalling the previous command.

Batch Files:

  • Error levels generated by external programs in batch files are now returned properly to the calling program when the batch file is run from a transient 4DOS shell (4DOS /C). This should fix problems with BBS systems which return error levels through batch files (also see the EXIT command below for related information).

Technical Information:

  • 4DOS now does a disk reset following a ^C, or a MOVE, REN, or DEL command. This should fix problems occasional problems with disk caches and FASTOPEN.


  • BEEP, DELAY: Fixed a bug that could hang the system if a BEEP or DELAY was active at an even 1/2 hour.
  • DATE: If you enter only two digits for the year and it is below 80, 4DOS will now assume it is in the 21st century; if it is 80 or above 4DOS will assume it is in the 20th century. You can specify the year you want explicitly by using a 4-digit value.  The system of using 3-digit year values for dates in the 21st century, as documented in the printed manual, has been removed. Also DATE now supports the European date display format (Mon 1.Jan 1991).
  • DIR: Fixed an occasional problem with doing a "DIR ." in the root directory.
  • EXIT: EXIT now accepts a numeric argument (EXIT n). The argument value is returned to the previous program as the error level. If no argument is given the error level from the most recent external program will be returned; this is a change from previous versions of 4DOS, for compatibility with COMMAND.COM.
  • FOR: An active FOR is now aborted properly when a nested batch file CANCELs, or when a batch file chains to another batch file.
  • GOSUB: Previously if a GOSUB was used within an IFF statement and there was another IFF statement inside the called subroutine, the two IFF statements could interfere with each other. This has been corrected; two such IFF statements will now operate independently of each other. This also means that you can use a GOTO inside the subroutine without canceling the operation of the IFF statement in the calling part of the batch file (see next item on GOTO and IFF).
  • PROMPT: When displaying the date in the prompt 4DOS now supports the European format (e.g. Mon 1. Jan 1991).
  • REN: Fixed a bug which would give an "Invalid path" error when the only thing specified for the target was ".", as in:

    ren \4dos\4dos.doc .
  • TIME: An invalid entry will now display an error message and prompt again, instead of generating an incorrect time value.
  • TYPE: TYPE will now stop on a ^Z (end of file mark), for compatibility with COMMAND.COM.
  • Y: "Y:" at the start of the command line will now refer to drive Y rather than the Y command. This should allow network users with mapped "Y" drives to execute programs on those drives without having to disable the 4DOS Y command.

Top of Page - Home