4DOS Version 3.02

A PC-DOS / MS-DOS Command Processor

Distributed by:

J.P. Software

P.O. Box 1470

E. Arlington, MA 02174, USA

(617) 646-3975

_______

____|__ | (tm)

--| | |-------------------

| ____|__ | Association of

| | |_| Shareware

|__| o | Professionals

-----| | |---------------------

|___|___| MEMBER

Written by Rex C. Conn and Tom Rawson

J.P. Software

P.O. Box 1470

E. Arlington, MA 02174, USA

(617) 646-3975 voice

(617) 646-0904 fax

(800) 368-8777 orders only

Electronic mail to:

CompuServe 75300,210

BIX "trawson"

InterNet, Bitnet, etc.: 75300.210@compuserve.com

Program and Documentation Copyright 1988, 1989, 1990 Rex C. Conn and

J.P. Software. All rights reserved.

Portions Copyright 1987, 1988, 1990 Microsoft Corporation

Portions Copyright 1987, 1989 Borland International

Portions Copyright 1987, 1988, 1989 TurboPower Software

4DOS is a registered trademark of J.P. Software.

PC-DOS, PC, PC XT, PC AT, and PS/2 are trademarks of IBM Corporation.

MS-DOS, OS/2, and Windows are trademarks of Microsoft Corporation.

1-2-3 is a trademark of Lotus Development Corporation.

dBASE is a trademark of Ashton Tate.

386-To-The-Max and Move-Em are trademarks of Qualitas Inc.

DESQview and QEMM are trademarks of Quarterdeck Office Systems

Brief is a trademark of UnderWare Inc.

4DOS Reference Manual Copyright 1990, J.P. Software

ACKNOWLEDGEMENTS

We couldn't produce a product like 4DOS without the dedication and

quality work of many people. Our thanks to all these folks:

J.P. Software office staff: Ruth Dornfeld, Hayyim Feldman, Susan

Mampre, Keren Sammett, Ellen Stone.

Beta testers: Bruce Aldrich, Mike Bessy, David Birnbaum, Jeff

Bishop, "Dr. File Finder" (Mike Callahan), Gary Clanfield, John

Cooper, Chris DeVoney, Emanuel Donchin, Stan Dvoskin, John

Fleming, Doug Frank, Peter Frank, Gary Gibson, Tim Grissom, Ken

Harwell, Keith Hawes, Bob Huntley, John James, Tom Kellen, Bob

Kertesz, Dave Lemire, Kevin Lockwood, Brad McDonald, John McKown,

Burt Model, Stuart Moore, Phil Newman, Jorge Ochoa-Lions, Shakib

Otaqui, John Peterson, Ed Phillips, Mike Phillips, Sam Pierce,

Chip Rabinowitz, Dan Rawson, David Rodman, Chris Rousseau, Alan

Samuels, Guy Scharf, Martin Schiff, Bill Shaffer, Malcolm Shealy,

Stephen Spehn, Michael Stein, Ted Thompson, Brian Trainer, Thomas

Traubitz, Randy Wallin, Bill Walton, Iram Weinstein, Joe Zott,

and anyone else we forgot!

Beta test support: David Moskowitz, Nick Cvetkovic, and all the

sysops of the CompuServe CONSULT forum.

BBS support: Future Technology BBS sysops Bud Napier and Brian

Moran.

The 4DOS 3.01 HELP system was originally written by Ross Neilson

Wentworth, and is now owned and distributed by J.P. Software.

The following tools are used in creating and maintaining 4DOS:

Compilers: Microsoft C 6.0 and Macro Assembler 5.1

Turbo Pascal 5.5 (Borland)

Libraries: Turbo Professional 5.0 (TurboPower Software)

Editors: Edix (Emerging Technology), Brief (Solution

Systems)

Debuggers: Periscope (The Periscope Company), Soft-ICE

(Nu-Mega Technologies)

Version Control: PVCS (Polytron)

The following suppliers produce the finished product:

Manual Printing: Causeway Print, Boston

Disk Duplication: Diversified Systems Group, Issaquah, WA

4DOS Reference Manual Copyright 1990, J.P. Software

TABLE OF CONTENTS

Introduction i

Registration Information ii

4DOS License Agreement iii

Technical Support vi

4DOS Features 1

Installation 9

4DOS Files 10

Test Driving 4DOS 11

Quick Start 12

Automatic Installation 13

DOS Shells Explained 14

COMSPEC 15

Manual Installation 16

Memory Usage 18

Setting up CONFIG.SYS 19

Startup Options 21

4DSHELL 25

AUTOEXEC and 4START 25

4DOS and COMMAND.COM 26

Using 4DOS 27

Starting 4DOS 27

Command Line Editing 28

Command History and Recall 29

Multiple Commands 30

Conditional Commands 30

Escape Character 31

Command Echoing 32

Argument Quoting 32

Batch Files 33

Aliases 35

Executable Extensions 37

Keystack 39

Environment Variables 40

Variable Functions 42

I/O Redirection 43

Command Parsing 45

4DOS Reference Manual Copyright 1990, J.P. Software

Command Reference Guide 46

? 48

ALIAS 49

ATTRIB 52

BEEP 53

BREAK 54

CALL 55

CANCEL 56

CD / CHDIR 57

CDD 58

CHCP 59

CLS 60

COLOR 61

COPY 62

CTTY 64

DATE 65

DEL / ERASE 66

DELAY 67

DESCRIBE 68

DIR 69

DIRS 72

DRAWBOX 73

DRAWHLINE 74

DRAWVLINE 75

ECHO 76

ENDLOCAL 77

ESET 78

EXCEPT 79

EXIT 80

FOR 81

FREE 82

GLOBAL 83

GOSUB 84

GOTO 85

HELP 86

HISTORY 87

IF 88

IFF 91

INKEY 92

INPUT 93

KEYSTACK 94

LIST 95

LOG 97

MD / MKDIR 98

MEMORY 99

MOVE 100

PATH 102

PAUSE 103

POPD 104

PROMPT 105

PUSHD 107

4DOS Reference Manual Copyright 1990, J.P. Software

QUIT 108

RD / RMDIR 109

REM 110

REN / RENAME 111

RETURN 112

SCREEN 113

SCRPUT 114

SELECT 115

SET 117

SETDOS 119

SETLOCAL 122

SHIFT 123

SWAPPING 124

TEE 125

TEXT 126

TIME 127

TIMER 128

TYPE 129

UNALIAS 130

UNSET 131

VER 132

VERIFY 133

VOL 134

Y 135

Appendix A - Error messages 136

Appendix B - ASP 146

Appendix C - Key codes 148

Appendix D- Programming 149

Appendix E - Tips and

Troubleshooting 150

Glossary 162

Index 173

4DOS Reference Manual Copyright 1990, J.P. Software

Introduction

Welcome, and thanks for trying 4DOS!

4DOS is designed to help you get the most out of your IBM PC or

compatible system. It replaces COMMAND.COM, the command

interpreter that comes with all versions of MS-DOS and PC-DOS.

You'll find 4DOS provides a wide variety of capabilities

COMMAND.COM can't, ranging from a vastly enhanced DIR command, to

point-and-shoot file selection for any command, to the ability to

completely redefine your system's commands. Yet 4DOS is fully

compatible with COMMAND.COM.

4DOS is a "DOS shell" (a program that gives you access to DOS

functions and commands), but it's unlike most DOS shells on the

market. Virtually all of these shells are designed to isolate

the novice user from the DOS command line. 4DOS, on the other

hand, is intended to make DOS easier to use and to make you more

productive while working at the command line. It provides

enhancements to most of the DOS commands, as well as more than 40

new commands. These improvements make 4DOS a much richer and

more powerful working environment than COMMAND.COM, without

sacrificing the compatibility, flexibility and control you get

from working at the command line. If you're tired of the

limitations of COMMAND.COM, you'll love 4DOS!

4DOS is distributed as shareware, which means if you've

downloaded it from a bulletin board or obtained it from a friend,

you can try it out before you decide whether you'd like to keep

it. Like all shareware, if you do decide to keep 4DOS, you must

pay a registration fee.

4DOS is also distributed through normal retail channels. If you

purchased a retail copy of 4DOS, it includes a shareware disk

which you can share with your friends and associates.

The following pages include information on registration, the 4DOS

license agreement, and technical support for 4DOS.

The text in this ASCII manual is essentially the same as that in

the printed manual. Changes from the original version 3.0 manual

have been made to correct typographical errors or document small

changes in the software, but a few significant new features of

version 3.01 which would require repagination of the text are not

included. For complete documentation on changes in version 3.01,

see the file UPDATE30.DOC.

4DOS Reference Manual Copyright 1990, J.P. Software i

Registration Information

4DOS is a copyrighted program protected by both U.S. and

international copyright law. If you obtained 4DOS from a

shareware disk vendor, an on-line computer service or bulletin

board, a friend or colleague, or another similar source, you have

an unregistered (trial) copy. You are authorized to use this

copy without charge for a limited period of time under the terms

of the 4DOS license agreement. After this time is up, you must

register and pay for 4DOS to continue using it.

This method of distribution is known as shareware. It allows you

to determine whether 4DOS meets your needs before you pay for it.

The registration fee for a single copy of 4DOS is $50. Payment

of this fee entitles you to:

ù A disk with the latest version of 4DOS, registered to you.

ù One copy of the printed and bound 4DOS manual.

ù An upgrade to the next major release of 4DOS.

(Both major upgrades and maintenance releases will be

available for downloading from a wide variety of

sources. If you need an upgrade on diskette there will

be a minimal processing charge to cover our costs in

sending it to you.)

ù Technical support via electronic mail or telephone.

ù A subscription to the 4DOS newsletter.

If you prefer, you may register for $35 and receive only the disk

and notices of future upgrades. Network, site, and corporate

licenses are also available; contact J.P. Software for more

information.

If you purchased a complete copy of 4DOS with printed manual from

a software dealer, your copy came with a yellow registration

card. Return this card promptly to J.P. Software to ensure you

are registered with us, and to receive technical support and

notices of future upgrades. If you purchased 4DOS directly from

J.P. Software and paid the full $35 or $50 fee, you are already

registered, and no registration card is necessary.

4DOS Reference Manual Copyright 1990, J.P. Software ii

4DOS License Agreement

(1) Copyright: The 4DOS program and all other programs and

documentation distributed or shipped with it are Copyright Rex C.

Conn and J.P. Software, 1988, 1989, 1990, or are distributed

under license to J.P. Software, and are protected by U.S. and

international copyright law. In the rest of this document, this

collection of programs is referred to simply as "4DOS". You are

granted a license to use your copy of 4DOS only under the terms

and conditions specified in this license agreement.

(2) Definitions: 4DOS is distributed in two forms. A

"registered" copy of 4DOS is a copy distributed on diskette,

purchased from J.P. Software or from a dealer, and which includes

a serial number and the legend "licensed" or "registered" in the

program sign-on message and on the diskette label. A "shareware"

copy of 4DOS is a copy distributed on diskette or via an

electronic bulletin board, on-line service, or other electronic

means, obtained from a shareware disk vendor, or obtained from

another individual, and which displays the legend "shareware" in

the program sign-on message, and in most cases on the diskette

label as well (if applicable).

(3) Shareware Copies: Shareware copies of 4DOS are distributed

to allow you to try the program before you pay for it. They are

Copyright 1989, 1990, Rex C. Conn and J.P. Software, and do not

constitute "free" or "public domain" software. You may use a

shareware copy of 4DOS at no charge for a trial period of up to

21 days. If you wish to continue using 4DOS after that period,

you must purchase a registered copy. If you choose not to

purchase a registered copy, you must stop using 4DOS, though you

may keep copies and pass them along to others.

(4) Registered Copies: Registered copies of 4DOS are

distributed to those who have purchased them. Your registered

copy of 4DOS may only be used on the number of computers

specified on the diskette label and program sign-on screen.

(5) Use of One Copy on Two Computers: If you have a registered

copy of 4DOS which is licensed for use on a single computer, you

may install it on two computers used at two different locations

(for example, at work and at home), provided there is no

possibility that the two computers will be in use at the same

time, and provided that you yourself have purchased 4DOS, or if

4DOS was purchased by your employer, that you have your

employer's explicit permission to install 4DOS on two systems as

described in this paragraph. The right to install one copy of

4DOS on two computers is limited to copies originally licensed

for use on a single computer, and may not be used to expand the

number of systems covered under a multi-system license.

4DOS Reference Manual Copyright 1990, J.P. Software iii

(6) Use of 4DOS on Networks or Multiple Systems: You may

install your registered copy of 4DOS on a computer attached to a

network, or remove it from one computer and install it on a

different one, provided there is no possibility that your copy

will be used by more users than it is licensed for. A "user" is

defined as one keyboard which is connected to a computer on which

4DOS is installed, regardless of whether or not the user of the

keyboard is aware of the installation or use of 4DOS in the

system.

(7) Making Copies: You may copy any version of 4DOS for normal

backup purposes, and you may give copies of the shareware version

to other individuals, which they may also use and copy subject to

the terms of this agreement. If you copy the shareware version

of 4DOS for others, you must include all of the files distributed

with it, including this one. You may not give copies of the

registered version to any other person for any purpose, and you

may not make any copies of the printed and bound 4DOS manual

without explicit written permission from J.P. Software.

(8) Distribution Restrictions: You may NOT distribute 4DOS other

than through individual copies of the shareware version passed to

friends and associates for their individual use. Specifically,

you may not place 4DOS or any part of the 4DOS package in any

user group or commercial library, or distribute it with any other

product or as an incentive to purchase any other product, without

express written permission from J.P. Software, and you may not

distribute for a fee, or in any way sell copies of 4DOS or any

part of the 4DOS package. If you are a shareware disk vendor

approved by the Association of Shareware Professionals (ASP), you

may place 4DOS in your library without prior written permission,

provided you notify J.P. Software within 15 days of doing so; and

provided your application has been fully approved in writing by

the ASP, and is not simply submitted or awaiting review.

(9) Use of 4DOS: 4DOS is a powerful program. While we have

attempted to build in reasonable safeguards, if you do not use

4DOS properly you may destroy files or cause other damage to your

computer software and data. You assume full responsibility for

the selection and use of 4DOS to achieve your intended results.

As stated below, J.P. Software limits its warranty to replacement

of a defective program diskette or manual.

(10) LIMITED WARRANTY: J.P. Software warrants to owners of

registered copies of 4DOS that the software will operate in

accordance with the description given in the documentation, and

that the diskette and manual will be free of physical defects

which interfere with normal use. The software on the 4DOS

Utility Disk which was not created by J.P. Software, as stated in

the documentation provided on the disk, is not warranted to

operate in accordance with its documentation, and is sold AS-IS

AND WITHOUT WARRANTY OF ANY KIND BY J.P. SOFTWARE. For a period

of 90 days from the date of your purchase of 4DOS, J.P. Software

4DOS Reference Manual Copyright 1990, J.P. Software iv

will, at its sole option and subject to the restrictions above

and below, repair or replace any defective item(s), or refund the

purchase price of any diskette and/or manual and/or any other

parts or components of 4DOS found to be defective, if such defect

is the fault of J.P. Software and not the result of misuse or

abuse. Such a refund, repair, or replacement shall be your sole

remedy for any defects, program error(s), or documentation

error(s). In no event shall J.P. Software be responsible for any

other costs or damages whatsoever due to errors in usage or your

failure to read, understand, or follow instructions in the

documentation. J.P. SOFTWARE MAKES NO OTHER WARRANTIES, EXPRESS

OR IMPLIED, INCLUDING WITHOUT LIMITATION THE WARRANTIES OF

MERCHANTABILITY AND OF FITNESS FOR A PARTICULAR PURPOSE. J.P.

Software's warranty is expressly limited to the cost of

replacement of any defective diskette or other part.

(11) Satisfaction Guarantee: If you are dissatisfied with a

registered copy of 4DOS for any reason (whether or not you find a

software error or defect), you may return the entire package at

any time up to 90 days after purchase for a full refund of your

original registration fee.

4DOS Reference Manual Copyright 1990, J.P. Software v

Technical Support

Technical support for 4DOS is available to registered users. If

you are not a registered user, we will provide you with

assistance to install a shareware copy of 4DOS and evaluate it

during the 21 day evaluation period, but we cannot provide

continuing support beyond that until you purchase 4DOS.

The best way to contact us for support is by modem, in one of the

following public 4DOS support conferences. The numbers in

parentheses indicate the usual delay, in days, to receive a reply

to a message.

CompuServe / PCMagNet: Primary support is via the J.P. Software

section of the CompuServe PCVENB forum (GO PCVENB) (1 day). We

also monitor the CompuServe CONSULT and IBMSYS forums, and the

PCMagNet UTILFORUM (2-5 days).

Bulletin Boards: Primary support is via Future Technology BBS,

4DOS Conference, Boston, MA 617-720-3600 (1-3 days). Additional

support is available from many local BBSes via the 4DOS

conferences on the InterLink, PC Relay, and FidoNet BBS Networks

(3-5 days). Please note that Future Technology is an independent

bulletin board which has agreed to serve as a home base for 4DOS

support, but is not owned or operated by J.P. Software.

BIX: Support is available via the ibm.dos conference, topic 4DOS

(3-5 days).

In addition, you can contact J.P. Software for support by mail,

telephone, fax, or electronic mail. Addresses and phone numbers

are listed on the first page of this manual.

We prefer support via one of the electronic services listed

above, or via electronic mail, as it allows correspondence at

convenient times regardless of time zones and work schedules, and

it provides a record of the communication. However, telephone

support is also provided to those users who do not have a modem

or who need an quick response.

4DOS Reference Manual Copyright 1990, J.P. Software vi

4DOS Features

4DOS is a complete replacement for COMMAND.COM, the command

processor provided with MS-DOS or PC-DOS. (References in this

manual to MS-DOS also apply to PC-DOS.) 4DOS is compatible with

MS-DOS versions 2.0 to 4, and the OS/2 DOS compatibility box, and

adds many enhancements to your MS-DOS prompt, including:

Minimal Memory Usage

4DOS requires less than 4K of your precious RAM for its

resident portion (less than 1K with XMS swapping!), and can

use EMS, XMS, or disk for swapping its transient portion.

Fast Batch Files

4DOS 3.0 adds a new batch file extension (.BTM, "batch to

memory") that is compatible with 99% of your existing batch

files, but runs several times faster.

Executable Extensions

In addition to the normal executable file extensions (.COM,

.EXE, .BAT, and .BTM), 4DOS allows you to define additional

extensions and the programs they should invoke. For

example, entering a document name could automatically invoke

your word processor.

On-line Help

4DOS provides help for all of its internal commands, as well

as the MS-DOS external commands. You can get help by

pressing the F1 key at the command prompt. The 4DOS help

facility is extensible, so you can add help for your own

programs. (Modifications to the help facility require the

4DOS utility disk, which contains the source text and help

file compiler.)

Command Line Editing

4DOS provides command line editing, including insert and

delete, and full cursor key support. 4DOS also offers

interactive expansion of wildcard filenames on the command

line.

4DOS Reference Manual Copyright 1990, J.P. Software

1

Command History

4DOS lets you view, search, modify, and reexecute your

previous commands. The commands are saved in memory, and

can be recalled with the cursor keys. The command history

list size is user-defined, from 512 to 8192 characters.

Flexible File Wildcards

4DOS offers more flexible wildcards than COMMAND.COM. For

example, you can display all the files that have a "2"

anywhere in their filename by entering:

dir *2*.*

File Descriptions

4DOS allows you to provide descriptions (up to 40

characters) for each of your files and directories. The

descriptions are displayed with the filenames when you use

the DIR or SELECT commands. The description goes with a

file when you COPY, ERASE, MOVE, or RENAME it.

Multiple Commands on a Single Line

You can enter several commands on a line by separating them

with a ^ (caret), or other user-defined character.

Expanded and Editable Environment

4DOS provides a user-defined environment size from 512 to

32000 characters. You can interactively edit environment

entries with the ESET command.

Environment Variables

Environment variables allow you to associate a string of

characters with a variable name, substituting that string

when the name is used. 4DOS provides a number of predefined

variables, including system date and time, current

directory, and default disk, and "variable functions," for

returning substrings, the parts of a filename (path, name,

extension), etc.

4DOS Reference Manual Copyright 1990, J.P. Software

2

Aliases

Aliases allow you to rename or reconfigure commands (for

example, to pass default parameters to a command, or to give

MS-DOS the look and feel of a different operating system),

or to define a new command as a combination of several other

commands. Aliases support batch file-like arguments (%1,

%2, etc.) and environment variables, so when combined with

the multiple commands feature, they act as very fast batch

files.

Expanded Command Line

4DOS expands the MS-DOS command input line from 127 to 255

characters for internal commands. (Because MS-DOS truncates

the command line for external commands to 127 characters,

4DOS makes the full command line available to your programs

through the CMDLINE environment variable.)

Conditional Commands

4DOS includes two new command line operators: || (OR) and &&

(AND). They allow you to control the execution of

subsequent commands based on the result of the previous

command.

Additional Redirection Options

In addition to redirection of standard input and standard

output, 4DOS supports redirection of standard error, and the

option to prevent overwriting existing files. 4DOS also

provides TEE and Y "pipe fittings."

EGA/VGA Support

4DOS supports Monochrome, CGA, EGA and VGA displays with any

number of lines and columns per screen.

Networks

4DOS supports MS-DOS compatible networks, including 3Com 3+

and Novell Netware.

4DOS Reference Manual Copyright 1990, J.P. Software

3

New and Enhanced Commands

4DOS provides many new internal commands, and new options for

existing commands. Most 4DOS commands can take multiple

arguments. For example, you can delete several files with a

single DEL command:

del *.bak test.wks oldfile.txt

You can also copy several files with a single COPY command (the

target directory here is a:\):

copy *.wks memo.doc *.c a:\

The following list is intended to give you a sampling of some of

the new and enhanced commands. See the Command Reference Guide

for full details.

ALIAS / UNALIAS

Define aliases for commonly used commands, allowing you to

execute a complex series of commands with a few keystrokes.

ATTRIB

Display or change the file attributes (read-only, hidden,

system, and archive) for the specified files and/or

directories.

CDD

Change the default drive and directory.

COLOR

Set the screen foreground and background colors.

COPY

COPY includes new switches for copying only updated files

(where the source is newer than the target), and to prompt

for confirmation before overwriting existing files.

4DOS Reference Manual Copyright 1990, J.P. Software

4

DESCRIBE

Add 40-character descriptions to filenames. The

descriptions are displayed when using DIR and SELECT.

DIR

Display the disk directory with a wide variety of options,

including 1, 2, 4, or 5 column display; sorted by name,

extension, description, size, or date/time; display

subdirectories; display file attributes; and display

subtotals only.

ESET

Interactively edit environment variables and aliases.

EXCEPT

Execute a command except on the specified file(s).

FREE

Display the total and free disk space for the specified

drive(s).

GLOBAL

Execute a command in the current directory and all of its

subdirectories.

HELP

Display a pop-up help window for 4DOS internal commands and

MS-DOS external commands.

HISTORY

Display, clear or load the command history list.

LIST

Display a file on the screen. LIST provides forward and

backward paging, vertical and horizontal scrolling, text

search, and printing.

4DOS Reference Manual Copyright 1990, J.P. Software

5

LOG

Keep a disk log of each command executed, with the date and

time.

MEMORY

Display the amount of total and available DOS, expanded,

XMS, and extended memory, and environment space.

MOVE

Move files between directories and/or drives, and optionally

prompt before overwriting existing files.

PUSHD / POPD / DIRS

Use a "directory stack" to change directories, perform some

work, and then return to the original directory.

RENAME

In addition to renaming files, 4DOS also allows you to

rename files to another directory, and to rename

directories.

SELECT

Perform a command on selected files (using point-and-shoot

selection).

SETDOS

Configure the 4DOS internal parameters, including the

default line editing mode (insert or overstrike), the

default batch echo mode, the compound command character, the

escape character, screen size, and cursor shape.

TIMER

A system stopwatch for timing events, including split times.

4DOS Reference Manual Copyright 1990, J.P. Software

6

Enhanced Batch Processor

The batch processor in 4DOS is compatible with batch files

written for COMMAND.COM, and includes several new and enhanced

commands to make batch file programming easier and more powerful,

including:

BEEP

Beep the speaker at the specified frequency and for the

specified duration.

CALL

Execute nested batch files without loading a secondary

copy of the command processor.

CANCEL

Terminate nested batch file processing.

DELAY

Wait for the specified period of time before continuing

batch processing.

DRAWBOX / DRAWHLINE / DRAWVLINE

Draw boxes, horizontal, and vertical lines in single or

double widths, in your choice of colors. These commands

automatically make connectors when crossing other lines.

GOSUB / RETURN

Call subroutines within a batch file.

IF

Many new comparison tests, (including less than, greater

than, etc), and tests for memory, disk, and display type.

4DOS Reference Manual Copyright 1990, J.P. Software

7

IFF / THEN / ELSEIFF / ELSE / ENDIFF

Allows nested IF / THEN / ELSE tests in batch files and

aliases, and supports all of the new IF tests (see above).

INPUT / INKEY

Input variables from the keyboard while in a batch

file, with an optional timeout period.

KEYSTACK

Send keystrokes to a program, as if entered from the

keyboard.

QUIT

Exit the current batch file.

SCREEN

Position the cursor and (optionally) display text.

SCRPUT

Position the cursor and display text in the specified

colors.

SETLOCAL / ENDLOCAL

Define a local environment within a batch file, saving the

original environment, disk, and directory, and restoring

them when finished.

SHIFT

Optionally specify how many positions to shift,

including reverse SHIFTs.

TEXT / ENDTEXT

Display a block of text.

4DOS Reference Manual Copyright 1990, J.P. Software

8

Installation

4DOS is written for the IBM PC, PC/XT, PC/AT, PS/2 (all models),

and compatibles. It requires MS-DOS 2 or above (MS-DOS 3.1 or

above is recommended), and uses less than 4K of RAM in swapping

mode, or about 70K in resident mode.

If you are new to 4DOS, read through this section until you get

to "Automatic Installation." If you have a diskette copy of

4DOS, you can follow the automatic installation procedure, and

come back later to read the section on manual installation and

configuration.

If you would like to try out 4DOS before fully installing it, see

the section Test Driving 4DOS.

If you are an experienced 4DOS user, do not have 4DOS on

diskette, or prefer manual installation for any other reason,

read through this section before installing 4DOS. See the Quick

Start section for brief instructions for experienced users on how

to install 4DOS.

4DOS Files

The files listed below are part of 4DOS. Depending on where you

obtained your copy, you may find the files in a compressed form,

usually in a file with the extension .ZIP or .ARC. These files

may change from time to time. See the file README.DOC for up to

date information on which files are included with your copy of

4DOS.

INSTALL.BAT* The automatic installation batch file. Note that

INSTALL.BAT will only work with copies of 4DOS

distributed on diskette.

4DOS.COM The 4DOS shell loader and swapper.

4DOS88.EXE Replaces COMMAND.COM as the default MS-DOS command

processor on any PC compatible system.

4DOS286.EXE A version of 4DOS optimized for 80186, 80286,

80386, 80486, V20 and V30 processors. 4DOS286

is slightly smaller and faster than 4DOS88.

4DOS Reference Manual Copyright 1990, J.P. Software

9

4DOS.DOC The 4DOS manual.

KEYSTACK.SYS This device driver provides the support for the

4DOS KEYSTACK command.

HELP.EXE This is the on-line help program for 4DOS. It

provides help for all of the internal 4DOS

commands, and for the external MS-DOS commands.

DOS.HLP The text file for HELP.EXE.

ALIASES Sample predefined 4DOS aliases.

PKUNZIP.EXE* Program used to uncompress the .ZIP files.

PKUNZIP.DOC* Documentation for PKUNZIP.EXE.

COMPAT.DOC Compatibility notes -- look here if you have

trouble getting another program running with

4DOS.

README.DOC Last-minute revisions and bug reports.

* Included only with diskette copies of 4DOS.

Compatibility

Compatibility information varies from release to release of both

4DOS and other products. See Appendix E - Troubleshooting 4DOS

for general usage notes and troubleshooting tips. The file

COMPAT.DOC (distributed with 4DOS) contains the latest

compatibility information available to us, along with information

on how to address known compatibility problems.

If the information in Appendix E and COMPAT.DOC doesn't solve

your problem, contact J.P. Software directly for technical

support.

4DOS Reference Manual Copyright 1990, J.P. Software

10

Test Driving 4DOS

While 4DOS is normally installed as your system's primary command

processor, you can try it out by running it just like any other

program. This allows you to explore the features and advantages

of 4DOS before doing a full installation.

To try 4DOS, copy the files 4DOS.COM and 4DOS88.EXE to your

system disk. If the copy of 4DOS you received has these files

compressed, use the following command to decompress them (this

example assumes the files are stored in the compressed file

A:\4DOS30.ZIP, and you are decompressing them with the PKUNZIP

program onto the root directory of drive C)

pkunzip a:\4dos30 c:\4dos.com c:\4dos88.exe

You can put these files in any directory, including a separate

4DOS directory if you like. Change to that directory, and enter

the command:

4dos

You will see the 4DOS sign-on message and a prompt. You are now

ready to try 4DOS! You can return to COMMAND.COM at any time by

typing:

exit

Note that the 4DOS KEYSTACK command will be unavailable because

it requires the KEYSTACK.SYS device driver to be installed.

Installation of KEYSTACK.SYS is described in the Manual

Installation section.

The 4DOS HELP command will also be unavailable. To try it out,

decompress and/or copy the files HELP.EXE and DOS.HLP to a

directory included in your PATH statement. Then type HELP or

press F1 at the 4DOS prompt to access the 4DOS online help

facility.

There are a few situations where you will need to make some

changes in the method described above. If your system does not

have a hard disk, EMS, or XMS memory, use the following command

to start 4DOS:

4dos /s:n

This will disable 4DOS swapping (floppy disk swapping is too slow

to be useful). Under these conditions 4DOS will require about

70K of memory, instead of the under 4K required in swapping mode.

If you are running network software, you can start 4DOS as above,

but do so after your network is loaded. If you are running a

multitasking or task switching environment such as DESQview or

Microsoft Windows, load 4DOS as above within a partition or

4DOS Reference Manual Copyright 1990, J.P. Software

11

window, rather than attempting to load the operating environment

after 4DOS has started. (These restrictions apply only to

testing 4DOS. Once it is installed as the primary shell and

configured properly for your system, they will not be necessary.)

Quick Start

If you are an experienced MS-DOS user, the following instructions

will get you up and running with 4DOS. If you have trouble or if

these instructions don't make sense, use the automatic or manual

installation procedures described later in this section. These

instructions assume you are booting from a hard disk which is

drive C.

1) Be sure you have a bootable MS-DOS floppy.

2) Decompress and/or copy the files 4DOS.COM, KEYSTACK.SYS, and

4DOS286.EXE (for 8018x/286/386/486, V20, and V30 processors)

or 4DOS88.EXE (for 808x processors) to the root directory of

drive C:.

3) If you have a registered (non-shareware) copy of 4DOS,

change to the root directory of drive C and run the BRAND

program by entering "A:BRAND". Enter the serial number from

the diskette label, and your EXE file will be branded as a

fully registered copy. If you only copied one of the EXE

files, ignore the error message about the missing EXE file.

4) Decompress and/or copy the files HELP.EXE and DOS.HLP to a

directory included in your PATH statement.

5) Edit CONFIG.SYS so that it contains the following lines

(delete any existing SHELL= line):

device=c:\keystack.sys

shell=c:\4dos.com /E:n /A:m /P

where n is your desired environment size, and m is the

desired alias list size (in bytes). The default values are

/E:512 and /A:1024.

6) Reboot your system. The system will load 4DOS (swapping to

XMS, EMS, or disk, depending on what is available), execute

AUTOEXEC, and return to the 4DOS prompt when AUTOEXEC is

done.

7) If you are using PROMPT commands in AUTOEXEC to transmit

ANSI control sequences for key redefinitions, they will not

work with 4DOS; you must use ECHO instead. See the PROMPT

command in the Command Reference Guide for more information.

ANSI control sequences for the prompt itself (to set colors

etc.) will work properly.

4DOS Reference Manual Copyright 1990, J.P. Software

12

8) If you are explicitly setting COMSPEC in AUTOEXEC, you

should delete this line or place a REM in front of it if you

want to use 4DOS as your secondary shell. 4DOS will

automatically set the COMSPEC to C:\4DOS.COM.

Automatic Installation

You must have a diskette version of 4DOS to use automatic

installation. To install 4DOS automatically from a diskette

in drive A to a hard disk configured as drive C, insert the 4DOS

Shareware Disk in drive A and type:

a:install

If you need to install from a drive other than drive A: or to a

drive other than drive C:, use the following command:

x:install x y

where x is the drive containing the 4DOS shareware disk, and y is

the drive on which you want to place the installed copy of 4DOS.

INSTALL will prompt you for your desired configuration, copy the

necessary files to your boot disk, and create some new lines for

CONFIG.SYS. These new lines, in the file CONFIG.4D, must be

merged with your existing CONFIG.SYS file before rebooting your

system to start 4DOS.

NOTE: You may want to edit the new CONFIG.SYS lines if you have

an unusual configuration, or if you want to modify the default

values.

If you have a registered copy of 4DOS, during the installation

process INSTALL will prompt you to insert the registered disk

in order to "brand" your copy of 4DOS with your name and serial

number.

4DOS Reference Manual Copyright 1990, J.P. Software

13

DOS Shells Explained

This section gives an overview of what "DOS shells" (as discussed

in this manual) are, and of primary and secondary shells. This

information is important in understanding how to install and

configure 4DOS. If you already understand these concepts, go on

to the next section.

In the PC world the term shell has come to mean any program that

gives you the capability to execute DOS commands and run

programs. We will use it more precisely to mean the system

command interpreter, the program which reads your keystrokes at

the DOS prompt and interprets them, allowing you to execute

internal commands and run external programs. Before 4DOS,

virtually all PCs using DOS used COMMAND.COM as the shell.

When your system is started, the last thing the system startup

software does is to load a copy of the shell program into memory

and give it control. This program is called the primary or root

shell. It executes AUTOEXEC.BAT, displays the command line

prompt and processes your commands.

The primary shell is the program that executes most of the

commands you enter, either as internal functions (e.g., the DIR

command), or by loading and executing other programs (e.g., a

word processing program).

The text file CONFIG.SYS, stored in the root directory of your

boot disk, tells MS-DOS how to start: what device drivers to

load, how many open files to allow, etc. The SHELL statement in

CONFIG.SYS determines what program is loaded as the primary

shell. If you don't have a SHELL statement, MS-DOS will load

COMMAND.COM as the primary shell. However, any properly written

program can be loaded in place of COMMAND.COM. This is the

normal method for loading 4DOS.

Now, suppose from inside your word processor you invoke the

"shell to DOS" option, to execute some commands without having to

save your files and exit first. When the prompt comes up, you

are running a secondary shell; the word processor has loaded a

shell program into memory to perform commands. When you type the

EXIT command, the secondary shell terminates and control is

returned to the word processor.

The same kind of sequence is used by many programs which run

other programs or execute MS-DOS commands: the program loads a

copy of the command processor (a secondary shell) and passes a

command to it to execute a command or another program. For

example, a hard disk manager which allows you to copy files may

invoke a secondary shell and pass a COPY command to it to

actually perform the copy.

4DOS Reference Manual Copyright 1990, J.P. Software

14

Multitasking or task switching systems may also use secondary

shells to load and execute the programs you specify in each of

the windows or partitions they support. For example, DESQview

will load a secondary shell to execute your program under some

conditions, and will execute the program directly under other

conditions (see the DESQview manual for details).

In all of these situations, the secondary shell need not be the

same program as the primary shell. The two shells are completely

independent, occupy different areas of memory, and generally have

little interaction with each other. Both COMMAND.COM and 4DOS can

work as primary and/or secondary shells.

The COMSPEC Environment Variable

A variable in the MS-DOS environment, COMSPEC, determines which

program is loaded as the secondary shell, just as the SHELL

command in CONFIG.SYS specifies the primary shell program. The

COMSPEC variable is set at startup time to point to the primary

shell program. It can be modified at any time with the SET

command. If COMSPEC does not point to a valid command processor

(including the correct drive and directory), programs attempting

to shell to MS-DOS will fail.

In 4DOS, COMSPEC is set at system startup to d:\4DOS.COM, where

d: represents the drive the system was started from. In

COMMAND.COM, COMSPEC is set to d:\COMMAND.COM.

If 4DOS is your primary shell, and 4DOS.COM and 4DOS88.EXE (or

4DOS286.EXE) are not stored in the root directory of the boot

drive, you MUST set COMSPEC yourself in AUTOEXEC.BAT with the

proper drive and directory for 4DOS.COM and the 4DOS EXE files.

If COMSPEC is not set correctly, you will not be able to shell

out to 4DOS or execute external commands from within your

application programs. For example, if your 4DOS.COM and

4DOS88.EXE or 4DOS286.EXE files are in D:\BIN\4DOS, put the

following command in AUTOEXEC.BAT:

set comspec=d:\bin\4dos\4dos.com

Note that COMSPEC contains only the name of the shell program.

Any options to be passed to secondary 4DOS shells must be set

separately in 4DSHELL (see below).

NOTE: A few ill-behaved programs ignore COMSPEC, and explicitly

load COMMAND.COM as a secondary shell. Although it is possible

to rename 4DOS.COM to COMMAND.COM to handle most of these cases,

we recommend you keep a copy of COMMAND.COM on your system as it

may be needed for other purposes.

4DOS Reference Manual Copyright 1990, J.P. Software

15

Some versions of COMMAND.COM permit specification of an alternate

path for COMMAND.COM as an argument on the SHELL= line in

CONFIG.SYS, and this path is used to set the COMSPEC. This is

not a documented feature of COMMAND.COM, and is not supported by

4DOS.

4DOS Reference Manual Copyright 1990, J.P. Software

16

Manual Installation and Configuration Options

These instructions assume that you are installing 4DOS on a hard

disk with drive letter C, and that you will be placing the 4DOS

system files in the root directory of that disk. If you need to

place the files on another drive or directory (for example, on a

floppy disk system), you will need to adjust the parameters.

The first step in installing 4DOS is to copy the files from the

4DOS disk or compressed file to your boot disk. If you have a

diskette copy of 4DOS, see the README.DOC file on the diskette

for information on exactly how the files are stored.

Copy (or decompress) the following 4DOS system files to the root

directory of your boot disk:

KEYSTACK.SYS

4DOS.COM

4DOS88.EXE, if your system has an 8086 or 8088 CPU (this

applies to most PC and XT systems)

4DOS286.EXE, if your system has an 80186, 80188, 80286,

80386, 80486, or NEC V20 or V30 CPU (this applies to all

AT and 386/486 systems, and some other systems with

accelerator boards or replacement CPU chips)

If you are in doubt about your CPU type, use 4DOS88.EXE until you

can determine the CPU type definitively (see the _CPU variable in

Environment Variables). 4DOS88.EXE will work with all PCs.

Copy (or decompress) the files HELP.EXE and DOS.HLP to a

directory included in your path (i.e. one listed in the PATH

statement in AUTOEXEC.BAT).

Copy (or decompress) the files 4DOS.DOC, README.DOC, COMPAT.DOC,

and ALIASES to any directory you choose, if you wish to have them

available on-line permanently, or temporarily in order to print

them.

4DOS Reference Manual Copyright 1990, J.P. Software

17

4DOS Memory Usage

When installing 4DOS you must decide whether you want to run in

swapping mode or memory-resident mode.

Swapping mode is recommended for most users. In this mode a

small part of 4DOS (the resident portion, less than 4K in size,

from the file 4DOS.COM) resides permanently in low memory. The

remainder of 4DOS (the transient portion, about 70K in size, from

the file 4DOS88.EXE or 4DOS286.EXE), resides at the end of normal

MS-DOS memory, and is swapped out to XMS, EMS, or disk while your

applications are running. This swapping is very fast, especially

if XMS or EMS memory or a RAM disk is available, and it allows

you to have the power of 4DOS, yet keep most of your memory

available for applications.

COMMAND.COM uses a similar approach to keep its resident portion

in low memory and its transient portion at the end of DOS memory.

It does not retain information while applications are running, so

it does not use a swap area. The resident portion of COMMAND.COM

is slightly larger than that of 4DOS. The transient portion is

smaller (about 35K) as COMMAND.COM has far fewer features and

capabilities than 4DOS.

The resident portion of 4DOS takes about 10K of memory to load

(later reduced to less than 4K), and the transient portion 70K,

so you must have about 80K of free memory to load 4DOS in

swapping mode (82K for 4DOS88).

COMMAND.COM requires about 40K of free memory to load. If you

find you are able to load COMMAND.COM as the secondary shell from

a particular program, but are unable to load 4DOS, it is probably

because you have more than 40K but less than 80K of free memory,

or because COMSPEC and/or 4DSHELL (see below) are set

incorrectly.

Memory resident mode is recommended only on systems (older PCs

and some laptops) which have no hard disk, XMS or EMS memory, or

RAM disk. On such systems the only swap area available is a

floppy disk, which is unacceptably slow. In memory-resident

mode, all of 4DOS is loaded permanently into low memory; the

memory required is about 70K for 4DOS286.EXE, or 72K for

4DOS88.EXE.

4DOS Reference Manual Copyright 1990, J.P. Software

18

Setting up CONFIG.SYS

In order to install 4DOS you must modify the CONFIG.SYS file.

First, create a SHELL command to tell MS-DOS to load 4DOS as the

command processor. The format of the command is:

SHELL=d:\path\filename [options]

where d:\path is the drive and directory where the primary shell

program is stored, filename is the full name of that program, and

[options] is any option or parameter values for 4DOS. (See 4DOS

Startup Options.) The options are passed to the program just as

if they had been typed on the command line.

When loading 4DOS, the filename part of the command should be

4DOS.COM. For example, the simplest SHELL command which will

load 4DOS properly is:

SHELL=C:\4DOS.COM /P

This loads 4DOS in swapping mode (4DOS determines the optimal

swapping method), with default sizes for the environment, alias

list, and history list. The /P tells 4DOS it is the primary

shell.

Use an editor to edit or create your CONFIG.SYS file, and set up

your SHELL command as shown above, along with any additional

options you need (see next section). If you already have a SHELL

command for COMMAND.COM, remove it. Examples of SHELL commands

for different systems are given in 4DOS Startup Options.

CAUTION: Due to a bug in all versions of MS-DOS and PC-DOS, the

SHELL command in CONFIG.SYS may not contain more than 33

characters following the name of the shell program (i.e.,

beginning with the first character of the [options] in the

example above). If the line is too long, the options will not be

passed properly to 4DOS, and a variety of errors can occur. You

can usually set all of the 4DOS options without exceeding this

limit, provided you keep 4DOS88.EXE / 4DOS286.EXE in the root

directory of your boot disk. If you need a longer SHELL command

line, 4DOS provides the @filename option (see 4DOS Startup

Options).

In addition to the shell command, if you want to use the 4DOS

KEYSTACK command (see Command Reference), you must place a line

in CONFIG.SYS to load the 4DOS KEYSTACK device driver. This line

should read:

device=c:\keystack.sys

4DOS Reference Manual Copyright 1990, J.P. Software

19

Loading 4DOS Under DOS 2

While we recommend the use of MS-DOS 3.1 or above, 4DOS can be

used with MS-DOS 2. In MS-DOS 2, certain functions require

COMMAND.COM to be loaded as the primary command processor, so you

must load COMMAND.COM first, then load 4DOS. Assuming all files

are in the root directory of drive C, the SHELL command to do

this is:

shell=c:\command.com /c 4DOS [options]

The [options] are defined in 4DOS Startup Options, and should

include /P even though 4DOS is not (technically) the primary

shell. If /P is left off, AUTOEXEC.BAT will not be run.

Note that due to the /C 4DOS on the SHELL line, fewer options can

be used before running into the 33-character limit discussed

earlier. For this reason the "@filename" option may be necessary

when loading 4DOS under DOS 2.

Loading 4DOS in the OS/2 DOS Compatibility Box

4DOS can be loaded in the OS/2 MS-DOS compatibility box, but you

will be limited to either disk swapping or memory resident modes.

(The compatibility box does not support EMS or XMS.)

4DOS Reference Manual Copyright 1990, J.P. Software

20

4DOS Startup Options

This section describes the options that can be included on the

SHELL command in CONFIG.SYS, and/or used for secondary shells

(see 4DSHELL). The same options can also be used when you start

4DOS in a window of a multitasking or task switching environment

such as DESQview or Windows, or from the command line or a batch

file.

@d:\path\filename

Stop processing input from the command line, and switch to

the specified file. Any characters on the line after this

option will be ignored. The file may contain any number of

lines specifying additional 4DOS options, and may be up to a

total of 255 characters long. This option allows you to get

around the 33-character limit on options in the SHELL command

by placing 4DOS options in a separate file.

/A:n

Set the alias list size. The range of allowable alias list

sizes for all shells is 256 - 32000 bytes. The default

value for all shells is /A:1024. The incremental syntax

shown with /E below (/E+n) may also be used with /A.

/C cmd

Load a transient copy of 4DOS, execute cmd, and then return

to the parent command processor. This option is used by

some application programs to start the command processor,

execute a command, and automatically return to the program.

It should never be used in the SHELL statement.

/E

Set the environment size. The range of allowable

environment sizes for all shells is 256 - 32000 bytes.

There are two formats for this option:

/E:n

n is the size of the environment in bytes. The default

for the primary shell is /E:512.

/E+n

Set the environment size to the amount of space

previously used, plus n bytes. This allows you to

guarantee a certain amount of free space in a secondary

shell environment. The default for secondary shells is

/E+128; the minimum increment allowed is 128 bytes.

With either format, appending a U after the size (for

example, /E:512U) will cause 4DOS to load the master

environment into an XMS UMB. (See the /U option below for

more information on UMBs.) This reduces low-memory

requirements, but may not be compatible with some programs

which access the master environment. If no UMB is

4DOS Reference Manual Copyright 1990, J.P. Software

21

available, 4DOS displays an error message, and the

environment is put into low memory.

Appending an S after the size will swap the master copy of

the environment. This will save a small amount of DOS memory,

but will not work with any application that attempts to

modify the master environment (for example, Novell Netware).

4DOS will always ensure there is at least 128 bytes free in

a secondary shell environment, and will override your /E

parameter if necessary.

/H:n

Set the history size, where n is the size of the history

list. (The default is 1024 bytes; the range is 512-8192

bytes.)

/L:d:\path

Tells 4DOS where to find 4DOS88.EXE (or 4DOS286.EXE). The

default is the root directory of the boot drive for the

primary shell, and the path specified by COMSPEC for

secondary shells. You must use this switch if the EXE file

is not in the default location.

/P

Load 4DOS permanently, and run AUTOEXEC.BAT. 4DOS will NOT

run AUTOEXEC.BAT without a /P. This option may be placed

anywhere on the SHELL= line, but normally appears as the

last option. Do NOT use this option for secondary shells,

or you will be unable to return to the primary shell.

/S

Set the 4DOS swapping mode, as follows:

/S:B[d:\path]

Best guess swapping (default mode). 4DOS first tries

XMS memory swapping (on an 80286 or 80386), then EMS,

then disk swapping to the specified drive and directory.

Disk swapping filenames and defaults are as described

for /S:D below.

/S:D[d:\path]

Swap to disk. Creates a file 4DOSSWAP.xxx where xxx is

the current shell nesting level (000 for the primary

shell). If the drive and path are not specified, disk

swapping will default to the root directory of the boot

drive for the primary shell, and the root directory of

the drive specified in COMSPEC for secondary shells.

/S:E

Swap to EMS memory. EMS swapping requires a minimum of

80K free EMS memory for the primary shell, and 32K for

4DOS Reference Manual Copyright 1990, J.P. Software

22

most secondary shells; very large environment, alias

list, and history sizes will require more.

/S:N

Load 4DOS in memory-resident mode (no swapping).

/S:X

Swap to XMS (extended) memory. XMS swapping requires

an XMS device driver and a minimum of 70K of free XMS

memory; large environment, alias list, and history

sizes will require more.

If 4DOS can't access EMS or XMS memory or create the disk

swap file, it will load with swapping disabled (memory-

resident mode). 4DOS displays the type of swapping (XMS,

EMS, or disk) and the amount of swapping space used when it

starts.

If possible, 4DOS will reduce the space used to swap a

secondary shell from 68K or more to about 20K by retrieving

static information from the primary shell's swap area. This

feature will not work if the total of alias, history, and

environment sizes in the secondary shell is larger than the

total 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 space at the top

end of DOS memory).

/U

Move the resident portion of 4DOS to an XMS Upper Memory

Block (UMB). This reduces the size of the resident portion

in low memory from about 3K to 256 bytes, plus the

environment size. This option can only be used on 286 and

386 systems with software which can map memory into the 640K

to 1MB area and have 3K or more of free space in that area,

and which include an XMS driver. XMS swapping may be used

for the rest of 4DOS via /S:X, but is not required for /U to

work. If the UMB load fails, the load will continue with the

resident portion of 4DOS remaining in low memory. See

COMPAT.DOC for up to date information on the memory management

software needed to enable /U to work.

Any text on the 4DOS command line (including the SHELL= line)

following the final option will be interpreted as a startup

program command. This allows you to directly load a program

without running AUTOEXEC.BAT (and giving the user the opportunity

to break out to the MS-DOS prompt with a ^C).

For example, to load 4DOS in EMS swapping mode with a 2048

character alias list and a 2048 character command history:

shell=c:\4dos.com /s:e /a:2048 /h:2048 /p

4DOS Reference Manual Copyright 1990, J.P. Software

23

To load 4DOS with a 2048 character environment in disk swapping

mode, swapping to a RAM disk defined as F:

shell=c:\4dos.com /s:df:\ /e:2048 /p

To load 4DOS in "best available" swapping mode, using drive G for

disk swapping if necessary, loading the .COM and .EXE files from

the directory D:\BIN\4DOS, with a 1024 character environment, a

4096 character alias list, and a 2048 character history, and the

low-memory code moved to a UMB if possible:

shell=d:\bin\4dos\4dos.com @d:\bin\4dos\4dos.opt

The file D:\BIN\4DOS\4DOS.OPT: would contain:

/s:bg:\ /l:d:\bin\4dos /e:1024 /a:4096 /h:2048 /u /p

To load 4DOS in XMS swapping mode, with default history and

environment, and run a program called C:\UTIL\MYSHELL

automatically after the AUTOEXEC file (if any) is completed:

shell=c:\4dos.com /s:x /p c:\util\myshell

The 4DOS EXE file (4DOS88 or 4DOS286) can be loaded directly as

the primary shell, by using it as the filename in the SHELL

command; or as the secondary shell, by using it as the filename

in COMSPEC. For example:

shell=c:\4dos286.exe /e:2048 /p

When the EXE file is loaded directly, rather than via 4DOS.COM,

4DOS will be in memory-resident mode. The only options permitted

are /A:n, /E:n, /H:n, /C, and /P. Aliases will not be inherited

from a previous shell.

We do not recommend this method of loading 4DOS in most

circumstances; to load in memory-resident mode, use the /S:N

option instead. However, you may wish to use it to conserve disk

space (for example, on a laptop with no hard disk), as it does

not require 4DOS.COM to be on your disk.

4DOS Reference Manual Copyright 1990, J.P. Software

24

The 4DSHELL Environment Variable

When loading the primary shell, the shell name and options are

both specified by the SHELL command in CONFIG.SYS. For secondary

shells, COMSPEC specifies the shell name, but not the options.

4DSHELL is an environment variable, used by 4DOS to set the

options for secondary shells. If 4DSHELL is not defined,

secondary shells will use default values for their options. If

options are set on the command line, they will override those in

4DSHELL.

4DSHELL should normally be set in AUTOEXEC.BAT. It can contain

any of the options listed in 4DOS Startup Options, except /C and

/P. If the 4DOS EXE file is not in the directory specified by

COMSPEC, you MUST use the /L option in 4DSHELL, or secondary

shells will not start properly.

The following examples show the use of both COMSPEC and 4DSHELL

to configure your system properly for secondary shell operation.

To load 4DOS.COM and the EXE file from C:\, use EMS swapping in

secondary shells, and guarantee 512 bytes of free environment

space:

[no COMSPEC setting necessary]

set 4dshell=/s:e /e+512

To load 4DOS.COM from C:\BIN and the 4DOS EXE file from D:\BIN,

use best guess swapping (default), and move the resident portion

of secondary shells to an XMS UMB if possible:

set comspec=c:\bin\4dos.com

set 4dshell=/l:d:\bin /u

AUTOEXEC and 4START

The AUTOEXEC.BAT file contains DOS commands to be AUTOmatically

EXECuted by the primary shell when it starts. It is executed

before you are given control at the prompt. The /P switch MUST

be on the SHELL= line in CONFIG.SYS for AUTOEXEC.BAT to be

executed. AUTOEXEC cannot be a .BTM file.

If you do not have an AUTOEXEC.BAT file, COMMAND.COM will prompt

you for the current date and time. 4DOS will not; it will simply

transfer you immediately to the 4DOS prompt.

4START is an optional batch (.BAT or .BTM) file of 4DOS commands

to be executed whenever 4DOS is started, whether as a primary or

secondary shell. This makes it a convenient place to put

configuration commands such as SETDOS, to make 4DOS operate in

the mode you want regardless of whether you are in a primary or

secondary shell. In the primary shell, 4START is executed before

AUTOEXEC.BAT.

4DOS Reference Manual Copyright 1990, J.P. Software

25

You should not load any memory-resident programs (TSRs) from the

4START file, because 4DOS will attempt to load them every time it

starts a new shell.

You shouldn't load aliases from 4START, since 4DOS will pass them

automatically to secondary shells.

4DOS and COMMAND.COM

In virtually all circumstances you will want to load 4DOS as your

primary and secondary shell. However, there are a handful of

ill-behaved programs which dynamically modify COMMAND.COM, or

otherwise interact with COMMAND.COM in a non-standard way, which

may require you to load COMMAND.COM in order to work properly.

In some circumstances, to run a particular program you may need

to load a copy of COMMAND.COM from within 4DOS, then run the

program. In very rare circumstances, you may need to load

COMMAND.COM as the primary shell and then load 4DOS. An

explanation of both techniques is included in Appendix E and the

file COMPAT.DOC, along with a list of the programs known to

require them.

You may also find that in some cases, when there is a need to

shell to DOS with very little memory available, you wish to use

COMMAND.COM as your secondary shell, while 4DOS is the primary

shell. To do so, simply set your COMSPEC to point to

COMMAND.COM.

If you wish to run a copy of COMMAND.COM from the 4DOS prompt for

testing or other purposes, be sure to set the COMSPEC to point to

COMMAND.COM first. If you don't, and an application overwrites

the COMMAND.COM transient portion, COMMAND.COM may be unable to

reload itself, and will give an error message and return to 4DOS.

4DOS Reference Manual Copyright 1990, J.P. Software

26

Using 4DOS

This section briefly reviews 4DOS features, and provides some

examples of how 4DOS can help improve your productivity, and make

your computer easier to use. It also documents the features of

4DOS which are not related to specific commands, such as command

line editing, command history, command syntax, and batch files.

Starting 4DOS

Whenever 4DOS is loaded, it searches the boot directory for the

file 4START.BTM or 4START.BAT, and executes it if found. If 4DOS

is started with the /P option, it will then execute AUTOEXEC.BAT.

Because 4START is always executed when 4DOS starts, it provides a

convenient place to put the 4DOS configuration commands (for

example, SETDOS parameters) that would otherwise not be set when

executing a secondary copy of 4DOS. (For example, when shelling

out to MS-DOS from within a program.) See the Command Reference

Guide for more information on SETDOS.

When setting up 4START and AUTOEXEC.BAT, we recommend you break

up the work to be done into smaller batch files. In particular,

if you put the aliases and environment variables into separate

batch files and use CALL to invoke them, you can edit and

reinvoke them later without having to reboot the system.

4DOS Reference Manual Copyright 1990, J.P. Software

27

Command Line Editing

The following keys have special meanings when editing command

lines (the caret ^ means press the Control key together with

the specified key):

Left Arrow Move the cursor left one character.

Right Arrow Move the cursor right one character.

Up Arrow Recall the previous command from the history list,

or match a partial command entry with a history

list entry.

Down Arrow Recall the next command from the history list, or

match a partial command entry with a history list

entry.

^Left Arrow Move the cursor left one word.

^Right Arrow Move the cursor right one word.

Home Move the cursor to the beginning of the line.

^Home Delete from the beginning of the line to the

character preceding the cursor.

End Move the cursor to the end of the line.

^End Delete from the cursor to the end of the line.

Ins Toggle between insert and overstrike mode.

Del Delete the character at the cursor.

Backspace Delete the character to the left of the cursor.

CR or LF Execute the command.

Esc Erase the entire line.

^L Delete the word to the left of the cursor.

^R or ^Bksp Delete the word to the right of the cursor.

^C Cancel the command.

^D Delete the history list entry, erase the line, and

display the previous history entry.

^E Go to the end of the history list and display the

entry.

^K Save the command to the history list, and erase

the line.

F1 Call the on-line help (HELP.EXE).

F3 Repeat or complete the previous line from the

history list (as in COMMAND.COM)

F8, F9 & F10 F9 scans the filename (including the wildcard

characters * and ?) at or immediately to the left

of the cursor position, and replaces it with the

first matching filename. Pressing F9 again

substitutes the next filename; pressing F10

appends the next filename at the current cursor

position. Pressing F8 gets the previous

filename. If you don't enter an extension, F9

will append *.* to the filename; otherwise, F9

will append *. See Command History and Recall

for more information on filename completion.

Alt-255 You can enter characters that would normally be

interpreted by the line editor as a command (for

example, ^D) by preceding them with an Alt-255.

(Hold down the Alt key and enter 255 on the

numeric keypad.)

Anything else Enter that character at the cursor position.

4DOS Reference Manual Copyright 1990, J.P. Software

28

Command History and Recall

4DOS saves each command into the command history list as it is

entered (except when executing a batch file), allowing you to

display, recall, search, and modify previous commands.

The history list size is determined by the /H parameter at

startup time (see Installation). The history is a circular list;

when the history list is full, 4DOS discards the oldest

command(s) before adding the newest.

The command history list can be displayed or cleared with the

HISTORY command. The /H option in SETDOS allows you to enable or

disable the history saves, and to specify a minimum length to

save. (See the Command Reference Guide for more information on

HISTORY and SETDOS.) You can prevent a command line from being

saved in the history list by beginning it with an @.

The simplest use of the command history is to repeat commands

exactly. For example, you might enter the command:

dir /2p b:*.wks b:*.doc

and then move some files to or from drive B. When you're

through, you want to repeat the DIR command. Just press the up-

arrow repeatedly to scan back through the history list; when the

DIR command appears, press ENTER to reexecute it.

After you've found the command, you can also edit it before

pressing ENTER. This provides a simple means of executing a

series of commands that differ only slightly from each other.

Another powerful feature is command completion, which searches

the command history for the last command that begins with the

characters you entered. In the above example, you can quickly

recall the DIR command by typing DI, and pressing the up arrow.

4DOS will display the most recent command in the history list

that begins with DI. Pressing the up arrow again will display

the next most recent match. Typing DI and pressing the down

arrow key instead would search for the oldest matching command in

the history list. 4DOS will beep if there are no matching

commands.

4DOS Reference Manual Copyright 1990, J.P. Software

29

4DOS also offers filename completion. For example, suppose you

want to copy a file. You remember that the name starts with AU,

but you can't remember the rest. Enter:

copy au

and press the F9 key. The first filename that starts with AU

will be inserted in the command line. If it's the right file,

simply complete your command. If it's not, press F9 again to

substitute the next matching filename. If you go past the

filename(s) you wanted, pressing the F8 key will return the

previous matching filename. The F10 key saves the current

filename, and then appends the next matching filename to the

command line. You can use the wildcard characters (* and ?) in

the filename. 4DOS will beep when there are no more matching

filenames.

Multiple Commands

You may enter multiple commands on a single line. The default

command separator is a caret (^). For example, the following

command displays a directory and then copies files to the root

directory on drive A:

dir *.bat ^ copy *.bat a:\

The command separator character can be changed by setting the

COMPOUND variable (see the SETDOS command in the Command

Reference Guide).

Conditional Commands

When an internal or external command finishes, it returns a

result, called the exit code. The conditional commands allow you

to perform tasks based upon the previous command's exit code.

(See also the IF ERRORLEVEL and IFF ERRORLEVEL commands in the

Command Reference Guide.)

If two commands are separated by && (AND), the second command

will be executed only if the first returns an exit code of 0.

If two commands are separated by || (OR), the second command will

be executed only if the first returns a non-zero exit code.

NOTE: All 4DOS internal commands return an exit code (0 if

successful, or non-zero for an error return), but not all

external programs do. Conditional command behavior will be

unpredictable for programs that don't explicitly return an exit

code.

4DOS Reference Manual Copyright 1990, J.P. Software

30

For example, if the BACKUP operation fails, the files will not be

erased:

backup c:\ a: /s && global erase *.bak *.lst

If the BACKUP operation fails, then ECHO will display a message:

backup c:\ a: /s || echo Error in the backup!

Escape Character

4DOS has a user-definable escape character (a character which

gives the following character a non-standard meaning, not the

same as the ASCII ESC). The default is ^X (control-X, which will

be displayed as an up arrow ), but another character can be used

by setting the ESCAPE variable (see the SETDOS command in the

Command Reference Guide). 4DOS assumes special meanings when

these characters follow the escape character on the command line:

b backspace

e the ASCII ESC character (27 decimal)

f formfeed

n linefeed

r carriage return

Any other character following the escape character is copied

directly to the command line and the escape character is removed.

This allows you to suppress the normal interpretation of special

characters (such as ? * / \ | ` > < and &).

For example, to send a form feed followed by the sequence ESC Y

to the printer:

echo f eY > prn

4DOS Reference Manual Copyright 1990, J.P. Software

31

Command Echoing

Like COMMAND.COM, 4DOS defaults to ECHO ON in batch files. To

prevent a line from being echoed, preface it with the @ symbol.

You can tell 4DOS to default to ECHO OFF by setting the variable

VERBOSE to 0 (see the SETDOS command in the Command Reference

Guide).

4DOS also offers command echoing during keyboard input. If ECHO

is set ON from the command line, the fully parsed and expanded

command (including alias and variable expansion) will be

displayed before it is executed. If the command line contains

multiple commands, each command is echoed separately just before

it is executed.

Note that the command line echo state and batch file echo state

are independent. Turning echo on or off inside a batch file will

not affect command line echoing, and vice versa.

Argument Quoting

4DOS normally parses command line arguments by searching for

white space (blanks, tabs, and commas). Command line arguments

enclosed in back quotes (`) or double quotes (") may contain

white space. No special processing (alias or variable expansion,

and I/O redirection) will be performed on expressions enclosed in

quotes, except variable expansion WILL be performed inside double

quotes.

4DOS will strip back quotes from the command line before

executing the command. Double quotes will be passed through to

the command.

For example, suppose the batch file QUOTES.BAT contains the

following commands:

@echo off

echo Arg1 = %1

echo Arg2 = %2

echo Arg3 = %3

and that the environment variable %FORVAR has been defined as:

set %forvar=for

Entering the command:

quotes `Now is the time %forvar` all good

produces the following output:

Arg1 = Now is the time %forvar

Arg2 = all

Arg3 = good

4DOS Reference Manual Copyright 1990, J.P. Software

32

and entering the command:

quotes "now is the time %forvar" all good

produces the following output:

Arg1 = "Now is the time for"

Arg2 = all

Arg3 = good

When an alias is defined in a batch file or from the command line

(see Aliases), its argument should be enclosed in back-quotes to

prevent the expansion of parameters, variables, and multiple

commands until the alias is invoked. Back quotes should NOT be

used when defining aliases to be read in an ALIAS /R file.

Batch Files

COMMAND.COM executes batch files by opening the file, reading one

line, saving the position, closing the file, executing the line,

opening the file, moving to the saved position, reading the next

line, etc. This scheme has two advantages: batch files can

modify themselves dynamically, and they can extend across

multiple disks. It also has one disadvantage: batch files run

very slowly.

For the sake of compatibility, 4DOS processes .BAT files the same

way. But 4DOS also offers a much faster approach, called Batch

to Memory (.BTM). Since a .BTM file is loaded entirely into RAM

before it is executed (requiring only one disk access), .BTM

files run two to five times faster than .BAT files (even faster

on floppy disks). For very small batch files the difference

between .BAT and .BTM files will be negligible, but for large

files or ones with loops, a .BTM will run nearly as fast as an

alias. Most .BAT files can be renamed to a .BTM extension and

immediately realize a significant performance improvement.

The maximum size of a .BTM file is 64K bytes.

You should not use a .BTM file (or a .BAT file which is CALLed

from a .BTM file) to load memory-resident (TSR) programs. If you

do, the memory used for the .BTM file will be located below the

TSR. When the .BTM file exits, this memory will be freed and you

will be left with a "hole" in memory. This is not harmful, but

wastes memory.

4DOS also offers an additional "Cancel ALL" option for ^C

handling in batch files. If you press ^C or ^BREAK while in a

batch file, 4DOS will prompt:

Cancel batch job ? (Y/N/A) :

4DOS Reference Manual Copyright 1990, J.P. Software

33

Pressing N will continue batch processing at the next line.

Pressing Y will end the current batch file and return to the

calling batch file (if any). Pressing A will cancel all batch

file processing, regardless of the nesting level (see CALL and

CANCEL in the Command Reference Guide) and return to the command

prompt.

Batch File Variables

Batch file variables are only active inside a batch file. They

are referenced as %0 to %127, and expand to the matching argument

on the command line that started the batch file. The parameter

%n& is a special case, and expands to all arguments in the

command line tail, starting at argument number n. If n is not

specified, it defaults to 1 (so %& expands to all arguments in

the command line tail).

The batch variable %# expands to the number of command line

arguments, not including %0 (the batch file name).

Note that the SHIFT command will shift both the numbered

variables (%0, %1, etc.) and the %n& and %# variables.

4DOS Reference Manual Copyright 1990, J.P. Software

34

Aliases

Much of the power of 4DOS comes together when using aliases. An

alias is a new name for a command or combination of commands.

Aliases are defined with the ALIAS command, and removed with the

UNALIAS command. Aliases are expanded before the command line is

broken up for multiple commands, redirection, and conditional

commands. Aliases may be nested; i.e., an alias can refer to

another alias, but they cannot refer back to themselves.

The alias name is limited to no more than 80 characters, and the

alias argument to no more than 255 characters.

The simplest type of alias is to give a new name to an existing

command. For example:

alias up cd ..

defines the alias UP to mean "change to the parent directory".

Aliases can also create a customized version of a command. For

example, the 4DOS DIR command allows a directory to be sorted in

various ways. The alias:

alias de dir /oe /p

defines the alias DE to mean "sort the directory by extension,

pausing after each page."

Aliases can also be used to execute multiple commands; when used

this way they act like very fast, in-memory batch files. For

example, entering the command:

alias w `pushd c:\wp ^ wp %& ^ popd`

defines the alias W to mean "save the current directory, change

to the WP directory on C, run the WP program passing it all of

the arguments on the command line following the alias name, and

when finished, restore the original directory." The back quotes

are required to tell 4DOS this is a single alias with three

commands, rather than three commands on a single line (see

Multiple Commands).

You can stop alias expansion by prefacing the alias with an

asterisk (*). This allows you to use aliases to define commands

as variations of themselves, or to rename internal commands to

avoid conflicts with external programs. For example, the alias

definition:

alias global global /I

will fail with an "alias loop" error message, but the alias:

alias global *global /I

4DOS Reference Manual Copyright 1990, J.P. Software

35

will work properly. You can also use this feature to rename a

4DOS internal command (for example, if you have an external

program of the same name). The following alias definitions

rename the LIST command to DISPLAY, and call an external program

for LIST:

alias display *list

alias list c:\util\list.com

Alias names can be truncated by including an asterisk (*) in the

alias name. For example, if you have an alias defined as:

alias wher*eis dir /dp

you can refer to it as wher, where, wherei, or whereis.

Alias definitions can include replaceable parameters, like those

in batch files. Alias parameters are referenced as %1 to %127,

and expand to the matching command line argument. The parameter

%n& is a special case, and expands to all arguments in the

command line tail, starting at argument number n. If n is not

specified, it defaults to 1 (so %& expands to all arguments in

the command line tail).

If an alias has replaceable parameters, 4DOS will delete command

line arguments up to and including the highest referenced

argument. For example, if you have an alias which refers only to

%1 and %4, then the first and fourth arguments passed to the

alias will be used, the second and third arguments will be

discarded, and any additional arguments beyond the fourth will be

appended to the end of the alias. If an alias has no replaceable

parameters, all of the command line arguments will be appended to

the alias.

For example, the following alias will change directories, perform

a command, and return to the original directory:

alias in `pushd %1 ^ %2& ^ popd`

When this alias is invoked with:

in c:\comm mycomm /xmodem /2400

it is expanded into the following three commands:

pushd c:\comm

mycomm /xmodem /2400

popd

4DOS Reference Manual Copyright 1990, J.P. Software

36

The distribution disk includes a sample alias file (ALIASES)

which demonstrates a number of useful predefined aliases.

See the ALIAS and UNALIAS commands in the Command Reference Guide

for more information and examples.

Executable Extensions

4DOS provides a means to specify a program to be invoked when a

filename which does not have a .COM, .EXE, .BTM, or .BAT

extension is entered as the first argument on the command line.

For example, you could start your text editor when a text file is

specified, or your spreadsheet program when a worksheet file is

specified.

4DOS uses environment variables to define what program or batch

file to run for a particular extension. The syntax of the SET

command to define an executable extension is:

SET .ext=d:\path\program [options]

where .EXT is the file extension, D:\PATH\PROGRAM is the full

name of the program or batch file to be called, and [options]

are any startup options you want to specify for the program. The

file to be executed must be a .COM, .EXE, .BTM, or .BAT file; it

cannot be an alias or internal command.

For example, the following command would define BASICA.COM as the

processor for .BAS files:

set .bas=c:\dos\basica.com

The following command would define B.EXE (the Brief text editor)

as the processor for .C files:

set .C=c:\brief\b.exe -Mxyz

If you have a file HELLO.C, and enter the command:

hello -i30

4DOS expands the command line to:

c:\brief\b.exe -Mxyz hello.c -i30

4DOS Reference Manual Copyright 1990, J.P. Software

37

Note that 4DOS inserts the value of the environment variable at

the beginning of the line, including any options, then appends

the original command name (i.e., the file name, with extension

added if necessary), and the remainder of the original command

line.

4DOS searches for external commands in the following order:

.COM, .EXE, .BTM, .BAT, and executable extensions (in the order

they appear in the environment) in the current directory, and

then in each subdirectory specified by the PATH environment

variable.

4DOS Reference Manual Copyright 1990, J.P. Software

38

Keystack

The KEYSTACK command can be used in aliases and batch files to

feed keystrokes to application programs. The most common use of

KEYSTACK is to have a program take certain actions when it

starts. For example, when the alias (this should be entered on

one line):

alias 321 `keystack 0 13 0 13 0 13 0 13 0 13 "/fr" 0 "%1" 13

^

123`

is executed as:

321 February

it loads Lotus 1-2-3, skips the startup screens, and loads the

spreadsheet FEBRUARY.WK1.

KEYSTACK can store up to 255 characters, enough keystrokes to

cause a program to do an entire operation and exit. For example,

the following alias DRPT will run a dBASE report called TIMEREP

in the directory DATA (this should be entered on one line):

alias drpt `pushd c:\data ^ keystack "use times index times"

13 "report form timerep to print" 13 "quit" 13 ^ dbase ^

popd`

See the Command Reference Guide for more information on KEYSTACK.

KEYSTACK.SYS is a small device driver invoked in your CONFIG.SYS

file (see Installation) and used to support the KEYSTACK command.

You must have KEYSTACK.SYS installed to use the KEYSTACK command.

4DOS Reference Manual Copyright 1990, J.P. Software

39

Environment Variables

Environment variables are defined with the SET command. (See the

Command Reference Guide for more information on SET.)

Environment variables are expanded before the command line is

broken up for multiple commands, redirection, and conditional

commands, but after alias expansion has been done.

Variables are referenced in a command by starting the variable

name with a percent sign (%). Two percent signs in a row (%%)

signify a percent sign character. An environment variable name

is terminated by either another percent sign, or by an invalid

character (see below). To pass a variable name (instead of the

value) to a command (for example, in INKEY or INPUT), you must

precede it with two percent signs.

Environment variable names may be composed of any alphanumeric

character, plus the underscore (_) and $ characters.

For example:

c:\> set start=c:\wordproc\myfiles\memos

c:\> dir /w %start

In addition to the standard variable name characters, you can

force 4DOS to accept any sequence of characters as a valid

variable name by enclosing it in square brackets. For example:

%[AB##1]

refers to an environment variable named AB##1.

There are some variable names that have special meanings in 4DOS.

Only PATH, CMDLINE and TMP are actually stored in the

environment; the remainder are internal to 4DOS, and cannot be

viewed or modified with SET or ESET. The internal variable names

are checked after variable expansion, so they can be overridden

by creating an environment variable of the same name.

? returns the exit code of the last external program (see

ERRORLEVEL). This allows you to save an exit code into

another variable and then process it later, or to see what

a program is actually returning.

PATH tells 4DOS where to search for executable files (.COM,

.EXE, .BTM and .BAT) not in the current directory. Some

applications also use the PATH variable to find their

files.

CMDLINE is the fully expanded 255-character command line. You

can access it from an external program by searching the

environment.

4DOS Reference Manual Copyright 1990, J.P. Software

40

TMP specifies where 4DOS should put the temporary pipe files

(see Redirection).

_BG is the screen background color at the current cursor

position.

_COLUMNS is the width of the screen

_CPU is the cpu type, returned as a string:

86 8086 and 8088

186 80186 and 80188

200 NEC V20 and V30

286 80286

386 80386 and 80486

_CWD is the current directory in the format d:\pathname.

_CWDS has the same value as CWD, except it ensures the pathname

ends in a backslash (\).

_CWP is the current directory in the format \pathname.

_CWPS has the same value as CWP, except it ensures the pathname

ends in a backslash (\).

_DATE contains the current system date, in the format mm-dd-yy

(U.S.), dd-mm-yy (Europe), or yy-mm-dd (Japan).

_DISK is the current disk (for example, C).

_DOSVER is the current MS-DOS version (for example, 3.3).

_DOW is the day of the week as a string (Mon, Tue, etc.)

_FG is the screen foreground color at the current cursor

position.

_NDP is the numeric data processor (coprocessor) type, returned

as a string:

0 no coprocessor is installed

87 8087

287 80287

387 80387

_ROWS is the height of the screen

_SHELL is the current shell nesting level (in swapping mode).

The root shell is 0. If you are not in swapping mode,

_SHELL returns 99.

4DOS Reference Manual Copyright 1990, J.P. Software

41

_TIME contains the current system time in the format hh:mm:ss .

The separator character may vary depending depending upon

your country information - see CHCP in the Command

Reference Guide).

Variable Functions

4DOS Version 3 introduces a new type of environment variable.

Called Variable Functions, they take one or more arguments (which

can be environment variables or variable functions themselves),

and return a value. Like all environment variables, variable

functions must be preceded or surrounded by % signs when used.

The variable functions are:

@eval[expression] - evaluate an arithmetic expression. It

supports parentheses, addition, subtraction, multiplication,

division, and modulo (%%). The expression can contain envi-

ronment variables, including other variable functions. The

elements of the expression and the result are integers between

-2,147,483,640 and +2,147,483,647. For example, if the value

of the variable "a" is 5, then %@eval[(%a*4)-2] returns 18.

@ext[filename] - returns the file extension (without the

leading period)

@full[filename] - returns the fully qualified path name

@index[string1,string2] - returns the position of string2 within

string1. The first position in string1 is numbered 0. If

there is no match, the function returns -1.

@len[string] - returns the length of the string

@line[filename,n] - returns line "n" of the specified file.

(The

first line is line 0.)

@lower[string] - returns the string shifted to lower case

@name[filename] - returns the filename only (no path or extension)

@path[filename] - returns the path only (including the trailing

backslash)

@search[filename] - searches for the filename, using the PATH

environment variable, and appends an extension (.COM, .EXE,

.BAT, .BTM, or executable extension) if one wasn't specified.

@substr[string,start,length] - returns a substring, starting at

the position start and continuing for length characters.

If

length is negative, the start is relative to the right side.

(The first character is 0.) For example, to get the current

time and extract the hour use %@substr[%_time,0,2].

@upper[string] - returns the string shifted to upper case

4DOS Reference Manual Copyright 1990, J.P. Software

42

I/O Redirection

MS-DOS assumes input comes from the keyboard and output goes to

the display. The keyboard is referred to as the standard input,

and the display is referred to as the standard output. You can

change the default standard input and standard output by using

the < and > symbols on the command line. 4DOS also allows you to

redirect the standard error by appending the & character.

Normally, when redirecting standard output, if the specified file

doesn't exist, it is created; if it exists, it is overwritten,

and the previous contents are lost. If the variable NOCLOBBER is

set (see the SETDOS command in the Command Reference Guide), an

error message will be displayed if the file already exists.

For example, to get standard input from a file instead of the

keyboard, append:

< filename

to the command line. To redirect standard output to a file:

> filename

To redirect standard output to a file, overriding the NOCLOBBER

setting:

>! filename

To redirect standard output and standard error to a file:

>& filename

To redirect standard error only to a file:

>&> filename

To redirect standard output and standard error to a file,

overriding the NOCLOBBER setting:

>&! filename

To append standard output or standard error to a file, use >> in

place of the first >. If NOCLOBBER is set, the file must exist

before it can be appended to (unless overridden by a !).

Otherwise, 4DOS will create the file.

Pipes allow you to send the output of one command to the input of

another command by separating the commands with the vertical bar

(|). 4DOS will perform the commands in order from left to right.

4DOS Reference Manual Copyright 1990, J.P. Software

43

For example, to use the standard output of command1 as the

standard input of command2:

command1 | command2

To use the standard output and standard error of command1 as the

standard input of command2:

command1 |& command2

4DOS creates temporary files to hold the output of the pipes.

The default directory for these temporary files is the root

directory on the boot drive, but this can be overridden with the

TMP environment variable. This is useful when booting from a

floppy disk or a read-only network drive, or to speed up piping

operations by putting the temporary files on a RAM disk.

For example, to put the pipe files on a RAM disk defined as drive

E:

set tmp=e:\

4DOS also provides TEE and Y "pipe fittings" (see the Command

Reference Guide for more information on TEE and Y).

4DOS Reference Manual Copyright 1990, J.P. Software

44

Command Parsing

Because of the number of features in 4DOS, the command line

parsing is somewhat complex. The following is a summary of the

process 4DOS uses to interpret command line input:

ù Read the command line (from console or batch file) and strip

leading white space

ù Check for a leading @

ù Save line to history list if no @ found, and if not in a

batch file

ù Set the "no echo" flag if @ found

ù Perform alias expansion, including expansion of nested

aliases, for the first command on the line.

ù Perform environment variable expansion (except the EXCEPT,

FOR, GLOBAL, and SELECT commands) for the first command on

the line

ù Scan the first command for pipes, compound commands or

conditionals

ù Perform redirection (except the EXCEPT, FOR, GLOBAL, and

SELECT commands)

ù Get the first argument and search for commands in the

following order:

1. Internal commands

2. External commands - .COM, .EXE, .BTM, and .BAT in that

order

3. Executable extensions (in the order they appear in the

environment)

ù Execute the command

ù Get the remainder of the command line, if any, and test for

conditionals

ù Repeat the above steps for the next command on the line (if

any)

If you are having trouble getting aliases, batch files, multiple

commands, environment variable substitution, or other features

related to command parsing to work properly, you may want to step

through the command to determine how 4DOS is parsing it. When

doing this you may find it useful to run the command with ECHO

set on so you can see the expanded command 4DOS is trying to

execute.

4DOS Reference Manual Copyright 1990, J.P. Software

45

Command Reference Guide

4DOS has more than 70 internal commands. Some are the same as,

or improvements of, those in COMMAND.COM. The remainder are new

commands.

These commands are equivalent to those in COMMAND.COM:

BREAK CHCP CTTY DATE

EXIT GOTO TIME VER

VERIFY

These commands are enhanced:

CD CHDIR CLS COPY

DEL DIR ECHO ERASE

FOR IF MD MKDIR

PATH PAUSE PROMPT RD

REM REN RENAME RMDIR

SET SHIFT TYPE VOL

These commands are new:

? ALIAS ATTRIB BEEP

CALL CANCEL CDD COLOR

DESCRIBE DIRS DRAWBOX DRAWHLINE

DRAWVLINE ENDLOCAL ESET EXCEPT

FREE GLOBAL GOSUB HISTORY

IFF INKEY INPUT KEYSTACK

LIST LOG MEMORY MOVE

POPD PUSHD QUIT RETURN

SCREEN SCRPUT SELECT SETDOS

SETLOCAL SWAPPING TEE TEXT

TIMER UNALIAS UNSET Y

4DOS Reference Manual Copyright 1990, J.P. Software

46

Command Syntax

Words in uppercase are keywords and must be entered. Words in

lowercase are either options (e.g., "on", "off", "bright",

"blink") or variables (e.g. "filename", "path").

The expression d: represents a disk drive specification. (This

can be A:, B:, C:, etc.).

Words or letters in brackets ([ ]) are optional and are not

required to be entered.

A vertical bar (|) separating words means enter one word or the

other, but not both.

A letter preceded by a forward slash (/) is a switch. Switches

are used to enable or disable the various command options.

Because 4DOS supports multiple arguments for most commands,

switches affect specific arguments, and must be placed with those

arguments. Pay careful attention to switch placement as it is

described under the various commands. The effects occasionally

vary between commands in order to retain compatibility with

COMMAND.COM.

An ellipsis (...) means additional arguments are allowed, but not

required.

In the examples in the printed manual, characters in bold type

represent input from the user. Characters in normal type

represent 4DOS prompts or responses.

4DOS Reference Manual Copyright 1990, J.P. Software

47

?

Syntax: ?

Purpose: Display the 4DOS commands.

Comments: ? will display the 4DOS internal commands. For help

with the internal 4DOS and external DOS commands, see

the HELP command.

Example: Display the internal commands:

c:\> ?

? ALIAS ATTRIB BEEP

BREAK CALL CANCEL CD

CDD CHCP CHDIR CLS

COLOR COPY CTTY DATE

DEL DESCRIBE DIR DIRS

DRAWBOX DRAWHLINE DRAWVLINE ECHO

ENDLOCAL ERASE ESET EXCEPT

EXIT FOR FREE GLOBAL

GOSUB GOTO HISTORY IF

IFF INKEY INPUT KEYSTACK

LIST LOG MD MEMORY

MKDIR MOVE PATH PAUSE

POPD PROMPT PUSHD QUIT

RD REM REN RENAME

RETURN RMDIR SCREEN SCRPUT

SELECT SET SETDOS SETLOCAL

SHIFT SWAPPING TEE TEXT

TIME TIMER TYPE UNALIAS

UNSET VER VERIFY VOL

Y

4DOS Reference Manual Copyright 1990, J.P. Software

48

ALIAS

Syntax: ALIAS [/P] [/R filename...] [name[=][value]]

Purpose: Load or display the alias list, or define name as a

substitute for value.

Comments: Aliases are useful as a means of executing a complex

series of commands with a few keystrokes. Aliases can

also be used as "in memory batch files," and will run much

faster than disk-based batch files.

If you only specify name, ALIAS displays the current

alias value for name. Otherwise, ALIAS assigns the

command(s) in value to name. (Value may contain

environment variables or additional aliases.) Name can

now be used as if it were a built-in or external command.

If you don't specify any arguments, ALIAS displays the

current alias list.

Name is limited to no more than 80 characters, and

value to no more than 255 characters.

The /P(ause) option will pause after displaying each

page and wait for a key to be pressed.

The /R(ead) option allows you to load an alias list

from a file. This is much faster than loading aliases

from a batch file. The file is in the same format as the

ALIAS display, so ALIAS /R can accept as input a file

generated by redirecting ALIAS output. You can add

comments to an alias file by starting the comment line

with a colon (:). You can load multiple files with

one ALIAS /R command by placing the names one after

another on the command line, separated by spaces.

For example, the following commands will save the

aliases to a file, and then reload them from that file:

alias > alist

alias /r alist

When defining aliases at the command line, back quotes

must be used around the alias arguments that contain

multiple commands or variable references (%1, %&2, etc.)

to prevent premature expansion. Back quotes should NOT be

used when defining aliases in a file to be read with ALIAS

/R.

4DOS Reference Manual Copyright 1990, J.P. Software

49

Aliases may be nested; i.e., an alias can refer to another

alias, but they cannot refer back to themselves (a=b=a).

You can stop further alias expansion by prefacing the

alias argument with an asterisk (*). This also allows an

alias to refer to a command of the same name (see below

for an example).

An alias name can be truncated by including an asterisk

(*) in the alias name (see example).

To remove an alias, use the UNALIAS command.

For more information on aliases (including the use of

variables), see the Aliases section in Using 4DOS, and the

sample file ALIASES, distributed with 4DOS.

Example: Define D as an alias for DIR /AP:

c:\> alias d dir /ap

Display the current alias(es):

c:\> alias

D=dir /ap

The following example creates a new command WHEREIS

that searches a disk for matching files and

subdirectories:

c:\> alias whereis dir /dp

The same command using alias name truncation (this

alias can be referenced as wher, where, wherei, or

whereis):

c:\> alias wher*eis dir /dp

The following example erases the backup files, and then

displays the directory (the back-quotes are necessary to

prevent 4DOS from processing the command separator ^):

c:\> alias zap `del *.bak ^ dir /w`

4DOS Reference Manual Copyright 1990, J.P. Software

50

Redefine the 4DOS DIR command as a variation of itself

(wide display, including hidden and system files, pausing

after each page):

c:\> alias dir *dir /whp

Rename the 4DOS LIST command to DISPLAY, and alias LIST

to an external program:

c:\> alias display *list

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

The following examples show the use of alias arguments:

c:\> alias zap `erase %& ^ chkdsk ^ dir /w`

c:\> zap *.bak *.lst

This expands to:

erase *.bak *.lst ^ chkdsk ^ dir /w

c:\> alias reverse `echo %5 %4 %3 %2 %1`

c:\> reverse one two three four five

This expands to:

echo five four three two one

The following example shows the use of IFF inside an

alias. The alias modifies the SET command so that if SET

is entered with no arguments, it is replaced by a SET /P

(pause after displaying each page). Note the use of

asterisks (*set) to prevent alias loops (this should be

entered on one line):

c:\> alias set `iff "%1"=="" then *set /p^

else *set %&^endiff`

4DOS Reference Manual Copyright 1990, J.P. Software

51

ATTRIB

Syntax: ATTRIB [/D] [-|+[AHRS]] [d:][path]filename...

Purpose: Change the file or subdirectory attributes.

Comments: ATTRIB normally only modifies file attributes.

Specifying the /D(irectory) option will also modify

subdirectory attributes.

+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 file attribute

-S Clear the system file attribute

4DOS will preserve the previous file attributes and

change only the specified attributes. New attribute

values are allowed between filenames; otherwise ATTRIB

uses the same attributes specified for the previous

file(s). You cannot modify the directory or volume label

attributes.

You can display the file and subdirectory attributes

using the /A option in DIR.

Example: Set the read-only and hidden attributes for the file

MEMO:

c:\> attrib +rh memo

Set the archive attribute (file has been modified) for

MEMO, and change TEST.COM to system and not modified:

c:\> attrib +a memo +s -a test.com

4DOS Reference Manual Copyright 1990, J.P. Software

52

BEEP

Syntax: BEEP [frequency duration ...]

Purpose: Beep the speaker.

Comments: BEEP is normally used in batch files to signal that an

operation has been completed, or that the computer needs

attention (for example, to change disks). Because BEEP

allows you to specify the frequency and duration, you can

use it to play simple music. You can specify multiple

frequency/duration pairs on the command line.

The frequency is specified in Hertz, and the duration

in 1/18th second intervals. No sound will be generated

for frequencies less than 20 Hz, allowing you to insert

short delays. The default value for frequency is 440 Hz;

the default value for duration is 2.

The following table gives the frequency values for a

five octave range (middle C is 523 Hz):

_______________________________________________________

| | | | | | | |

| C | 65 | 131 | 262 | 523 | 1040 | 2093 |

|-------|-------|-------|-------|-------|-------|-------|

| C#/Db | 69 | 139 | 277 | 554 | 1103 | 2217 |

|-------|-------|-------|-------|-------|-------|-------|

| D | 73 | 147 | 294 | 587 | 1176 | 2349 |

|-------|-------|-------|-------|-------|-------|-------|

| D#/Eb | 78 | 156 | 311 | 622 | 1241 | 2489 |

|-------|-------|-------|-------|-------|-------|-------|

| E | 82 | 165 | 330 | 659 | 1311 | 2637 |

|-------|-------|-------|-------|-------|-------|-------|

| F | 87 | 175 | 349 | 698 | 1391 | 2794 |

|-------|-------|-------|-------|-------|-------|-------|

| F#/Gb | 93 | 185 | 370 | 740 | 1488 | 2960 |

|-------|-------|-------|-------|-------|-------|-------|

| G | 98 | 196 | 392 | 784 | 1568 | 3136 |

|-------|-------|-------|-------|-------|-------|-------|

| G#/Ab | 104 | 208 | 415 | 831 | 1662 | 3322 |

|-------|-------|-------|-------|-------|-------|-------|

| A | 110 | 220 | 440 | 880 | 1760 | 3520 |

|-------|-------|-------|-------|-------|-------|-------|

| A#/Bb | 117 | 233 | 466 | 932 | 1866 | 3729 |

|-------|-------|-------|-------|------ |-------|-------|

| B | 123 | 248 | 494 | 988 | 1973 | 3951 |

|_______|_______|_______|_______|_______|_______|_______|

Example: The following batch file fragment runs the program

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

4DOS Reference Manual Copyright 1990, J.P. Software

53

BREAK

Syntax: BREAK [on | off]

Purpose: Display, enable, or disable ^C / ^BREAK checking.

Comments: BREAK turns the ^C / ^BREAK checking on or off. If no

argument is given, it displays the current BREAK status.

If BREAK is off, MS-DOS will only check for a ^C during

DOS character I/O (screen, keyboard, serial port, or

printer operations). Many programs don't use these I/O

functions, and it can be difficult to break out of the

program with BREAK off. If BREAK is on, MS-DOS will check

for a ^C or ^BREAK during any MS-DOS operation (including

disk I/O).

BREAK defaults to OFF. You can change the default

BREAK setting by adding the following line to your

CONFIG.SYS file:

break=on

Example: Check the current BREAK status:

c:\> break

BREAK is OFF

Enable ^C checking in all MS-DOS calls:

c:\> break on

4DOS Reference Manual Copyright 1990, J.P. Software

54

CALL

Syntax: CALL [d:][path]filename

Purpose: Call a secondary batch file.

Comments: CALL allows batch files to call other batch files

(batch file nesting) without invoking a secondary copy of

the command processor. 4DOS supports batch file nesting

up to four levels deep. The calling batch file is

suspended while the called batch file runs. When the

called batch file finishes, the calling batch file resumes

execution at the next command. If you execute a batch

file from another batch file without using CALL, the first

batch file is terminated before the second one starts.

The current ECHO state will be inherited by a called

batch file.

See also CANCEL and QUIT.

Example: The following batch file fragment compares an input

line to "wp" and calls a secondary batch file if it

matches:

input Enter your choice: %%option

if "%option" == "wp" call wp.bat

4DOS Reference Manual Copyright 1990, J.P. Software

55

CANCEL

Syntax: CANCEL

Purpose: Terminate batch file processing.

Comments: The CANCEL command will end all batch file processing,

regardless of the batch 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.

See also CALL and QUIT.

Example: The following batch file fragment compares an input

line to "end" and terminates all batch file processing if

it matches:

input Enter your choice: %%option

if "%option" == "end" cancel

4DOS Reference Manual Copyright 1990, J.P. Software

56

CD / CHDIR

Syntax: CD [d:][pathname]

or

CHDIR [d:][pathname]

Purpose: Display or change the current directory.

Comments: Entering CD with no argument or only a disk drive name

will display the current directory. Entering CD and a

pathname will change the current directory.

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.

Use CDD to change both the drive and directory.

To start at the root directory, start the pathname with

a backslash (\). To start at the parent directory, start

the pathname with two periods (..). All other pathnames

start at the current directory.

MS-DOS will not accept directory names longer than 64

characters.

See also CDD.

Example: Change to the subdirectory C:\FINANCE\MYFILES:

c:\> cd \finance\myfiles

c:\finance\myfiles>

Change the default directory on drive A:

c:\> cd a:\utility

4DOS Reference Manual Copyright 1990, J.P. Software

57

CDD

Syntax: CDD [d:]pathname

Purpose: Change the current disk drive and directory.

Comments: CDD is similar to CD, except it also changes the

default disk drive.

To start at the root directory, start the pathname with

a backslash (\). To start at the parent directory, start

the pathname with two periods (..). All other pathnames

start at the current directory.

MS-DOS will not accept directory names longer than 64

characters.

See also CD.

Example: Change from the root directory on drive A to the

subdirectory C:\WP:

a:\> cdd c:\wp

c:\wp>

4DOS Reference Manual Copyright 1990, J.P. Software

58

CHCP

Syntax: CHCP [n]

Purpose: Display or change the current system code page.

Comments: 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 MS-DOS

3.3 or above.

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 two prepared system code pages.

An error message is displayed if a code page is selected

that has not been prepared for the system.

Entering CHCP with no arguments displays the active

code page.

See your MS-DOS manual for more information on CHCP.

Example: Display the current code page:

c:\> chcp

Active code page: 437

Set the code page to multilingual:

c:\> chcp 850

4DOS Reference Manual Copyright 1990, J.P. Software

59

CLS

Syntax: CLS [[bright] [blink] fg ON bg]

Purpose: Clear the video display, optionally to the specified

colors.

Comments: CLS clears the display and moves the cursor to the

upper left corner. fg is the foreground color, bg the

background color. Only the first three characters of the

color name and attributes ("bright" and "blink") are

required.

You must have ANSI.SYS (or another ANSI compatible

screen driver) loaded to set screen colors.

The available colors are:

Black Blue Green Red

Magenta Cyan Yellow White

CLS is normally used in batch files to clear the screen

before displaying text.

See also COLOR.

Example: Clear the display:

c:\> cls

Clear the display to a blue background, and set white

characters as the new default:

c:\> cls white on blue

4DOS Reference Manual Copyright 1990, J.P. Software

60

COLOR

Syntax: COLOR [bright] [blink] fg ON bg

Purpose: Set the screen display colors.

Comments: fg is the foreground color, bg the background color.

Only the first three characters of the color name and

attributes ("bright" and "blink") are required

You must have ANSI.SYS (or another ANSI compatible

screen driver) loaded to set screen colors.

The available colors are:

Black Blue Green Red

Magenta Cyan Yellow White

See also CLS and SCRPUT.

Example: Set the default screen colors to bright white text on a

blue background:

c:\> color bright white on blue

4DOS Reference Manual Copyright 1990, J.P. Software

61

COPY

Syntax: COPY [/MPQRUV] [d:][path]filename[+]...[/AB]

[[d:][path]filename][/AB]

Purpose: Copy or append one or more files.

Comments: Unlike COMMAND.COM, 4DOS allows you to copy several

unrelated files to a target directory with a single COPY

command. If there are two or more arguments on the

command line, COPY assumes the last argument is the

target. If there is only one argument, the target is

assumed to be the current directory.

The plus (+) tells 4DOS to append two or more files to

a single target file. If you don't specify a target, COPY

will append each subsequent file to the first file.

If you specify more than one source file, and the

target is NOT a directory, COPY will automatically append

the files to the target.

The /A(SCII) and /B(inary) options apply to the

preceding filename and to all subsequent filenames on the

command line until another /A or /B is entered. The other

options (/M, /P, /Q, /R, /U, /V) apply to all filenames on

the command line.

If you use the /A option with a source filename, 4DOS

will copy the file up to, but not including, the first ^Z

character in the file. If you use /A with a target

filename, 4DOS will add a ^Z to the end of the file. 4DOS

defaults to /A when appending files, or when the source or

target is a device.

If you use the /B option with a source filename, 4DOS

will copy the entire file. Using /B with a target

filename prevents 4DOS from adding a ^Z to the end of the

target file. 4DOS defaults to /B for normal file copies.

The /M(odified) option copies only those files with the

archive bit set (see ATTRIB). The archive bit will NOT be

cleared after copying.

The /P(rompt) option prompts you to confirm each file

copy (Y or N). An N response will skip that particular

source file.

4DOS Reference Manual Copyright 1990, J.P. Software

62

The /Q(uiet) option turns off the display of the files

copied.

The /R(eplace) option prompts before overwriting an

existing file.

The /U(pdate) option copies only those source files

that are newer than a matching target file, or where a

matching target file doesn't exist.

The /V(erify) option verifies each disk write. This is

the same as executing the VERIFY ON command, but is only

active during the COPY command.

See also MOVE.

Example: Copy the files MEMO1, PROJECT8.WKS, and UPDATE.BAT to

the root directory on drive A:

c:\> copy memo1 project8.wks update.bat a:\

Append the files MEMO1, MEMO2, and MEMO3, and store the

result in BIGMEMO:

c:\> copy memo1+memo2+memo3 bigmemo

Copy only those files in the root directory on drive A

that are newer than the matching files in the current

directory, or which don't exist in the current directory:

c:\> copy /u a:\*.* c:\*.*

Copy files from the root directory on drive A to the

current directory, but prompt before overwriting existing

files:

c:\> copy /r a:\*.*

Copy a downloadable font file to the printer in binary

mode:

c:\> copy myfont.dat prn: /b

4DOS Reference Manual Copyright 1990, J.P. Software

63

CTTY

Syntax: CTTY device

Purpose: Change the default console device.

Comments: At startup, 4DOS uses the keyboard as the standard

input device and the display as the standard output

device. CTTY allows you to change the console (CON:) to

another device that can perform standard character I/O.

CTTY works only for those programs that use the

standard MS-DOS I/O functions (this includes all of the

4DOS internal commands with the exception of DRAWBOX,

DRAWHLINE, DRAWVLINE, LIST, SCREEN, SCRPUT, and SELECT).

Example: Change the console to the first serial port:

c:\> ctty com1:

Change the console back to the standard keyboard and

display:

c:\> ctty con:

4DOS Reference Manual Copyright 1990, J.P. Software

64

DATE

Syntax: DATE [mm-dd-yy]

Purpose: Display and (optionally) change the system date.

Comments: If you don't enter any parameters, DATE will display

the current system date and time, and prompt for the new

date. Press ENTER if you don't wish to change the date,

otherwise enter the new date.

The parameters for the DATE command are:

mm (month) = 1 - 12

dd (day) = 1 - 31

yy (year) = 80 - 199 (1980 - 2099)

You can use hyphens, slashes, or periods to separate

the month, day, and year entries.

The format for the date entry depends on the country

code defined in the CONFIG.SYS file or by the CHCP

command. The default format is U.S. (mm-dd-yy). The

European format is dd-mm-yy; the Japanese is yy-mm-dd.

See also CHCP and TIME.

Example: Enter the date from the command line:

c:\> date 12/25/89

To be prompted for the date:

c:\> date

Mon Dec 25, 1989 9:30:06

Enter new date (mm-dd-yy):

4DOS Reference Manual Copyright 1990, J.P. Software

65

DEL / ERASE

Syntax: DEL [/PQY] [d:][path]filename...

or

ERASE [/PQY] [d:][path]filename...

Purpose: Erase the specified file(s) from the disk.

Comments: If the /P(rompt) option is specified, 4DOS will prompt

you to enter a Y or N to confirm file deletions for all

filenames.

The /Q(uiet) option turns off the display of the files

deleted.

The /Y(es) option is the reverse of /P - it assumes a Y

response to everything, including deleting an entire

subdirectory (*.*). Use this option with caution!

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(es)

option. If you respond with a Y, DEL will delete all the

files in that subdirectory (except hidden, system, and

read-only files).

Example: Erase all the files in the current directory with a

.BAK or .PRN extension:

c:\> del *.bak *.prn

Confirm the deletion of all files in the current

directory with .WKS extensions:

c:\> del /P *.wks

Delete JAN89.WKS (Y/N)? n

Delete FEB88.WKS (Y/N)? y

Delete DEC88.WKS (Y/N)? y

4DOS Reference Manual Copyright 1990, J.P. Software

66

DELAY

Syntax: DELAY [seconds]

Purpose: Pause for a specified length of time.

Comments: DELAY is useful in batch file loops while waiting for a

condition to occur. The default value is one second.

You can cancel a DELAY loop by pressing ^C.

Example: Wait for 10 seconds:

delay 10

4DOS Reference Manual Copyright 1990, J.P. Software

67

DESCRIBE

Syntax: DESCRIBE [d:][path]filename ["description"] ...

Purpose: Create, modify, or delete file and subdirectory

descriptions.

Comments: DESCRIBE adds descriptions (up to 40 characters) to MS-

DOS filenames and subdirectories. The descriptions will

be displayed when using DIR with the default single column

option, or when using SELECT.

File descriptions allow you to identify your files in

much more meaningful ways than MS-DOS allows in an eight

character filename.

You can enter a description on the command line by

entering the filename followed by the description enclosed

in quotes. Using wildcards (* and ?) and/or multiple

filenames with a description on the command line will give

all matching files the same description.

Descriptions are stored in each directory in a hidden

file called DESCRIPT.ION. Use the ATTRIB command to

"unhide" this file if you need to copy or delete it.

The description file is modified appropriately whenever

you perform an internal command (such as COPY, MOVE, DEL,

or RENAME), but not if you use an external program (such

as XCOPY or a shell program).

Example: Create a description for the file MEMO.TXT:

c:\> describe memo.txt

Describe "memo.txt" : Memo to Bob about party

Enter the same description from the command line:

c:\> describe memo.txt "Memo to Bob about party"

4DOS Reference Manual Copyright 1990, J.P. Software

68

DIR

Syntax: DIR [/124ACDFHJNOeirtuzPQSVWX] [[d:][path]filename[+]...]

Purpose: Display information about files and subdirectories.

Comments: DIR displays information about the files and

subdirectories in the specified directory. Depending upon

the options specified, DIR can show the filename, file

attributes, size, date and time of the most recent change

to the file, and the file description.

DIR allows wildcard characters (* and ?) in the

filename. If you don't specify a filename, DIR defaults

to *.* (display all files and subdirectories in the

current directory).

If you append filenames with a +, 4DOS will display the

matching filenames in a single directory listing.

If a country code was defined in the CONFIG.SYS file or

by the CHCP command, DIR will display the date in the

format for that country. The default date format is U.S.

(mm-dd-yy).

DIR can handle directories of any size, limited only by

the available memory. Each filename requires 32 bytes of

DOS memory plus the size of the description (if any); a

system with 128K of free DOS memory can display up to

4,000 files per directory.

Options on the command line apply only to the filenames

which follow the option, except that options at the end of

the line apply to the preceding filename only. This

allows you to specify several options for a group of

files, and retains compatibility with COMMAND.COM when a

single filename is specified.

The DIR options are:

1 Single column display - display the filename, size,

date, time, and description. This is the default.

2 Two column display - display the filename, size,

date, and time.

4 Four column display - display the filename and size

(in K(ilobytes) or M(egabytes).

4DOS Reference Manual Copyright 1990, J.P. Software

69

A Display filenames and attributes (see ATTRIB), in

the format RHSA, where:

R Read-only

H Hidden

S System

A Archive

When displaying attributes, DIR cannot also

display file descriptions.

C Display filenames in upper case (like COMMAND.COM).

See also SETDOS /U.

D Display contents of the current directory and all of

its subdirectories. DIR will only display headers

and summaries for those directories with matching

filenames.

F Display files only (no subdirectories).

H Display all files, including hidden and system

files.

J Justify filenames (same format as COMMAND.COM).

N Reset DIR options to the default values (useful when

displaying some files in one format, and then

changing back to the default format).

O? Sort sequence, where ? can be any combination of the

following options:

e Sort by extension

i Sort by the file description (see

DESCRIBE)

r Reverse the normal sort order

t Sort by time (oldest first)

u Unsorted (same as COMMAND.COM)

z Sort by size

The default sort is by filename.

P Pause after each screen page and wait for a key to

be pressed (useful for displaying long directory

listings).

Q Suppress header line and summaries, and display file

or subdirectory names only, in a single column

(useful when redirecting output to a file or

another program).

S Display summary only (number of files & bytes used).

V Display filenames sorted vertically rather than

horizontally (with the /2, /4, or /W option).

W Wide display - display the filenames only,

horizontally across the screen (5 columns on an

80-character display).

X Display subdirectories only.

See also DESCRIBE and SELECT.

4DOS Reference Manual Copyright 1990, J.P. Software

70

Example: Display the .WKS files, and then the .WK1 files in the

current directory:

c:\> dir *.wks *.wk1

Display the .WKS and .WK1 files together:

c:\> dir *.wks+*.wk1

Display all the files on drive C, including hidden and

system files, pausing after each page:

c:\> dir /dhp c:\*.*

4DOS Reference Manual Copyright 1990, J.P. Software

71

DIRS

Syntax: DIRS

Purpose: Display the current directory stack.

Comments: DIRS displays the directory stack used by PUSHD and

POPD (most recent entries first). The directory stack

holds up to 255 characters (about 10 to 20 entries).

See also PUSHD and POPD.

Example: Change directories and then display the directory

stack:

c:\> pushd c:\database

c:\database> pushd d:\wordp\memos

d:\wordp\memos> dirs

c:\database

c:\

4DOS Reference Manual Copyright 1990, J.P. Software

72

DRAWBOX

Syntax: DRAWBOX ulrow ulcol lrrow lrcol style [bright] [blink] fg

ON bg [FILL bgfill]

Purpose: Draw a box on the screen.

Comments: DRAWBOX is useful for creating attractive screen

displays in batch files. DRAWBOX 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).

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.

The parameters are:

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

1 - single line

2 - double line

3 - single line on top and bottom,

double on sides

4 - double line on top and bottom,

single on sides

fg Foreground character color

bg Background character color

bgfill Background fill color (for the inside of the

box)

Only the first three characters of the color name and

attributes ("bright" and "blink") are required. The

available colors are:

Black Blue Green Red

Magenta Cyan Yellow White

See also DRAWHLINE and DRAWVLINE.

Example: Draw a single line box around the entire screen with

bright white lines on a blue background:

drawbox 0 0 24 79 1 bright white on blue fill blue

4DOS Reference Manual Copyright 1990, J.P. Software

73

DRAWHLINE

Syntax: DRAWHLINE row column len style [bright] [blink] fg ON bg

Purpose: Draw a horizontal line on the screen.

Comments: DRAWHLINE is useful for creating attractive screen

displays in batch files. DRAWHLINE 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).

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.

The parameters are:

row Start row

column Start column

len Length of line

style Line drawing style:

1 - single line

2 - double line

fg Foreground character color

bg Background character color

Only the first three characters of the color name and

attributes ("bright" and "blink") are required. The

available colors are:

Black Blue Green Red

Magenta Cyan Yellow White

See also DRAWBOX and DRAWVLINE.

Example: Draw a double line along the top row of the display

with green characters on a blue background:

drawhline 0 0 79 2 green on blue

4DOS Reference Manual Copyright 1990, J.P. Software

74

DRAWVLINE

Syntax: DRAWVLINE row column len style [bright][blink] fg ON bg

Purpose: Draw a vertical line on the screen.

Comments: DRAWVLINE is useful for creating attractive screen

displays in batch files. DRAWVLINE 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).

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.

The parameters are:

row Start row

column Start column

len Length of line

style Line drawing style:

1 - single line

2 - double line

fg Foreground character color

bg Background character color

Only the first three characters of the color name and

attributes ("bright" and "blink") are required. The

available colors are:

Black Blue Green Red

Magenta Cyan Yellow White

See also DRAWBOX and DRAWHLINE.

Example: Draw a double width line along the left margin of the

display with bright red characters on a black background:

drawvline 0 0 24 2 bright red on black

4DOS Reference Manual Copyright 1990, J.P. Software

75

ECHO

Syntax: ECHO [on | off | message]

Purpose: Display the echo status, enable or disable batch file

or command line echoing, or display a message.

Comments: 4DOS defaults to ECHO ON in batch files. To prevent a

line from being echoed, preface it with the @ symbol. You

can default to ECHO OFF by setting the variable VERBOSE to

0 (see SETDOS). The current ECHO state is inherited by

called batch files.

4DOS defaults to ECHO OFF during keyboard input. If

you set ECHO ON from the command line, 4DOS will display

the fully parsed and expanded commands (including aliases

and variables) before they are executed. The keyboard

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.

If no arguments are entered, ECHO displays the current

echo status (ON or OFF).

ECHO commands in a batch file will send messages to the

screen while the batch file executes, even if ECHO is set

OFF. You cannot use the command separator character or

the 4DOS redirection symbols (| > <) in an ECHO message,

unless you enclose them in quotes or precede them with the

escape character.

See also SCREEN, SCRPUT, SETDOS and TEXT.

Example: Enable command line echoing:

c:\> echo on

Display a message in a batch file:

echo Processing your print files...

Turn off batch file echoing, without displaying ECHO

itself:

@echo off

4DOS Reference Manual Copyright 1990, J.P. Software

76

ENDLOCAL

Syntax: ENDLOCAL

Purpose: Restore the saved disk drive, directory, environment

variables and aliases.

Comment: ENDLOCAL restores the disk drive, directory,

environment variables and aliases saved by the previous

SETLOCAL command. SETLOCAL and ENDLOCAL can only be used

in batch files, not in aliases.

See also SETLOCAL.

Example: This batch file fragment saves the drive, current

working directory, environment variables and aliases,

changes the drive and directory, modifies some environment

variables, runs the program TEST1, and then restores the

original values:

setlocal

cdd d:\test

set path=c:\;c:\dos;c:\util

set lib=d:\lib

test1

endlocal

4DOS Reference Manual Copyright 1990, J.P. Software

77

ESET

Syntax: ESET varname...

Purpose: Edit environment variables and/or aliases.

Comments: ESET allows you to edit your environment variables and

aliases using the 4DOS line editing commands (see Command

Line Editing in Using 4DOS). The cursor will be

positioned at the first character of the variable or

alias.

ESET will search for environment variables first, and

then aliases. If you have an environment variable and an

alias with the same name (a bad idea!), ESET will only be

able to edit the environment variable.

4DOS limits environment variable and alias names to 80

characters, and their arguments to 255 characters.

See also ALIAS, UNALIAS, SET, and UNSET.

Example: Edit the MS-DOS executable file search path:

c:\> eset path

path=c:\;c:\dos;c:\util

Create and then edit an alias:

c:\> alias d dir /djp

c:\> eset d

d=dir /djp

4DOS Reference Manual Copyright 1990, J.P. Software

78

EXCEPT

Syntax: EXCEPT ([d:][path]filename...) command [args...]

Purpose: Perform a command, except on the file(s) specified.

Comments: EXCEPT provides a means of executing a command on a

group of files and/or subdirectories, except those

enclosed within the parentheses.

The command can be a 4DOS internal command or alias, an

external command, or a batch file.

You may use the wildcard characters (? and *) in a

filename.

When using filename completion (see Command Line

Editing in Using 4DOS) to get the filenames inside the

parentheses, type a space after the open parenthesis

before entering a partial filename or pressing F9.

Otherwise the command line editor will treat the open

parenthesis as the first character of the filename to be

completed.

EXCEPT prevents operations on the specified file(s) by

setting the hidden attribute, performing the command, and

then clearing the hidden attribute. If EXCEPT is aborted

in an unusual way, you may need to use the ATTRIB command

to "unhide" (-H) the file(s).

EXCEPT will not work with programs or commands that

ignore the hidden attribute.

See also ATTRIB.

Example: Erase all the files in the current directory, except

those beginning with MEMO and those ending in .WKS:

c:\> except (memo*.* *.wks) erase *.*

Copy all the files and subdirectories except those in

C:\MSC and C:\DOS on drive C to drive D:

c:\> except (c:\msc c:\dos) xcopy c:\*.* d:\ /s

4DOS Reference Manual Copyright 1990, J.P. Software

79

EXIT

Syntax: EXIT

Purpose: Return from a secondary command processor.

Comments: Some application programs will start a secondary copy

of the command processor to allow you to execute MS-DOS

commands. To return to the application again, type EXIT.

You cannot EXIT from the primary command processor.

Example: Return to the previous command processor or

application:

c:\> exit

4DOS Reference Manual Copyright 1990, J.P. Software

80

FOR

Syntax: FOR %var IN (set) [DO] command ...

Purpose: Repeat a command for several variables.

Comments: 4DOS sets var sequentially to each member of (set), and

then evaluates and executes command for every argument in

(set). If one of the arguments in (set) contains MS-DOS

wildcard characters (* and ?), var will be set

sequentially to each matching filename on the disk.

The command can be a 4DOS internal command or alias, an

external command, or a batch file.

In COMMAND.COM, you must use a single % for the

variable name from the command line, and %% when in a

batch file. 4DOS will accept either % or %% in either

case.

COMMAND.COM requires the variable name to be a single

character; 4DOS supports variable names up to 80

characters.

COMMAND.COM requires the word "DO" on the command line;

it is optional in 4DOS.

Note that 4DOS supports nested FOR statements;

COMMAND.COM does not.

Example: The following example compiles the C programs in the

current directory that have a 2 or a 3 somewhere in their

name:

c:\msc> for %a in ( *2*.c *3*.c ) do cl %a ;

The following example uses variable functions to delete

the .BAK files for which a corresponding .TXT file exists

in the current directory (this should be entered on one

line):

c:\docs> for %file in (*.txt) if exist

%@name[%file].bak del %@name[%file].bak

4DOS Reference Manual Copyright 1990, J.P. Software

81

FREE

Syntax: FREE [d:]...

Purpose: Display the total disk space, total bytes used, and

total bytes free on the specified (or default) drive(s).

Comments: FREE provides the same disk information as the external

MS-DOS command CHKDSK, but without the wait.

See also MEMORY.

Example: Display the status of the current drive:

c:\> free

Volume in drive C: is DEVELOPMENT

42,496,000 bytes total disk space

36,851,712 bytes used

5,644,288 bytes free

Display the status of drives A and C:

c:\> free a: c:

Volume in drive A: is unlabeled

1,213,952 bytes total disk space

1,115,136 bytes used

98,816 bytes free

Volume in drive C: is DEVELOPMENT

42,496,000 bytes total disk space

36,851,712 bytes used

5,644,288 bytes free

4DOS Reference Manual Copyright 1990, J.P. Software

82

GLOBAL

Syntax: GLOBAL [/IQ] command [args]

Purpose: Execute a command in the current directory and its

subdirectories.

Comments: GLOBAL performs the command first in the current

directory, and then in every subdirectory under the

current directory.

The command can be a 4DOS internal command or alias, an

external command, or a batch file.

GLOBAL will terminate if the command returns a non-zero

exit code, unless you specify the /I(gnore result) switch.

GLOBAL will display the current directory unless you specify

the /Q(uiet) switch.

Example: Erase all the files with a .BAK extension in every

directory on C:

c:\> global erase *.bak

Copy the files in every directory on drive A to the

directory C:\TEMP :

a:\> global copy *.* c:\temp

4DOS Reference Manual Copyright 1990, J.P. Software

83

GOSUB

Syntax: GOSUB label

Purpose: Call a subroutine in a batch file.

Comments: GOSUB calls the specified label as a subroutine. The

subroutine must end with a RETURN statement. After the

RETURN, 4DOS will continue processing with the command

following the GOSUB command.

If the label doesn't exist, the batch file is

terminated with the error message "Label not found."

The label must begin with a colon (:), and appear by

itself on the line. 4DOS ignores case differences when

matching labels.

See also GOTO and RETURN.

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

return

4DOS Reference Manual Copyright 1990, J.P. Software

84

GOTO

Syntax: GOTO label

Purpose: Continue batch file processing at the line following

the label.

Comments: GOTO changes the current position in the batch file to

the line immediately following the label. If the label

doesn't exist, the batch file is terminated with the error

message "Label not found."

The label must begin with a colon (:), and appear by

itself on the line. 4DOS ignores case differences when

matching labels.

To avoid errors in the processing of nested IFF statements,

GOTO cancels all active IFF statements. This means that to

avoid errors GOTOs inside IFF statements must branch

entirely outside all IFF blocks which are active at the time

of the GOTO.

See also GOSUB.

Example: The following batch file fragment checks for the

existence of the file CONFIG.SYS. If the file exists,

4DOS jumps to C_EXISTS and copies all the files from the

current directory to the root directory on A. If

CONFIG.SYS doesn't exist, 4DOS 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:\

4DOS Reference Manual Copyright 1990, J.P. Software

85

HELP

Syntax: HELP [/BW] [/R] [topic]

Purpose: Provide help for 4DOS and MS-DOS commands.

Comments: The HELP command displays the proper syntax and a brief

description of 4DOS and MS-DOS commands. You can also

call HELP by pressing F1 at the 4DOS prompt.

If you enter HELP with no topic, HELP will display all

the commands it can help you with. Select a topic using

the cursor keys and press ENTER. For help on a specific

command, enter HELP followed by the command name.

The /BW switch forces HELP to monochrome mode on color

systems. The /R switch turns off dynamic window resizing

and forces all HELP screens to full screen size regardless

of the amount of text they contain. HELP switches may be

set permanently by setting the values in the 4HELPC

environment variable (e.g. SET 4HELPC=/BW).

Detailed information on how to use the HELP system is

provided with HELP itself. Once you have started HELP,

follow the instructions on the screen regarding the

effects of various keys.

HELP.EXE and DOS.HLP must be in the current directory or

one of the directories specified in the PATH environment

variable. If you change the name of HELP.EXE or keep the

help files in a directory which is not on your PATH, you

must store the full path and filename for the help program

in the 4HELP environment variable. To specify a text file

name other than DOS.HLP, store the full path and filename for

the help text file in the 4HELPF environment variable.

The HELPCFG program included with 4DOS allows you to

customize HELP's colors to suit your own preferences.

If you want to customize the help text (for example, to

add HELP for your own commands or aliases), you will need

the 4DOS Utility Disk (available from J.P. Software) which

contains the source text and hypertext compiler.

HELP is an external command.

Example: Display and select from all the available help topics:

c:\> help

For help on COPY:

c:\> help copy

4DOS Reference Manual Copyright 1990, J.P. Software

86

HISTORY

Syntax: HISTORY [/F] [/R [d:][path]filename]

Purpose: Display, clear, or read the history list.

Comments: If no parameters are entered, HISTORY will display the

current history list.

The /F(ree) option clears the command history list.

The /R(ead) option loads the command history from the

specified file. You can save the history list by

redirecting its output to 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 512 to 8192

characters (see Installation). The default size is 1024

characters.

You can disable saving commands to the history list, or

specify a minimum command line length to save, with the

SETDOS /H command.

See also SETDOS.

Example: Display the history list:

c:\> history

Clear the history entries:

c:\> history /f

Save the history list to the file HISTFILE, and then

read it in again:

c:\> history > histfile

c:\> history /r histfile

4DOS Reference Manual Copyright 1990, J.P. Software

87

IF

Syntax: IF [NOT] condition command

Purpose: Allow conditional execution of commands.

Comments: 4DOS first tests the given condition. If the condition

is true, 4DOS executes the specified command, otherwise

the command will be ignored. If you use the NOT option,

the command is executed only when the condition is false.

IF statements can be nested.

The command can be a 4DOS internal command or alias, an

external command, or a batch file.

For the string tests, case differences are ignored. When

comparing strings, you should enclose the strings in double

quotes (see examples). If both arguments to be compared

begin with digits, IF will do a numeric comparison; otherwise

IF does an ASCII comparison.

The condition can be any of the following:

string1 == string2

string1 EQ string2

If string1 is equal to string2, the condition is

true.

string1 NE string2

If string1 is not equal to string2, the condition

is true.

string1 LT string2

If string1 is < string2, the condition is true.

string1 LE string2

If string1 is <= string2, the condition is true.

string1 GE string2

If string1 is >= string2, the condition is true.

string1 GT string2

If string1 is > string2, the condition is true.

In the tests below, the term "condition" refers to one of

the relational operators described above (==, NE, LT, etc.).

4DOS Reference Manual Copyright 1990, J.P. Software

88

ATTRIB [d:][path]filename [RHSVDA]

If the file has matching attributes, the condition

is true. See also ATTRIB and DIR. The attributes

are :

R Read-only

H Hidden

S System

V Volume

D Directory

A Archive

N No attributes set

For the volume name test the filename used must

refer to the root directory. Volume names longer

than 8 characters require a period after the eigth

character (e.g. IF ATTRIB A:\MYFILES0.107 V ...).

DISKFREE condition n[K | M]

Test for the free disk space on the current drive.

DOSMEM condition n[K]

Test for the free DOS memory.

EMS condition n[K | M]

Test for the amount of free expanded memory.

EXTENDED condition n[K | M]

Test for the amount of extended memory (non-XMS).

ERRORLEVEL [condition] n

Test the exit code of the preceding external

program. ERRORLEVEL supports the same conditions

as the string comparisons (for example, ==, LE,

etc.). If no condition is specified, the default

is GE. NOTE: Not all programs return an explicit

exit code. In those cases, the behavior of

ERRORLEVEL is undefined.

EXIST [d:][path]filename

If the file exists, the condition is true. You

can use wildcard characters (* and ?) in the

filename, in which case the condition is true if

any file matching the wildcards exists.

FILESIZE filename condition n[K | M]

Test for the size of the specified file.

ISALIAS aliasname

If the specified name is an alias, the condition

is true.

4DOS Reference Manual Copyright 1990, J.P. Software

89

ISDIR [d:]path

If the subdirectory exists, the condition is true.

MONITOR condition [MONO | COLOR]

Test for the monitor type (condition should be ==,

EQ, or NE).

VIDEO condition [MONO | CGA | EGA | VGA]

Test for the video card type (condition should be

==, EQ, or NE).

XMS condition n[K | M]

Test for the amount of available XMS 2.0 extended

memory.

The DOSFREE, EMS, EXTENDED, and XMS tests allow testing

either by bytes (default), kilobytes (by appending a K to

the test value), or megabytes (by appending an M).

See also IFF.

Example: Test for the presence of A:\JAN.DOC, and copy it to the

root directory on drive C if it exists:

c:\> if exist a:\jan.doc copy a:\jan.doc c:\

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

Test for more than 500K of free DOS memory:

c:\> if dosfree gt 500K echo More than 500K free

Test for expanded memory greater than 2 Mb:

c:\> if ems gt 2M echo More than 2 Mb EMS available

Run a program ("MONOPROG") if the monitor type is

monochrome:

c:\> if monitor mono monoprog

This batch file fragment tests to see if the disk in

drive A is labeled "INSTALL1":

if attrib a:\install1 V goto INSTALL1

4DOS Reference Manual Copyright 1990, J.P. Software

90

IFF

Syntax: IFF [NOT] condition THEN ^ ... ^ ELSE[[IFF] ... THEN] ^

... ^ ENDIFF

Purpose: Allow IF/THEN/ELSE conditional execution of commands.

Comments: 4DOS first tests the given condition. If the condition

is true, 4DOS executes the specified command(s) until the

next ELSE, ELSEIFF, or ENDIFF, otherwise the command(s)

will be ignored and 4DOS will continue parsing at the next

ELSE, ELSEIFF, or ENDIFF. If you use the NOT option,

commands are executed only when the condition is false.

IFF statements can be nested up to 15 levels deep.

The command can be a 4DOS internal command or alias, an

external command, or a batch file.

See the IF command for a list of the tests available.

Example: The following batch file fragment tests the monitor

type (monochrome or color), and sets the appropriate

colors and prompt (the PROMPT commands should be entered

on one line):

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 following alias 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 zap `iff isdir %1 then ^ del %1 ^ rd %1 ^

else ^ echo Not a directory! ^ endiff`

4DOS Reference Manual Copyright 1990, J.P. Software

91

INKEY

Syntax: INKEY [/Wn] [text] %%varname

Purpose: Get a single keystroke environment variable from

standard input.

Comments: You can optionally display prompt text before the

variable name.

The /W(ait) option allows you to specify a timeout

period, where n is the number of seconds to wait for a

response. If no keystroke is entered by the end of the

timeout period, INKEY returns with the variable unchanged.

You can specify /W0 to check if a key is already in the

buffer, and return immediately.

ASCII values from 1 to 255 are stored as a character.

Extended characters (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). This is the

same format used by the KEYSTACK command. See Appendix C

for a list of the extended key codes.

INKEY and INPUT are normally used in batch files,

allowing you great flexibility in entering or changing

batch variables.

If you press ^C or ^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

prompted whether to cancel the batch job (see Batch Files

in Using 4DOS).

See also INPUT.

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

The following batch file fragment waits up to 10

seconds for a character, then tests to see if a "Y" was

entered (the INKEY command should be entered on one line):

set net=N

inkey /w10 Do you want to load the network (Y/N)?

%%net

if "%net" == "Y" goto load_net

4DOS Reference Manual Copyright 1990, J.P. Software

92

INPUT

Syntax: INPUT [/Wn] [text] %%varname

Purpose: Enter an environment variable from the standard input.

Comments: You can optionally display prompt text before the

variable name.

The /W(ait) option allows you to specify a timeout

period, where n is the number of seconds to wait for a

response. If no keystroke is entered by the end of the

timeout period, INPUT returns with the variable unchanged.

If you enter a key before the timeout period, INPUT will

wait indefinitely for the remainder of the line. You can

specify /W0 to check if a key is already in the buffer,

and return immediately.

All characters entered up to, but not including, the

carriage return are stored in the variable.

INPUT and INKEY are normally used in batch files,

allowing you great flexibility in entering or changing

batch variables.

See also INKEY.

Example: The following batch file fragment prompts for a string

and stores it in the variable FNAME:

input Enter the file name: %%fname

4DOS Reference Manual Copyright 1990, J.P. Software

93

KEYSTACK

Syntax: KEYSTACK ["abc"] [nn] [@nn] [!]

Purpose: Feed keystrokes to a program from a batch file or

alias.

Comments: Characters entered within double quotes ("abc") will be

stored "as is" in the keyboard buffer. Numbers (nn) not

enclosed in quotes are ASCII decimal codes (e.g., 13

(ENTER), or 27 (ESCAPE)). The number 0 is a special case;

it is used with programs that flush the keyboard buffer

(it tells the program the buffer is clear, so subsequent

keystrokes will be accepted normally). Numbers preceded

by @ are extended keyboard codes generated by the Alt key,

cursor pad keys, and the Function keys (e.g., @59 is the

F1 function key). See Appendix C for a list of the

extended key codes. A ! will clear all pending keystrokes,

both in the KEYSTACK buffer and in the keyboard buffer.

Some programs require both the keyboard "scan code" and the

ASCII code to be stacked. To stack both codes calculate the

value ((256 * scan) + ASCII) and use that for KEYSTACK.

For

example for ENTER the scan code is 28 and the ASCII code is

13, so to stack both values use KEYSTACK 7181 (7181 is 256

*

28 + 13). Scan code tables are available in many PC

reference books.

You can store a maximum of 255 characters.

Each time KEYSTACK is executed, it will clear any

remaining keystrokes stored by a previous KEYSTACK.

You may need to experiment a bit with your programs to

find the proper sequence of keystrokes. Programs that

bypass MS-DOS and the BIOS for keyboard input cannot read

keystrokes entered with KEYSTACK.

KEYSTACK requires the device driver KEYSTACK.SYS be

loaded in the CONFIG.SYS file (see Installation).

Example: The following batch file starts Lotus 1-2-3 and loads

the file specified on the command line:

pushd c:\123

keystack 0 13 0 13 0 13 0 13 0 13 "/FR" 0 "%1" 13

123

popd

The same command defined as an alias (enter this on one

line):

alias 321 `pushd c:\123 ^ keystack 0 13 0 13 0 13 0

13 0 13 "/FR" 0 "%1" 13 ^ 123 ^ popd`

4DOS Reference Manual Copyright 1990, J.P. Software

94

LIST

Syntax: LIST [/HSW] [d:][path]filename...

Purpose: Display a file with forward and backward paging and

scrolling.

Comments: LIST provides a much faster and more flexible way to view a

file than TYPE, without the overhead of using a text editor.

The /H option strips 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.

The /S option will read from the standard input rather than

a file. This allows you to redirect command output and view

it with LIST.

The /W option will wrap the text at the right margin. This

option is useful when displaying non-text files.

LIST uses the cursor pad to scroll through the file. The

following keys have special meanings (the caret ^ means

press the Control key together with with the specified key):

Home Display the first page of the file.

End Display the last page of the file.

Esc Exit the current file.

^C Quit LIST.

Up Arrow Scroll up one line.

Down Arrow Scroll down one line.

Left Arrow Scroll left 8 columns.

Right Arrow Scroll right 8 columns.

^Left Arrow Scroll left 40 columns.

^Right Arrow Scroll right 40 columns.

F1 Call the on-line help (HELP.EXE).

F Prompt and search for a string (case is

ignored).

N Find next matching string (case is

ignored). LIST saves the search

string, so you can LIST multiple files

and search for the same string simply

by pressing N in each file.

P Print the file on LPT1.

LIST is normally only useful for displaying ASCII text

files; executable files (.COM and .EXE) and many data

files will be unreadable due to the presence of non-

alphanumeric characters.

See also TYPE.

4DOS Reference Manual Copyright 1990, J.P. Software

95

Example: Display the file MEMO.DOC:

c:\> list memo.doc

Display the output from a DIR command:

c:\> dir | list /s

Redefine the DIR command to always display its output

via LIST:

c:\> alias dir `*dir %& | list /s`

4DOS Reference Manual Copyright 1990, J.P. Software

96

LOG

Syntax: LOG [/W [d:][path]filename | ON | OFF | text]

Purpose: Save a log of commands to a disk file.

Comments: LOG defaults to saving to the file 4DOSLOG in the root

directory of the boot drive.

Entering LOG with no parameters displays the log status

(ON or OFF). Entering LOG with text writes the text to

the log file, even if LOG is set OFF. This allows you to

enter headers in the log file.

You can specify a different filename with the /W(rite)

switch. The /W switch automatically enables command

logging.

The commands are stored in the log file as they were

entered, before performing any alias or variable

expansion.

The LOG file format looks like:

[mm/dd/yy hh:mm:ss] command

Example: Display the LOG status:

c:\> log

LOG is OFF

Enable command logging:

c:\> log on

Enable command logging to the file C:\LOG\LOGFILE and

insert a header:

c:\> log /w c:\log\logfile

c:\> log "Started work on the database system"

4DOS Reference Manual Copyright 1990, J.P. Software

97

MD / MKDIR

Syntax: MD [d:]pathname...

or

MKDIR [d:]pathname...

Purpose: Create subdirectories.

Comments: To start at the root directory, start the pathname with

a backslash (\). To start at the parent directory, start

the pathname with two periods (..). All other pathnames

start at the current directory.

The longest allowable path in MS-DOS from the root

directory to any subdirectory is 64 characters (including

backslashes).

See also RD.

Example: Create a subdirectory called MYDIR in the root

directory:

c:\> md \mydir

Create a subdirectory called DIRTWO in the current

directory:

c:\mydir> md dirtwo

4DOS Reference Manual Copyright 1990, J.P. Software

98

MEMORY

Syntax: MEMORY

Purpose: Display the system RAM status.

Comments: MEMORY displays the total RAM, the free RAM (available

to applications programs after loading MS-DOS, device

drivers, 4DOS itself, and RAM resident programs); the

total and free expanded memory, extended memory and XMS

memory (on an 80286 or 80386); the total and free

environment space; the total and free alias list space;

and the total command history space.

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.

Example: Display your RAM totals:

c:\> memory

655,360 bytes total RAM

534,464 bytes free

1,687,552 bytes total EMS memory

1,097,728 bytes free

914,432 bytes total XMS memory

512 bytes total environment

195 bytes free

1,024 bytes total alias

452 bytes free

1,024 bytes total history

4DOS Reference Manual Copyright 1990, J.P. Software

99

MOVE

Syntax: MOVE [/PQR] [d:][path]filename... [d:][path]filename

Purpose: Move files to other directories and drives.

Comments: The MOVE command moves the specified file(s) to the last

filename specified, which is designated as the target. If

the target already exists, it is deleted when the file is

moved. You cannot move a file to a character device or to

itself.

If there is more than one source file specification,

the target must be a directory, and the files are moved to

the directory with their original filenames. If the

target is not a directory, MOVE will display an error

message and exit.

Use caution when using MOVE with commands like SELECT.

If multiple files are SELECTed and the target is not a

subdirectory, each file will be moved in turn to the

target, overwriting the previous file. The net result is

that all files but the last will be deleted. If SELECT is

invoked using square brackets instead of parentheses, the

MOVE will be done in a single command and MOVE will detect

the error.

The /P(rompt) option will prompt you for a Y or N

response to confirm each move.

The /Q(uiet) option turns off the display of the files moved.

The /R(eplace) option will prompt you for a Y or N

response before overwriting an existing file.

MOVE first attempts to rename the file(s). If that

fails (the target is on a different drive, or the target

already exists), MOVE will copy the file(s) and then

delete the originals. If MOVE cannot delete the original

(for example, a read-only file), it will display an error

message, but the target file is still created.

See also COPY and RENAME.

4DOS Reference Manual Copyright 1990, J.P. Software

100

Example: Move some files to a different directory:

c:\> move *.wks *.txt c:\finance\myfiles

Move all the files in the current directory to A:\,

prompting before overwriting any existing files:

c:\> move /r *.* a:\

4DOS Reference Manual Copyright 1990, J.P. Software

101

PATH

Syntax: PATH [[d:]path;[d:]path...]]

Purpose: Tells 4DOS where to search for executable and batch

files not in the current directory.

Comments: When searching for an external command (.COM, .EXE,

.BTM, and .BAT), 4DOS searches the current directory

first, then the directories you specify in the order you

list them. The directory names are separated by

semicolons (;). Like COMMAND.COM, 4DOS shifts the entire

path to upper case before storing it in the environment.

This maintains compatibility with programs which can only

recognize an upper case path.

If you enter PATH with no parameters, 4DOS displays the

current search path. If you enter PATH and a semicolon,

4DOS clears the search path and will search only the

current directory (this is the default at system startup).

If you specify an invalid directory, 4DOS will skip

that directory and continue searching with the next

directory in the path.

Some applications use the PATH variable to search for

their files.

You can edit the path with the ESET command.

Example: The following PATH command directs 4DOS to search for

an executable file in the following order: the current

directory, the root directory on C, the DOS subdirectory

on C, and the UTIL subdirectory on C:

c:\> path c:\;c:\dos;c:\util

Display the current search path:

c:\> path

PATH=C:\;C:\DOS;C:\UTIL

4DOS Reference Manual Copyright 1990, J.P. Software

102

PAUSE

Syntax: PAUSE [message]

Purpose: Suspend alias or batch file execution.

Comments: A PAUSE command will suspend execution, giving you the

opportunity to perform activities such as changing disks,

turning on the printer, etc.

PAUSE flushes the keyboard buffer, and then waits for

any key (except ^C or ^BREAK) to be pressed and then

continues executing. If a prompt message is specified,

4DOS will display the message and wait for a keystroke.

Otherwise, 4DOS will prompt:

Press a key when ready...

If you press ^C or ^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

prompted whether to cancel the batch job (see Batch Files

in Using 4DOS).

Example: The following batch file fragment prompts the user

before erasing files:

pause ^C aborts, any other key erases the .LST files

erase *.lst

4DOS Reference Manual Copyright 1990, J.P. Software

103

POPD

Syntax: POPD [*]

Purpose: Change to the disk drive and directory at the top of

the directory stack.

Comments: POPD restores the disk drive and directory saved using

PUSHD (most recent first).

The * option clears the directory stack, without

changing the current drive and directory.

Use the DIRS command to display the directory stack.

See also DIRS and PUSHD.

Example: Save and change your disk drive and directory with

PUSHD, and then restore it:

c:\> pushd d:\database\test

d:\database\test> pushd c:\wordp\memos

c:\wordp\memos> pushd a:\123

a:\123> popd

c:\wordp\memos> popd

d:\database\test> popd

c:\>

Clear the directory stack:

c:\> popd *

4DOS Reference Manual Copyright 1990, J.P. Software

104

PROMPT

Syntax: PROMPT [text]

Purpose: Change the 4DOS command line prompt.

Comments: If you enter PROMPT with no arguments, 4DOS sets the

prompt on drives A and B to $n$g, and on all other drives

to $p$g (display current disk and directory).

The prompt text can contain special strings of the form

$?, where ? is one of the following characters.

b The | character

c The open parenthesis (

d Current date, in the format Sun Jan 1, 1989

e The ASCII ESC character (decimal 27)

f The close parenthesis )

g The > character

h BACKSPACE over the previous character

l The < character

n Default drive letter

P Current disk and directory (upper case)

p Current disk and directory (lower case)

q The = character

s The space character

t Current time, in the format hh:mm:ss

v MS-DOS version number, in the format 3.10

Xd: Current disk and directory (upper case) where d is

the drive specification

xd: Current disk and directory (lower case) where d is

the drive specification

z Display the current 4DOS shell nesting level (you

must be running 4DOS as the primary shell in

swapping mode). The primary command processor is

0. Resident copies of 4DOS return a 99 for the

shell nesting level.

$ The $ character

_ CR/LF (go to beginning of new line)

4DOS Reference Manual Copyright 1990, J.P. Software

105

Under COMMAND.COM, it is possible to use the PROMPT

command in a batch file to transmit ANSI.SYS control

sequences to the screen (for example, to redefine function

keys). This is because COMMAND.COM displays a prompt when

echoing lines in a batch file. This technique will not

work with 4DOS, because 4DOS doesn't display a prompt

within batch files; hence the characters in the PROMPT

string are never sent to ANSI.SYS. To send ANSI sequences

in 4DOS, use the ECHO command, substituting e (control-X

followed by an e) for $e in the PROMPT string.

Example: Set the prompt to the current date and time:

c:\> prompt $d $t $g

Mon Dec 25, 1989 18:29:19 >

Set a prompt using ANSI escape sequences to display the

shell level, date, time and path in color on the top line

(enter as 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

4DOS Reference Manual Copyright 1990, J.P. Software

106

PUSHD

Syntax: PUSHD [[d:]pathname]

Purpose: Save the current disk drive and directory.

Comments: PUSHD saves the current disk and directory on the

directory stack, and if a pathname is specified on the

command line, changes the disk drive and directory. The

directory stack can hold up to 255 characters (about 10 to

20 entries). If you exceed the directory stack size, the

oldest directory is removed before adding the current

directory.

The saved directory is restored on a "last in, first

out" basis by the POPD command. The directory stack can

be displayed with the DIRS command.

See also CDD, DIRS and POPD.

Example: Save the current directory and change to C:\WORDP\MEMOS:

c:\> pushd \wordp\memos

c:\wordp\memos>

Save the current drive and directory, without changing

directories:

c:\> pushd

c:\>

4DOS Reference Manual Copyright 1990, J.P. Software

107

QUIT

Syntax: QUIT

Purpose: Terminate the current batch file.

Comments: You can QUIT at any point in a batch file, not just at

the end.

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. To end all batch file

processing, use CANCEL.

See also CANCEL.

Example: This batch file fragment checks to see if the user

entered "quit" and exits if true.

input Enter your choice : %%option

if "%option" == "quit" quit

4DOS Reference Manual Copyright 1990, J.P. Software

108

RD / RMDIR

Syntax: RD [d:]path...

or

RMDIR [d:]path...

Purpose: Remove one or more subdirectories.

Comments: Before removing a subdirectory, you must delete all the

files and subdirectories (and their files) in that

directory (including any hidden or read-only files).

You can use the MS-DOS wildcard characters (* and ?) in

the directory names.

You cannot remove the root directory (\), the current

directory (.), or the parent directory (..).

See also MD.

Example: Remove the subdirectory MEMOS from the subdirectory WP:

c:\> rmdir \wp\memos

4DOS Reference Manual Copyright 1990, J.P. Software

109

REM

Syntax: REM [comment]

Purpose: Put a comment in a batch file.

Comments: If ECHO is ON, or the variable VERBOSE (see the SETDOS

command) is set, 4DOS will echo the comment. Otherwise,

4DOS will ignore it. If you don't want to echo the line,

preface REM with the @ character.

Enter your comment following the REM, separated by a

space or tab. Comments can be up to 255 characters. 4DOS

will ignore everything following a REM, including quote

characters, the redirection symbols (| > <), the command

separator character, aliases, and environment variables.

Batch file comments are useful for documenting the

purpose for a batch file and the procedures used.

Example: Enter comments in a batch file:

rem This batch file provides a

rem menu-based system for accessing

rem the word processing utilities.

rem Clear the screen and get selection

cls

4DOS Reference Manual Copyright 1990, J.P. Software

110

REN / RENAME

Syntax: REN [/PQ] [d:][path]filename... [d:][path]filename

or

RENAME [/PQ] [d:][path]filename... [d:][path]filename

Purpose: Rename files or subdirectories.

Comments: The last filename is the new name; preceding names are

the files or directories to be renamed. You can use the

wildcard characters (* and ?) in the filenames. The new

filename must not already exist. You cannot rename a

subdirectory to a new path!

If the /P(rompt) option is specified, 4DOS will prompt

you to enter Y or N to confirm each rename.

The /Q(uiet) option turns off the display of the files

renamed.

RENAME in COMMAND.COM only allows a path to be

specified with the first file name; the path for the

target is always assumed to be the same as the source.

4DOS allows you to optionally select the target path,

renaming the source file to a new directory on the same

disk drive. If you don't specify a path for the target,

4DOS will assume a "COMMAND.COM compatible" RENAME, and

will rename the source file to the new name without moving

it to another directory.

If you want to rename to a different drive, use MOVE.

Example: Rename the file MEMO.TXT to OFFICE.TXT:

c:\> rename memo.txt office.txt

Rename the files MEMO.TXT and MEMO2.TXT to another

directory:

c:\> rename memo.txt memo2.txt c:\wp\memos

Rename the directory \WORDPROC to \WP:

c:\> rename \wordproc \wp

4DOS Reference Manual Copyright 1990, J.P. Software

111

RETURN

Syntax: RETURN

Purpose: Return from a GOSUB (subroutine) call in a batch file.

Comments: The RETURN command returns from a GOSUB call to the

command following the original GOSUB.

See also GOSUB.

Example: The following batch file fragment calls a subroutine

which displays the current directory:

echo Calling a subroutine

gosub subr1

echo Returned from the subroutine

quit

:subr1

dir /hw

return

4DOS Reference Manual Copyright 1990, J.P. Software

112

SCREEN

Syntax: SCREEN row column [message]

Purpose: Position the cursor on the screen, and optionally

display a message.

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

SCREEN allows you to create attractive batch file

screen displays.

SCREEN does not change the screen colors. If you have

ANSI.SYS installed and have set colors with CLS or COLOR,

those colors will be used for the display. To display

text in specific colors, use SCRPUT.

SCREEN checks for a valid row and column, and displays

an error message if either value is out of range.

See also ECHO, SCRPUT and TEXT.

Example: The following batch file fragment displays 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 8 20 3 - Telecommunications

screen 9 20 4 - Quit

4DOS Reference Manual Copyright 1990, J.P. Software

113

SCRPUT

Syntax: SCRPUT row column [bright] [blink] fg ON bg text

Purpose: Display text in color.

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

SCRPUT works like SCREEN, but allows you to specify the

display colors, and writes directly to the screen.

The parameters are:

row Start row

col Start column

fg Foreground character color

bg Background character color

Only the first three characters of the color name and

attributes ("bright" and "blink") are required. The

available colors are:

Black Blue Green Red

Magenta Cyan Yellow White

See also CLS, ECHO, SCREEN and TEXT.

Example: The following batch file fragment displays a menu in

color (all commands should be entered on one line):

@echo off ^ cls white on blue

scrput 3 10 bri white on blue Select a number from 1

to 4:

scrput 6 20 bri red on blue 1 - Word Processing

scrput 7 20 bri yellow on blue 2 - Spreadsheet

scrput 8 20 bri green on blue 3 - Telecommunications

scrput 9 20 bri magenta on blue 4 - Quit

4DOS Reference Manual Copyright 1990, J.P. Software

114

SELECT

Syntax: SELECT [/Oeirtuz] [command] ([d:][path]filename...)...

Purpose: Execute a command on the specified files.

Comments: SELECT allows you to select command line file arguments

by marking the directory entries using a full-screen

"point-and-shoot" display. SELECT substitutes the

selected files for the argument enclosed in parentheses,

and executes the command for each marked file. The

command can be an alias, internal or external command, or

batch file. If you don't specify a command, the selected

filename(s) will become the command (see example).

The command can be a 4DOS internal command or alias, an

external command, or a batch file.

If you join filenames with a plus (+) sign, SELECT will

display the files together (an "include list"). Only the

first file in an include list can have a pathname;

subsequent filenames default to the same path.

If the filenames are enclosed in square brackets

instead of parentheses, SELECT will substitute all of the

selected filenames on one command line. If there are too

many filenames to fit on the line, SELECT will display an

error message and exit. All internal 4DOS commands

support 255 character command lines, but MS-DOS only

supports 127 character command lines for external

programs. SELECT displays the approximate command line

length in the upper left corner; it is your responsibility

to ensure SELECT doesn't exceed the 127 character limit

for external commands.

SELECT uses the up arrow, down arrow, PgUp, and PgDn

keys to scroll through the files matching the argument(s).

Use the + key or the spacebar to select a file (or

unselect a marked file), and the - key to unselect a file.

The * key will select all of the files (excluding

subdirectories). After marking the files, press ENTER to

execute the command. You can select a single file by

moving the scroll bar to the filename and pressing ENTER

when no other files have been marked.

4DOS Reference Manual Copyright 1990, J.P. Software

115

The /O option determines the sort order for the

directory display (the default sort is by filename):

e Sort by extension

i Sort by description (see DESCRIBE)

r Reverse the sort order

t Sort by time (oldest first)

u Unsorted

z Sort by size

If you want to use filename completion (see Command

Line Editing in Using 4DOS) to enter the filenames inside

the parentheses, type a space after the "(". Otherwise

the command line editor will treat "(" as the first

character of the filename.

To cancel the SELECT command, type an Escape, ^C, or

^BREAK.

Example: Select from the files in the current directory with the

extension .COM, and then from the files with the extension

.EXE to copy to the root directory on drive A:

c:\> select copy (*.com *.exe) a:\

Define an alias that selects from the executable files

in the directory C:\UTIL, and then executes them in the

order marked (the alias should be entered on one line):

c:\> alias utils select

(c:\util\*.com+*.exe+*.btm+*.bat)

c:\> utils

Select from all the files in the current directory to

move to the root directory on A (since the argument list

is enclosed in square brackets, this will be done by a

single command):

c:\> select move [*.*] a:\

4DOS Reference Manual Copyright 1990, J.P. Software

116

SET

Syntax: SET [/P] [/R filename...] [variable[=][value]]

Purpose: Display, create, modify, or delete environment

variables.

Comments: Entering SET with no variable or value displays the

environment. If you don't enter a value, SET will remove

the variable from the environment. Otherwise, the

variable and the value are placed in the environment. If

the variable already exists, its old contents are replaced

by the new value. 4DOS limits the variable name to a

maximum of 80 characters, and the value to a maximum of

255 characters. The variable names are shifted to upper

case before being stored in the environment; the value is

stored exactly as entered.

The /P option will pause after displaying a page of

environment entries. Press ^C to quit, or any other key

to display the next page.

The /R(ead) option allows you to load environment

variables from a file. This is much faster than loading

variables from a batch file. The file is in the same

format as the SET display, so SET /R can accept as input a

file generated by redirecting SET output. You can load

multiple files with one SET /R command by placing the

names one after another on the command line, separated by

spaces.

For example, the following commands will save the

environment variables to a file, and then reload them from

that file:

set > varlist

set /r varlist

You can add comments to a variable file by starting the

comment line with a colon (:).

SET only affects the environment of the current command

processor. If you EXIT to a parent command processor, the

original environment will be unchanged. The size of the

environment is specified by the /E parameter at startup.

The default size is 512 characters, the minimum size 256

characters, and the maximum size 32000 characters.

4DOS Reference Manual Copyright 1990, J.P. Software

117

You can remove multiple environment variables with the

UNSET command.

You can edit environment variables and aliases with the

ESET command. To enter aliases, use ALIAS.

See also UNSET and ESET.

Example: Display the current environment:

c:\> set

COMSPEC=C:\4DOS.COM

PATH=C:\;C:\DOS;C:\UTIL

Add a variable to the environment:

c:\> set mine=c:\finance\myfiles

c:\> set

COMSPEC=C:\4DOS.COM

PATH=C:\;C:\DOS;C:\UTIL

MINE=c:\finance\myfiles

Remove a variable from the environment:

c:\> set mine

c:\> set

COMSPEC=C:\4DOS.COM

PATH=C:\;C:\DOS;C:\UTIL

4DOS Reference Manual Copyright 1990, J.P. Software

118

SETDOS

Syntax: SETDOS [/A? /C? /E? /H? /I+|-command /L? /M? /N? /R?

/S?:? /U? /V?]

Purpose: Display or set 4DOS configuration variables.

Comments: SETDOS allows you to customize 4DOS to your personal

tastes. You would normally define the SETDOS variables in

your AUTOEXEC.BAT or 4START file. The SETDOS options are:

A The ANSI variable determines whether 4DOS will

attempt to use an ANSI escape sequence for CLS.

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 whether an ANSI driver is installed; /A1

forces 4DOS to assume an ANSI driver is installed.

C The COMPOUND variable is the character used for

separating multiple commands on the same line.

The default character is the caret (^). You

cannot use any of the redirection characters (| >

<), or any of the whitespace characters (=,;) as

the command separator.

E The ESCAPE variable is the character used to suppress

the normal meaning of the following character. Any

character following the escape character will be

passed unmodified to the command line. The default

escape character is ^X (Ctrl-X, displayed as an up

arrow). You cannot use any of the redirection

characters (| > <) or the whitespace characters

(=,;) as the escape character.

H The HISTORY variable determines the minimum command

size to save. Any command line whose length is

less than this value will not be saved to the

history list. Setting /H to 256 will disable

history saves; setting it to 0 will save

everything. The default value is 0 (save all

command lines).

4DOS Reference Manual Copyright 1990, J.P. Software

119

I The INTERNAL variable allows you to disable or

enable internal 4DOS commands. To disable a

command, precede the command name with a minus (-).

To reenable a command, precede it with a plus (+).

L The LINE variable controls how 4DOS gets its input

from the command line. The default value is 0

(character input). If you set /L to 1, 4DOS uses

the INT 21 0Ah "Get Line" call (like COMMAND.COM).

Note that this will disable command line editing,

history recall, and filename expansion. If you

have an program that requires line input, you can

define an alias or batch file:

setdos /L1 ^ program %& ^ setdos /L0

See the file COMPAT.DOC for information on

programs which require this option.

M The MODE variable controls the line editing mode.

4DOS defaults to overstrike mode (/M0). If MODE

is set to 1, the default is insert mode.

N The NOCLOBBER variable controls output redirection.

If NOCLOBBER is set to 1, then existing files may

not be destroyed by output redirection, and when

appending with >>, the output file must exist.

NOCLOBBER can be overridden with the ! character

(see the section on redirection in Using 4DOS).

The default value is 0.

R The ROWS variable 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. The

ROWS variable does not affect screen scrolling

(that is controlled by your video BIOS or

ANSI.SYS); it is used only for LIST, SELECT, the

paged output options (i.e., TYPE /P), and error

checking in the screen output commands.

4DOS Reference Manual Copyright 1990, J.P. Software

120

S The SHAPE variable sets the 4DOS cursor shape. The

format is /Ss:e where s is the starting scan line

and e the ending. The default values are the last

two lines of the cursor cell. The default editing

mode (see /M above) uses the default cursor shape;

the other mode sets the starting scan line to 0

and displays a block cursor.

U The UPPER variable controls the way filenames are

displayed for the internal commands (COPY, DIR,

etc.). If UPPER is set to 1, filenames will be

displayed in upper case (like COMMAND.COM). UPPER

defaults to /U0 (filenames will be displayed in

lower case).

V The VERBOSE variable controls command echoing in

batch files. If VERBOSE is set to 0, batch file

commands will NOT be echoed unless ECHO is set ON.

VERBOSE defaults to 1 (that is, batch file

commands WILL be echoed).

Example: Change the COMPOUND character to a ~ (tilde):

c:\> setdos /c~

Change MODE to insert, VERBOSE to off, and set

NOCLOBBER on:

c:\> setdos /m1 /v0 /n1

Disable the internal LIST command to force 4DOS to use

an external command:

c:\> setdos /i-list

4DOS Reference Manual Copyright 1990, J.P. Software

121

SETLOCAL

Syntax: SETLOCAL

Purpose: Save a copy of the current disk drive, directory,

environment variables, and aliases.

Comments: SETLOCAL is used in batch files to save the disk drive,

directory, environment variables and aliases to a reserved

block of memory. You can then change their values, and

later restore the original values with ENDLOCAL. You

cannot use SETLOCAL in an alias.

SETLOCAL and ENDLOCAL are not nestable within the same

batch file. However, you can have multiple SETLOCAL /

ENDLOCAL pairs within a batch file, and nested batch files

can each have their own SETLOCAL / ENDLOCAL. 4DOS will

automatically perform an ENDLOCAL at the end of a batch

file.

Note that if you invoke a batch file from another

without using CALL, the first batch file is implicitly

terminated, and an automatic ENDLOCAL performed. The

second batch file will inherit the drive, directory,

environment variables, and aliases as they were prior to

the SETLOCAL.

Do not load TSRs (memory-resident programs) from a

batch file while a SETLOCAL is in effect. 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 harmful, but wastes memory.

See also ENDLOCAL.

Example: This batch file fragment saves the disk drive,

directory, environment variables and aliases, changes the

disk and directory, modifies some variables, runs a

program, and then restores the original values:

setlocal

cdd d:\test ^ set path=c:\;c:\dos;c:\util

set lib=d:\lib

rem run some program here

endlocal

4DOS Reference Manual Copyright 1990, J.P. Software

122

SHIFT

Syntax: SHIFT [n]

Purpose: Allow the use of more than 10 variables in a batch

file.

Comment: SHIFT is provided for compatibility with COMMAND.COM.

COMMAND.COM supports only 10 parameters (%0 through %9);

4DOS supports 128 parameters (%0 to %127), so you may not

need to use SHIFT for batch files running exclusively

under 4DOS.

SHIFT moves each of the batch file parameters n

positions (i.e., %1 becomes %0, %2 becomes %1, etc.). The

default value for n is 1. You can also reverse a SHIFT,

by giving a negative value for n (i.e., if n is -1, the

former value for %0 is restored, %0 becomes %1, %1 becomes

%2, etc.).

SHIFT also affects the %n& (command line tail) and %#

(number of command arguments) batch variables.

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 zero one two three four five six

zero one two three

one two three four

three four five six

two three four five

4DOS Reference Manual Copyright 1990, J.P. Software

123

SWAPPING

Syntax: SWAPPING [on | off]

Purpose: Display, enable, or disable the 4DOS swapping state.

Comments: SWAPPING will temporarily disable or enable the

swapping of the 4DOS transient portion to EMS, XMS, or

disk (see Installation). This is particularly useful when

running batch files while swapping to disk. If swapping

is enabled, 4DOS saves its transient portion before

executing any external command. When the command

finishes, 4DOS performs a checksum on the transient

portion (when swapping to disk), and restores it if

necessary. (When swapping to EMS or XMS, 4DOS always

restores the transient portion.) When you are running

several small programs from a batch file and using disk

swapping, the swapping can sometimes cause a noticeable

delay. Turning SWAPPING OFF can speed up such operations.

If SWAPPING is OFF, available MS-DOS memory will be

reduced by the size of the 4DOS transient portion (about

70K). Setting SWAPPING OFF does not close the disk swap

file, or release any reserved EMS or XMS memory.

Setting SWAPPING OFF can be useful in speeding up your

AUTOEXEC.BAT file.

Example: Check the current SWAPPING status:

c:\> swapping

SWAPPING is ON

The following batch file fragment disables swapping,

runs several programs, and then reenables swapping:

swapping off

c:\util\mouse

c:\video\ansi.com

cls bright white on blue

c:\bin\cache.com

swapping on

4DOS Reference Manual Copyright 1990, J.P. Software

124

TEE

Syntax: TEE [/A] [d:][path]filename...

Purpose: Copy standard input to standard output, and save a copy

in the specified file(s).

Comments: The /A option causes the output to be appended to the

file(s) rather than overwriting it.

If you are typing at the keyboard, you need to enter a

^Z to terminate the input.

TEE is often used to save the intermediate output of a

pipe.

See also Y.

Example: 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 4DOS.DAT:

c:\> find "4DOS" doc | tee 4.dat | sort > 4dos.dat

4DOS Reference Manual Copyright 1990, J.P. Software

125

TEXT

Syntax: TEXT

.

.

.

ENDTEXT

Purpose: Display a block of text in a batch file.

Comments: The TEXT command is useful for displaying menus or

multiple line messages. TEXT will display subsequent

lines in the batch file until terminated by ENDTEXT. Both

TEXT and ENDTEXT must be entered as the only command on

that line.

If you have ANSI.SYS loaded, you can change screen

colors by inserting ANSI escape sequences into the text

block.

See also ECHO, SCREEN and SCRPUT.

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

Enter your selection :

endtext

4DOS Reference Manual Copyright 1990, J.P. Software

126

TIME

Syntax: TIME [hh[:mm[:ss]][am | pm]

Purpose: Display or set the current system time.

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

The parameters for the TIME command are:

hh (hour) = 0 - 23

mm (minute) = 0 - 59

ss (second) = 0 - 59

TIME defaults to 24-hour format, but you can optionally

enter the time in 12-hour format by appending an "am" or

"pm".

Whenever you create or modify a file, the system time

is recorded in the directory entry.

Example: Enter the time (9:30 am):

c:\> time 9:30

To be prompted for the time:

c:\> time

Mon Dec 25, 1989 9:30:10

New time (hh:mm:ss):

4DOS Reference Manual Copyright 1990, J.P. Software

127

TIMER

Syntax: TIMER [/S]

Purpose: System stopwatch.

Comments: The TIMER command turns the system stopwatch on and

off. The first time you run TIMER, the stopwatch starts.

When you run TIMER again, the stopwatch stops and the

elapsed time is displayed.

The /S option allows you to display a split time

without stopping the timer.

TIMER is particularly useful for timing events in batch

files.

The smallest interval TIMER can measure is .06 seconds;

the largest interval is 23:59:59.99.

Example: Start the timer:

c:\> timer

Timer on: 12:21:46

Display the current time, leaving the timer running:

c:\> timer /s

Elapsed time: 0:00:08.90

Stop the timer:

c:\> timer

Timer off: 12:21:58 Elapsed time: 0:00:12.06

4DOS Reference Manual Copyright 1990, J.P. Software

128

TYPE

Syntax: TYPE [/LP] [d:][pathname]filename...

Purpose: Display the contents of the specified file(s).

Comments: The TYPE command displays a file. Press ^S to suspend

the display, and any character key to continue the

display.

The /L option prints line numbers preceding each line

of text.

The /P option will pause after each page. Press ^C to

quit, or any other key to display the next page.

TYPE is normally only useful for displaying ASCII text

files; executable files (.COM and .EXE) and many data

files may be unreadable due to the presence of non-

alphanumeric characters.

You will probably find LIST to be more useful for

displaying files.

See also LIST.

Example: Display the files MEMO1 and MEMO2, pausing at the end

of each page:

c:\> type /p memo1 memo2

4DOS Reference Manual Copyright 1990, J.P. Software

129

UNALIAS

Syntax: UNALIAS alias...

or

UNALIAS *

Purpose: Remove aliases from the alias list.

Comments: UNALIAS also accepts the wildcard character * to delete

all aliases.

See also ALIAS and ESET.

Example: Remove the alias DDIR:

c:\> unalias ddir

Remove the aliases DDIR and ZAP:

c:\> unalias ddir zap

Remove all the aliases:

c:\> unalias *

4DOS Reference Manual Copyright 1990, J.P. Software

130

UNSET

Syntax: UNSET name...

or

UNSET *

Purpose: Remove variables from the environment.

Comments: UNSET also accepts the wildcard character * to delete

all of the environment variables. Use caution with UNSET

*; many programs are dependent on environment variables,

and 4DOS itself relies on PATH, COMSPEC, and 4DSHELL.

See also SET and ESET.

Example: Remove the variable CMDLINE:

c:\> unset cmdline

Remove the variables CMDLINE and PATH:

c:\> unset cmdline path

Remove all the environment variables:

c:\> unset *

4DOS Reference Manual Copyright 1990, J.P. Software

131

VER

Syntax: VER

Purpose: Display the current 4DOS and MS-DOS versions.

Comments: The 4DOS and MS-DOS versions consist of a one digit

major version number, a period, and a one or two digit

minor version number.

Example: Get the current version of 4DOS and MS-DOS:

c:\> ver

4DOS 3.01 DOS 3.31

4DOS Reference Manual Copyright 1990, J.P. Software

132

VERIFY

Syntax: VERIFY [on | off]

Purpose: Display, enable, or disable disk write verification.

Comments: When VERIFY is ON, MS-DOS will verify that no error

occurred during the disk write operation. It does NOT

compare the data actually written to the disk. VERIFY

will remain ON until you set it OFF.

Entering VERIFY with no parameters will display the

current VERIFY state.

Verification will slow your disk write operations

slightly.

At system startup, VERIFY is OFF.

Example: Check the current verify status:

c:\> verify

VERIFY is OFF

Enable disk write verification:

c:\> verify on

4DOS Reference Manual Copyright 1990, J.P. Software

133

VOL

Syntax: VOL [d:]...

Purpose: Display the disk volume label(s).

Comments: If you don't enter a drive name, VOL displays the disk

label for the current drive.

If the disk doesn't have a volume name, VOL will report

it as "unlabeled."

Volume labels can be created, changed or deleted with

the external MS-DOS LABEL command.

Example: Display the label for the default disk:

c:\> vol

Volume in drive C: is MYHARDDISK

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

4DOS Reference Manual Copyright 1990, J.P. Software

134

Y

Syntax: Y [d:][path]filename...

Purpose: Copy standard input to standard output, and then copy

the specified file(s) to standard output.

Comments: Standard input from the console is terminated by a ^Z.

See also TEE.

Example: Get text from standard input, append the files MEMO1

and MEMO2 to it, and send the output to MEMOS:

c:\> y memo1 memo2 > memos

4DOS Reference Manual Copyright 1990, J.P. Software

135

APPENDIX A - 4DOS and MS-DOS Error Messages

4DOS swapping failed, loading in memory-resident mode

None of the swapping options worked. Check your swapping

specification in SHELL or 4DSHELL, and/or free 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 require a reboot if they

occur during a primary shell.

BI Bad server function code

DI Same as Disk swap file corrupted

DR Same as Swap file read error

DS Same as Swap file seek error

ES Same as EMS map save or restore failed

EI Same as EMS mapping error

NS No number for new shell

PT Illegal process termination

TS Terminated inactive shell

XI Same as XMS move failed

Access denied

You tried to erase or write to a read-only protected file, to

rename a file or directory to an existing name, or to remove a

read-only directory or a directory with files or subdirectories

still in it.

Alias loop

An alias refers back to itself (i.e., a = b = a), or aliases are

nested more than 16 deep. Correct your alias list.

Attempt to exit from root shell

Another program has destroyed a portion of 4DOS' memory, or you

forgot a /P on your SHELL line in CONFIG.SYS. Reboot the system

and correct the error.

Bad disk unit

Generally caused by a disk drive hardware failure.

4DOS Reference Manual Copyright 1990, J.P. Software

136

Bad environment

The MS-DOS environment has a bad structure. Reboot the system.

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.

Can't copy file to itself

4DOS will not permit you to COPY or MOVE a file to itself.

Unlike COMMAND.COM, 4DOS does full path and filename expansion

before copying to 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, 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 find EXE file

The loader (4DOS.COM) can't locate either 4DOS88.EXE or

4DOS286.EXE. At boot time, one of these files must be in the

current directory, or the path must be specified with the /L

switch (see Installation). When starting a secondary shell, one

of these files must be specified with the /L switch in the

4DSHELL environment variable, or must be in the directory

specified by COMSPEC.

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.

4DOS Reference Manual Copyright 1990, J.P. Software

137

Can't open

4DOS can't open the specified file; either it doesn't exist or

the disk directory or File Allocation Table is damaged.

Can't remove current directory

MS-DOS can't delete your current directory. 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, MS-DOS is out of file

handles, or there is a hardware problem. Check SHELL and

4DSHELL.

Command line too long

The command exceeded 255 characters during alias and variable

expansion, or you or your program attempted to pass a command

line exceeding 126 characters to a secondary 4DOS shell

(including the necessary alias, environment, and history

settings). Reduce the line length and/or use default alias,

environment, and history sizes.

Contents lost before copy

COPY was appending files, and found one of the source files is

the same as the target. That source file is skipped, and

appending continues with the next file.

Data error

MS-DOS can't read or write properly to the device.

Directory stack empty

POPD or DIRS can't find any entries in the directory stack.

Disk is write protected

The disk cannot be written to. Check the disk and remove the

write-protect tab if necessary.

4DOS Reference Manual Copyright 1990, J.P. Software

138

Disk swap file corrupted

The 4DOS disk swapping file (4DOSSWAP) has been moved, deleted,

or damaged. Reboot the system.

Drive not ready--close door

The floppy disk drive door is open. Close the door and try

again.

EMS deallocation failed

The loader (4DOS.COM) can't deallocate EMS memory when exiting

from a secondary copy of 4DOS. The EMS map has been corrupted or

the loader's memory area has been destroyed by a program. Reboot

the system.

EMS map save or restore failed

4DOS cannot save or restore the EMS page map. The EMS map has

been corrupted, or memory has been destroyed by a program, or you

have an incompatible EMS driver. Try another swapping method.

EMS mapping failed

The loader (4DOS.COM) can't map EMS pages when swapping 4DOS to

or from EMS. The EMS map has been corrupted, or the loader's

memory area has been destroyed by a program. Reboot the system.

EMS not available for swapping

You requested EMS swapping but no EMS memory was available.

Change your swapping method or free some EMS memory.

Environment already saved

You have already saved the environment with a previous SETLOCAL

command. You cannot nest SETLOCAL / ENDLOCAL pairs.

Error reading

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

4DOS Reference Manual Copyright 1990, J.P. Software

139

Error writing

MS-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 4 levels deep.

EXE file [seek | read | close] failed

The loader (4DOS.COM) encountered an I/O error while attempting

to access 4DOS88.EXE or 4DOS286.EXE. Either the disk directory

or FAT is corrupted, or one of these files has been damaged. Run

CHKDSK to verify the disk is OK, and reload 4DOS88 or 4DOS286

from your distribution disk.

Fatal error -- please reboot

4DOS cannot continue due to the previous error. Reboot the

system.

File Allocation Table bad

MS-DOS can't access the FAT on the specified disk. This can be

caused by a bad disk or a hardware error.

File exists

The requested output file already exists, and 4DOS won't

overwrite it.

File not found

4DOS couldn't find the specified file. Check the spelling or

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.

Internal DOS error

MS-DOS encountered an internal bug and failed. Reboot the

system.

4DOS Reference Manual Copyright 1990, J.P. Software

140

Invalid date

An invalid date was entered. Check the syntax and reenter.

Invalid drive

A bad or non-existent disk drive was specified.

Invalid load path specified, ignored

You specified an invalid path in the /L option in SHELL or

4DSHELL.

Invalid MS-DOS version

You need a newer version of MS-DOS to execute the specified

command.

Invalid parameter

4DOS didn't recognize the a parameter. Check the syntax and

spelling.

Invalid path

The specified path does not exist. Check the disk specification

and/or spelling.

Invalid swap path specified, using current drive and directory

You specified an invalid path in the /S:B or /S:D option in SHELL

or 4DSHELL.

Invalid swapping option

You specified an invalid value for the /S option in SHELL or

4DSHELL.

Invalid time

An invalid time was entered. Check the syntax and reenter.

KEYSTACK.SYS not loaded

You attempted to execute a KEYSTACK command without loading

KEYSTACK.SYS in your CONFIG.SYS file (see Installation).

4DOS Reference Manual Copyright 1990, J.P. Software

141

Label not found

A GOTO or GOSUB referred to a non-existent label. Check your

batch file.

Memory deallocation error

The loader (4DOS.COM) can't deallocate memory while loading 4DOS.

The MS-DOS memory allocation has been corrupted. Reboot the

system.

Memory destroyed

The DOS memory control blocks have been corrupted. Reboot the

system.

Missing ENDTEXT

A TEXT command is missing a matching ENDTEXT. Check the batch

file.

Missing GOSUB

4DOS cannot perform the RETURN command in a batch file. You

tried to do a RETURN without a GOSUB, or your batch file has been

corrupted.

Missing SETLOCAL

4DOS encountered an ENDLOCAL without a matching SETLOCAL.

No aliases defined

No aliases were found in the environment.

No closing quote

4DOS couldn't find a second matching quote (` or ") on the

command line.

No file handle available

This is an internal 4DOS disk swapping error. Change to another

swapping method if possible, and contact J.P. Software.

No high memory available, environment will be placed in low memory

You requested loading the environment in an XMS UMB via the

/E:nnnU option in SHELL or 4DSHELL, but no UMB was available.

Check your XMS driver.

4DOS Reference Manual Copyright 1990, J.P. Software

142

No high memory available, resident portion will remain in low memory

You requested relocation of the 4DOS resident portion to an XMS

UMB via the /U option in SHELL or 4DSHELL, but no UMB was

available. Free some memory or check your XMS driver.

Non-DOS disk

MS-DOS can't read the disk. Either the disk is bad, or it has

been formatted by a different operating system. Reformat it as

an MS-DOS disk.

Not an alias

The specified argument is not in the 4DOS alias list.

Not an EXE file

4DOS88.EXE and/or 4DOS286.EXE is not recognized as an EXE file.

Reload the file from your distribution disk.

Not in environment

The specified argument is not in the environment.

Not ready

The specified device can't be accessed.

Not same device

This error usually appears in RENAME. You cannot rename a file

to a different disk drive.

Out of environment space

4DOS has run out of environment space. Edit the SHELL line in

CONFIG.SYS file to increase the environment size. Change the /E

parameter to read:

/E:n

where n is a number from 256 to 32000), and reboot the machine.

4DOS Reference Manual Copyright 1990, J.P. Software

143

Out of memory

MS-DOS or 4DOS had insufficient free memory to execute the last

command, or the DOS memory control blocks have been destroyed.

If this error occurs in a secondary shell, return to the primary

shell before running the command. Otherwise, try to free some

memory by removing memory-resident programs. If the error

persists, reboot the system.

Out of paper

MS-DOS detected an out-of-paper condition on one of the parallel

printers (LPT1, LPT2, or LPT3). Check your printer and add paper

if necessary.

Read error

MS-DOS disk read error; usually caused by a bad disk or a non-DOS

disk.

Sector not found

BIOS disk error; usually caused by a bad disk or a non-DOS disk.

Seek error

MS-DOS can't seek to the proper location on the disk. This is

generally caused by a bad disk or drive.

SETLOCAL only valid in batch file

The SETLOCAL command can only be used in a batch (.BAT or .BTM)

file, not in an alias or from the command line.

Swap file [seek | read | write] failed

The 4DOS loader (4DOS.COM) encountered an I/O error while

accessing the disk swap file (4DOSSWAP.nnn). Either the disk was

changed, or the file or loader's memory area has been destroyed

by a program. Reboot the system.

Syntax error

A command was entered with the improper format.

4DOS Reference Manual Copyright 1990, J.P. Software

144

Too many open files

MS-DOS has run out of file handles. Try setting FILES=20 or more

in the CONFIG.SYS file.

Transient memory allocation error

4DOS couldn't reserve memory for its transient portion (probably

in a SWAPPING OFF command). The memory control blocks have been

destroyed, or a program has fragmented memory. Reboot the

system.

Transient memory deallocation error

4DOS couldn't release memory for its transient portion (probably

in a SWAPPING ON command). The memory control blocks have been

destroyed, or a program has fragmented memory. Reboot the

system.

Unknown command

A command was entered that 4DOS didn't recognize and couldn't

find in the current search path. Check the spelling or PATH

specification.

Write error

MS-DOS disk error; usually caused by a bad disk or a non-DOS

disk.

XMS deallocation failed

4DOS could not deallocate XMS memory when exiting a secondary

shell. XMS memory has been destroyed; reboot your system.

XMS move failed

4DOS could not move data between DOS memory and XMS memory while

swapping itself. XMS memory has been destroyed; reboot your

system.

XMS not available for swapping

You requested XMS swapping but no XMS memory is available.

Change your swapping method or free some XMS memory.

4DOS Reference Manual Copyright 1990, J.P. Software

145

Appendix B - ASP

The authors and publisher of 4DOS are members of the Association

of Shareware Professionals (ASP), an organization formed in April

1987 to strengthen the future of shareware as an alternative to

commercial software. Its members, all of whom are programmers

who subscribe to a code of ethics, are committed to the concept

of shareware as a method of marketing.

The ASP's Standards for its members and their shareware products

are:

Programming Standards

The program meets the ASP's definition of "shareware" (i.e.,

it is not a commercial demo with a major feature disabled,

nor a time-limited program).

The program has been thoroughly tested by the author and

should not be harmful to other files or hardware if used

properly.

Documentation Standards

Sufficient documentation is provided to allow the average

user to try all the major functions of the program.

Any discussion of the shareware concept and of registration

requirements is done in a professional and positive manner.

Support Standards

The member will respond to people who send registration

payments, as promised in the program's documentation. At a

minimum, the member will acknowledge receipt of all

payments.

The member will establish a procedure for users to report,

and have acknowledged, matters such as bug reports, and will

describe such means in the documentation accompanying all

versions of the programs. The author will respond to

written bug reports from registered users when the user

provides a self-addressed, stamped envelope.

Known incompatibilities with other software or hardware and

major or unusual program limitations are noted in the

documentation that comes with the shareware (evaluation)

program.

4DOS Reference Manual Copyright 1990, J.P. Software

146

ASP Ombudsman Information

This program is produced by members of the Association of

Shareware Professionals (ASP). ASP wants to make sure that

the shareware principle works for you. If you are unable to

resolve a shareware-related problem with an ASP member by

contacting the member directly, ASP may be able to help.

The ASP ombudsman can help you resolve a dispute or problem

with an ASP member, but does not provide technical support

for members' products. Please write to the ASP Ombudsman

at:

ASP Ombudsman

P.O. Box 5786

Bellevue, WA 98006

or send a Compuserve message via Easyplex electronic mail to

the ASP Ombudsman, Compuserve ID number 70475,1071.

4DOS Reference Manual Copyright 1990, J.P. Software

147

Appendix C - Key Codes

Here are some of the extended key codes used by the INKEY and

KEYSTACK commands (see the Command Reference Guide):

F1 - @59 Alt-F1 - @104 Ctl-F1 - @94 Shift-F1 - @84

F2 - @60 Alt-F2 - @105 Ctl-F2 - @95 Shift-F2 - @85

F3 - @61 Alt-F3 - @106 Ctl-F3 - @96 Shift-F3 - @86

F4 - @62 Alt-F4 - @107 Ctl-F4 - @97 Shift-F4 - @87

F5 - @63 Alt-F5 - @108 Ctl-F5 - @98 Shift-F5 - @88

F6 - @64 Alt-F6 - @109 Ctl-F6 - @99 Shift-F6 - @89

F7 - @65 Alt-F7 - @110 Ctl-F7 - @100 Shift-F7 - @90

F8 - @66 Alt-F8 - @111 Ctl-F8 - @101 Shift-F8 - @91

F9 - @67 Alt-F9 - @112 Ctl-F9 - @102 Shift-F9 - @92

F10 - @68 Alt-F10 - @113 Ctl-F10- @103 Shift-F10 - @93

Home @71 Up @72 PgUp @73

Left @75 Right @77

End @79 Down @80 PgDn @81

Insert @82 Del @83

Ctl-Home @119 Ctl-PgUp @132

Ctl-Left @115 Ctl-Right @116

Ctl-End @117 Ctl-PgDn @118

Alt-A -@30 Alt-N -@49 Alt-1 - @120

Alt-B -@48 Alt-O -@24 Alt-2 - @121

Alt-C -@46 Alt-P -@25 Alt-3 - @122

Alt-D -@32 Alt-Q -@16 Alt-4 - @123

Alt-E -@18 Alt-R -@19 Alt-5 - @124

Alt-F -@33 Alt-S -@31 Alt-6 - @125

Alt-G -@34 Alt-T -@20 Alt-7 - @126

Alt-H -@35 Alt-U -@22 Alt-8 - @127

Alt-I -@23 Alt-V -@47 Alt-9 - @128

Alt-J -@36 Alt-W -@17 Alt-0 - @129

Alt-K -@37 Alt-X -@45

Alt-L -@38 Alt-Y -@21

Alt-M -@50 Alt-Z -@44

4DOS Reference Manual Copyright 1990, J.P. Software

148

Appendix D - Programming for 4DOS

From a batch file, you can test if 4DOS is loaded with the variable

function @EVAL (see Environment Variables):

if "%@eval[2+2]" == "4" echo 4DOS is loaded!

A program can test for the presence of 4DOS by making an INT 2Fh

call. On entry:

AX = D44Dh

BX = 0

If 4DOS is loaded it will return:

AX = 44DDh

BX = Version number (BL = major version, BH = minor version)

CX = 4DOS PSP segment address

DL = 4DOS shell number (0 for the root shell, 1 for the

second, etc.). The shell number is incremented each

time a new copy of 4DOS is loaded, either in a

different multitasker window (for example, DESQview),

or via nested shells.

This function is only available in swapping mode. It tells you

if 4DOS is loaded in memory, but not whether it is the parent

process of your program. You can determine if 4DOS is the parent

process by comparing the PSP value returned in CX to the PSP

chain pointer at offset 16h in your program's PSP.

4DOS also generates two different INT 2F calls to allow TSRs or

other programs to tell when 4DOS is 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.

You can put keystrokes into the KEYSTACK driver via the MS-DOS

IOCTL call. First, open the device 4DOSSTAK:

MOV AX,3D01h

DS:DX = pointer to the device name "4DOSSTAK"

INT 21h

The file handle will be returned in AX. Then send the string to

the KEYSTACK device driver:

MOV BX,AX

MOV AX,4403h

CX = string length

DS:DX = pointer to string

INT 21h

4DOS Reference Manual Copyright 1990, J.P. Software

149

Appendix E - Tips and Troubleshooting

This appendix covers general usage notes and troubleshooting

information about 4DOS. It will help you figure out what to do

if you're having trouble with 4DOS, or compatibility problems

with another software package.

What isn't covered here is information on compatibility with

specific hardware or individual software packages. Because this

information is subject to change as 4DOS and other programs are

modified, we have included it in the file COMPAT.DOC, which is

distributed with 4DOS. This file is updated with every new

release to reflect the latest compatibility information. It

should be read in conjunction with this appendix.

Installation and Boot

Most 4DOS installation problems occur because the instructions in

the manual have not been followed correctly. If you have

trouble, re-read the instructions carefully and see if they cover

the problem you're having. If not, try the information below.

If you have questions about booting 4DOS on a system attached to

a network, see the section in this appendix Using 4DOS on a

Network.

If you get a message such as "missing command interpreter" or

"can't find EXE file", you probably have the 4DOS files in the

wrong place. 4DOS is easiest to install when its system files

(KEYSTACK.SYS, 4DOS.COM, and 4DOS88.EXE or 4DOS286.EXE) are

stored in the root directory of your boot disk. If they aren't,

be sure the SHELL command in CONFIG.SYS has the correct drive and

path for 4DOS.COM, and that the /L: switch is set properly. Also

be sure that you are setting COMSPEC properly in AUTOEXEC.BAT, or

secondary shells won't load correctly.

If the system hangs after 4DOS is loaded (i.e., while processing

4START.BAT or AUTOEXEC.BAT), edit AUTOEXEC to remove the program

being loaded at the point where the hang occurs, and try again.

If problems are inconsistent or persist, edit CONFIG.SYS and

AUTOEXEC.BAT to remove all of the device drivers and TSRs that

you can reasonably remove and still have the system boot. Then

put them back one at a time until you find out what program or

combination of programs is causing the problem.

If you have trouble with keyboard device drivers or TSRs

(including those that use "hot keys"), try removing KEYSTACK.SYS

to see if there is a conflict between it and the other program.

If the KEYSTACK command fails to work, try loading it as late as

possible in CONFIG.SYS; another device driver may be stealing the

keyboard interrupt and failing to pass it along to KEYSTACK.

4DOS Reference Manual Copyright 1990, J.P. Software

150

If you have trouble booting 4DOS, or see garbage characters in

your environment immediately after boot, check the length of your

SHELL command. As discussed in Installation, the line may not

have more than 33 characters beyond the name of the shell

(including trailing spaces), due to a bug in all versions of MS-

DOS and PC-DOS.

AUTOEXEC and 4START Problems

If you follow the instructions in the manual, both of these files

should work with no trouble. Some common problems are:

1. AUTOEXEC.BAT is not executed when the primary shell is

started. This occurs because you did not put a /P in the SHELL

command, or the AUTOEXEC.BAT file is not in the root directory

of the boot drive.

2. AUTOEXEC.BAT is executed when a secondary shell is started.

You've put a call to AUTOEXEC.BAT into 4START, moved the

contents of AUTOEXEC.BAT into 4START, or called 4DOS with a /P

option on the command line. 4START should only be used for

commands to be executed when any shell is started. Commands

for the primary shell should go in AUTOEXEC.BAT.

3. 4START is not executed when a secondary shell is started.

This is because 4DOS cannot find 4START. 4START must be a

.BAT or .BTM file, located in the root directory of the drive

COMSPEC points to.

4DOS Reference Manual Copyright 1990, J.P. Software

151

Booting from a Floppy Disk

4DOS will boot properly from a floppy disk, as long as cautions

about file locations are observed carefully.

4DOS.COM, KEYSTACK.SYS, and 4DOSxx.EXE should be placed in the

root directory of the floppy disk, and the SHELL and DEVICE

commands should point to them. If your system has a hard disk,

the files can be placed there instead; be sure to set the /L:

switch so the 4DOS EXE file can be found.

When you boot from a floppy disk, 4DOS sets COMSPEC to point to

that disk (e.g. A:\4DOS.COM), regardless of where the 4DOS files

are loaded from (it isn't possible for the primary shell to

determine where it was loaded from and set COMSPEC accordingly).

If you are booting from a floppy disk on a system with a hard

disk, and you want secondary shells to load 4DOS from the hard

disk, you MUST set the COMSPEC yourself in AUTOEXEC.BAT to point

to the hard disk copy of 4DOS.

When using a pipe the temporary files created are written to the

root directory of the boot drive. If you are booting from a

floppy disk and want pipe temporary files to be written elsewhere

(e.g. to a hard disk), set the TMP environment variable to point

to the correct path. See Redirection in Using 4DOS for details

on pipes and TMP.

The AUTOEXEC and 4START batch files are always loaded from the

root directory of the boot drive when starting the primary shell,

so they will have to be on the floppy disk. The 4START file for

secondary shells is loaded from the root directory of the drive

COMSPEC points to, so if you are using 4START and change COMSPEC

be sure to make a copy of 4START on the new drive.

Hardware Errors

4DOS is compatible with virtually all PC hardware, including a

wide variety of systems, memory configurations, disk drives,

keyboards, and so on. While compatibility problems between 4DOS

and your hardware could occur, hardware problems which appear to

be due to 4DOS are usually found to be due to the hardware

itself, or to other software.

4DOS performs ALL disk I/O through standard MS-DOS calls. We

have avoided including capabilities which require direct access

to the disk , in order to maintain the maximum level of

compatibility with your disk hardware. There are no known

incompatibilities between 4DOS and disk drive hardware or

partitioning software. 4DOS is compatible with the large (over

32 MB) disk volumes created by Compaq DOS 3.31 and MS-DOS / PC-

DOS 4.0.

4DOS Reference Manual Copyright 1990, J.P. Software

152

If you find that you are having trouble with a disk drive while

running under 4DOS, check carefully to see what the problem is

and whether it can be reproduced under COMMAND.COM. There has

never been a documented instance of damage to a directory or FAT

due to a problem in 4DOS. When such problems occur it is

understandable that a new part of the operating system is the

first thing suspected of causing them, but in the few cases we

have heard about the problem has always turned out to be due to

hardware problems or errors in applications software.

Memory

4DOS does its best to detect and properly access all the types of

memory your PC can have: MS-DOS RAM, EMS, XMS, and extended

memory. 4DOS' access to these areas is always through standard

documented methods. If you want to know whether 4DOS sees your

system's memory accurately, check the output of the MEMORY

command.

Note that the output of MEMORY will show slightly more free MS-

DOS RAM than is shown by CHKDSK and some memory map programs.

This is because these programs do not count their own environment

space as free space. When 4DOS is running this space is not

occupied by a program's environment, and hence appears to be

free.

MEMORY's report of free space includes the space occupied by the

4DOS transient portion, at the end of MS-DOS memory (this space

is freed whenever an application is run). While 4DOS is running

this space is reserved, and is not available to 4DOS itself for

use by commands which allocate DOS memory (COPY, DIR, LIST,

SELECT, SETLOCAL, and the processing of .BTM files). If you use

one of these features and receive an "out of memory" error when

running in relatively limited (under 90K) memory (e.g., when

shelled to 4DOS from an application), the problem may be there is

not enough room for both 4DOS itself, and the memory to perform

the command, despite what appears to be a reasonable amount of

free RAM when looking at the output of MEMORY.

4DOS EMS swapping sometimes has difficulty with EMS drivers which

do not fully meet the EMS 3.2 specifications (4DOS supports, but

does not require, EMS 4.0). If you have trouble accessing EMS

for swapping, check COMPAT.DOC to see if there are any known

problems with your EMS board or the associated driver software.

4DOS Reference Manual Copyright 1990, J.P. Software

153

Critical Errors

A "critical" error is an error that gives you the "Abort, Retry,

Fail" message. When running 4DOS, this message appears as

follows:

[Error message]

R(etry), I(gnore), F(ail), or A(bort)?

The error message on the first line explains the error that has

occurred, and the device it occurred on. The second line prompts

for your choice of action (the Fail choice will not be displayed

under MS-DOS 2).

A critical error usually indicates a hardware malfunction. The

error may be that the device doesn't exist, there is no disk in

the drive, the network has gone down, or a data error occurred.

In most cases you will choose R to retry the operation, or A to

abort the operation. Choose I(gnore) at your peril: this

response will cause 4DOS to proceed as if the error had not

occurred!

F(ail) will tell 4DOS that the operation it was attempting has

failed, which will generally produce another error message. For

example, if you attempt to do a

directory on drive A with no disk in the drive, and answer F to

the resulting critical error, you will get an additional error

message, "Invalid drive A".

Many programs install their own critical error handlers. If you

get a critical error message within an application and the second

line does not read as shown above, the message probably did not

come from 4DOS, and any problem in handling your response

properly is due to the application, and not to 4DOS.

Choosing A to abort within an application may abort the entire

application, and not just the operation being performed,

depending on which critical error handler is in use (4DOS' or the

applications's), and how the application's critical error handler

(if any) is designed.

4DOS Reference Manual Copyright 1990, J.P. Software

154

Video

4DOS is compatible with most display adapters and monitors.

However as with any software package, you may have to configure

4DOS to run properly on your system.

4DOS uses two methods of displaying text on the screen:

1. Prompts and normal messages call DOS to write text to the

screen. If you use an ANSI driver, it will process these

calls. Otherwise, DOS will transmit the text to the BIOS (the

I/O software which comes on your system or video board) to

display it on your screen. This method for displaying text

will work on all MS-DOS systems, regardless of video type.

2. The DRAWBOX, DRAWHLINE, DRAWVLINE, LIST, SELECT, and SCRPUT

commands bypass MS-DOS, the BIOS, and ANSI, and write text

directly to video memory. These commands will only work on

systems with 100% PC-compatible video. On other systems,

results will be unpredictable at best. If you have such a

system, you probably know it already, as most PC applications

will have similar problems.

Video Cursor

The video cursor shape is defined by "start" and "stop" line

numbers within a character "cell" (the space occupied by one

character on the screen). Typical cell sizes are 14 lines on a

monochrome or EGA system, and 8 lines on a CGA system; other

video cards will have varying cell sizes.

4DOS reads the cursor shape at boot, and defines that as the

default shape. The shape used by 4DOS can be adjusted with

SETDOS /Sb:e, where b is the beginning line and e is the ending

line. To see what values 4DOS is using, run SETDOS with no

parameters. The shape defined in SETDOS is used for the default

editing mode (set by SETDOS /M). The "other" editing mode (e.g.,

if overstrike is the default then insert is the other mode) uses

a cursor that starts at line 0 and ends on the same line as the

default cursor.

If you have trouble with the cursor, experiment with the SETDOS

/S command until you find a setting that works for your system.

Note that you will have to reduce the SETDOS cursor settings if

you switch an EGA or VGA to 43-line or 50-line mode. The cursor

lines in 25-line mode use a larger character cell, and lie

outside the smaller 43-line or 50-line cell, making the cursor

invisible.

If you find the cursor has disappeared and the problem is not

addressed by SETDOS /S, it is probably due to screen color

problems. The cursor is shown in the color of the underlying

4DOS Reference Manual Copyright 1990, J.P. Software

155

character cell. If that cell has (for example) the color

attributes of black on black, the cursor will be invisible. If

you have an ANSI driver installed, you can test this out easily

by clearing the screen to a known color (see CLS in the Command

Reference Guide). The cursor should reappear. If the problem

persists, you will need to determine what is setting your screen

attributes to an invisible color. One common source of this

problem is use of an ANSI driver for 43-line or 50-line mode on

an EGA/VGA system when the ANSI driver does not support these

modes.

Screen Length

The SETDOS /R command sets the 4DOS screen length. It will not

cause 4DOS to attempt to change the video mode; it is an internal

variable used to determine display length for LIST, SELECT, and

those commands which have a "pause" option (TYPE /P, DIR /P,

etc.). 4DOS normally determines the screen length from the BIOS.

If you have a non-standard display and/or have trouble with the

default screen length, try correcting it with SETDOS /R.

SETDOS /R will NOT affect display scrolling at the command

prompt. This scrolling is handled by ANSI and/or your system

BIOS. If you have an EGA or VGA, and have put the screen in 43-

line or 50-line mode, you may find that the display still scrolls

at the 25th line. This is usually because your ANSI driver is

not properly supporting the extended screen length; it is not a

4DOS problem.

ANSI.SYS

ANSI.SYS is a device driver, normally installed in your

CONFIG.SYS file, which allows control of a variety of screen

characteristics via strings of characters sent to the screen.

Most versions of MS-DOS include a copy of ANSI.SYS, and there are

a number of more powerful versions available as public-domain,

shareware, or retail products.

The only 4DOS commands requiring ANSI.SYS are CLS and COLOR. CLS

will always clear the screen, but will ignore color

specifications if ANSI.SYS is not installed. COLOR will work

ONLY if you have an ANSI driver installed.

4DOS normally detects automatically whether an ANSI driver is

installed. If you have ANSI installed and 4DOS doesn't seem to

recognize it (e.g., CLS BRIGHT WHITE ON BLUE still leaves the

screen in white on black), try SETDOS /A1, which forces 4DOS to

use ANSI commands.

4DOS Reference Manual Copyright 1990, J.P. Software

156

4DOS and COMMAND.COM

4DOS is designed to be 99% compatible with the standard MS-DOS

command interpreter, COMMAND.COM. In virtually all cases

commands will work identically under 4DOS and COMMAND.COM.

However, 4DOS has improved on COMMAND.COM in a number of areas,

and on rare occasions these improvements produce a conflict.

In some cases 4DOS command output differs from COMMAND.COM in

order to provide enhancements. For example, the default DIR

display is in alphabetical order, rather than physical order as

in COMMAND.COM. The filenames are also in lower case, rather

than upper case. With DIR, as in most such cases, command

options allow you to specify output that is closer to or exactly

the same as COMMAND.COM.

COMMAND.COM also contains bugs or quirks which are not part of

its documented behavior, and some programmers and users have

chosen to rely on these bugs and quirks in writing their batch

files and programs. 4DOS does not emulate some of these quirks -

in some cases to do so would be wrong; in others it would hinder

useful features of 4DOS.

The only specific compatibility difference we are aware of

between 4DOS and COMMAND.COM that is unrelated to undocumented

"features" is in handling batch file variables. 4DOS allows 128

batch variables (%0 to %127), and COMMAND.COM only 10 (%0 to %9).

COMMAND.COM therefore only considers the first digit after the

"%" as part of the variable name. As a result, a string like

"%10A" will be interpreted by 4DOS as "the value of batch

variable 10, followed by the character A", and by COMMAND.COM as

"the value of batch variable 1, followed by the characters 0A".

However, you can force 4DOS to make the same interpretation as

COMMAND.COM by using the "%[varname]" feature: the string

"%[1]0A" will be interpreted the same way COMMAND.COM interprets

"%10A".

Some users have renamed 4DOS.COM to COMMAND.COM. This will work

provided you set COMSPEC properly (see Installation), and may be

necessary to deal with programs that ignore COMSPEC and call

COMMAND.COM directly. However, we do NOT recommend this approach

under most circumstances. It will cause the DOS FORMAT /S

command to copy 4DOS.COM rather than COMMAND.COM when creating a

bootable floppy disk. Such a disk will not in fact be bootable

because the 4DOS EXE file will not be on it, and you may not want

it to boot with 4DOS in any case. It may also lead to confusion

when someone else looks at your disk and sees a file called

COMMAND.COM that isn't really COMMAND.COM.

4DOS Reference Manual Copyright 1990, J.P. Software

157

Using 4DOS on a Network

4DOS is compatible with most MS-DOS-compatible networks. This

section will give you some tips on using 4DOS properly on a

network, and on the locations used for 4DOS files on a network.

If you need to boot from a network drive (i.e., on a diskless

workstation), you must have the network drive accessible at boot

time. If this condition is satisfied (so 4DOS can find its files

on the network drives), the standard options can be used to load

4DOS from the network drive.

When using 4DOS on a network, you must pay careful attention to

where files are stored in order to be sure that two 4DOS users do

not attempt to access the same file at the same time. When

swapping to disk (either explicitly with the /S:D option, or

implicitly because best guess swapping is used and no EMS or XMS

is available), you must be sure that no two users ever use the

same directory for their disk swap files, since the filenames

(4DOSSWAP.000, .001, etc.) will conflict. This includes swap

files created by shelling to 4DOS from a program, or running

secondary shells implicitly (e.g. with a MAKE utility). Set the

swap file location explicitly with the /S option, assigning each

user's swap files to a different directory on the network drive.

The primary shell's swap file location is controlled by the /S

option in CONFIG.SYS. For instance, the following command will

boot 4DOS with best guess swapping and store any disk swap file

created in directory F:\USERA:

shell=c:\ /s:bf:\usera

The swap file location for secondary shells is controlled by the

4DSHELL environment variable (see Installation). Using the above

example, the appropriate setting for 4DSHELL would be:

set 4dshell=/s:bf:\usera

Both SHELL and 4DSHELL must be set properly to ensure that there

are no problems with disk swap files on your network. Note that

if you set up the SHELL command and 4DSHELL to force EMS or XMS

swapping (/S:E or /S:X), there is no need to set up a separate

directory for each user for this purpose as there will be no disk

swap files.

Pipes are methods of passing information from one program to

another, and are invoked with the pipe symbol | on the command

line (see I/O Redirection in Using 4DOS). Pipes work by taking

the output from one program, storing it in a temporary file, then

telling a second program to obtain its input from that file. The

temporary files, named P.1$$ and P.2$$, are placed by default in

the root directory of the boot drive, but can be placed on a

different drive and directory by setting the TMP environment

variable.

4DOS Reference Manual Copyright 1990, J.P. Software

158

If you choose to set TMP, or if you have a system where multiple

users can boot from the same directory, the same cautions given

for disk swapping must be followed for pipe temporary files; that

is, you must ensure that each user's pipe temporary files go to a

separate directory. For example, for the user in the examples

for disk swapping above, the pipe temporary files can be set to

go the same directory by placing this command in AUTOEXEC.BAT:

set tmp=f:\usera

Common Questions and Problems

This section covers a variety of problems and questions which

come up regularly in technical support calls and messages, and

which are not covered by the sections above. If you have

questions about compatibility with a specific software product,

refer to COMPAT.DOC.

When you find another piece of software that appears to be

incompatible with 4DOS, there are several techniques you can try

to determine where the problem lies. Even if these methods are

not workable as a permanent solution, they will provide valuable

information as to the nature of the problem.

Try removing all of the device drivers and TSRs you can from

CONFIG.SYS and AUTOEXEC.BAT (including KEYSTACK.SYS), and see if

the problem persists. If it doesn't, put the drivers and TSRs

back one at a time until you find the conflict. Many apparent

two-way compatibility problems ("4DOS and package X don't work

together") turn out to be three-way interactions between 4DOS,

the problem program, and a device driver or TSR.

If the program you are having trouble with uses EMS memory and

you are using EMS swapping, you can try changing to disk swapping

to see if the problem goes away. The same is true for XMS

swapping and programs which use XMS.

If you are using the /U option on a system with XMS memory, try

removing it to see if the program cannot work when the command

processor is loaded high.

If the program is not a TSR, try running it under COMMAND.COM.

For example, if COMMAND.COM is in C:\:

c:\command /c myprog [parameters]

If you need to continue to use this method, you can define an

alias:

alias myprog `c:\command /c myprog %&`

If the program is large enough to overwrite the transient portion

of COMMAND.COM, you will need to change COMSPEC temporarily to

4DOS Reference Manual Copyright 1990, J.P. Software

159

point to COMMAND.COM, to avoid an error message when exiting the

program.

Problems with Shelling to DOS

Many application programs allow you to "shell to DOS" from inside

the program. If you have trouble shelling to DOS, or running a

program which uses an implicit shell (e.g., a hard disk manager

which shells to DOS to perform file copies), check your COMSPEC

and 4DSHELL settings. To shell to 4DOS, COMSPEC must point to

4DOS.COM, and the 4DOS EXE file must be in the same directory

that COMSPEC points to, or if it is not, the /L: switch must be

set in 4DSHELL. (See Installation for more details on COMSPEC

and 4DSHELL.) You can view the settings of these variables with

the command SET /P; this is a more reliable approach than looking

at AUTOEXEC, since it tells you what the variables are really set

to, instead of what you tried to set them to.

You can test whether these variables are set up properly by

changing to the directory you are in when the problem occurs, and

entering %COMSPEC at the prompt. This will attempt to execute

the program COMSPEC points to. If this works and 4DOS starts,

type EXIT to return to the previous shell. If it fails, correct

COMSPEC and/or 4DSHELL.

If COMSPEC and 4DSHELL are set correctly and you still cannot

shell to DOS, you may have too little memory. Try running a

smaller application which also shells to DOS and verify that it

works correctly; if so, see if the problem application can be

adjusted to provide more free memory for a DOS shell.

Finally, you may have trouble shelling to DOS because the

application is trying to shell directly to COMMAND.COM, rather

than looking at the COMSPEC setting. If you have moved

COMMAND.COM or changed your PATH since you installed 4DOS, make

sure there is a copy of COMMAND.COM accessible to the program and

see if it will then shell properly. You may need to contact the

program manufacturer to determine if a particular program shells

directly to COMMAND.COM.

4DOS Reference Manual Copyright 1990, J.P. Software

160

Name Conflicts with 4DOS Commands

You may have a program which has the same name as a 4DOS internal

command. Many 4DOS users use Vern Buerg's excellent file viewer,

LIST.COM, whose name conflicts with 4DOS' internal LIST command.

Such conflicts can be solved in one of two ways. If you want to

disable the 4DOS internal command entirely, use the SETDOS /I-

command. For example:

setdos /i-LIST

The command can be re-enabled with SETDOS /I+ (see SETDOS in the

Command Reference Guide).

The other method is to set up an alias to redirect the command to

the external program. For example:

alias list c:\util\list.com

This also disables the internal command. However you can then

add another alias to invoke the internal command under a

different name. For example:

alias show *list

Problems with Memory-Resident Programs (TSRs)

Most TSRs will work properly with 4DOS. If you have trouble

getting a TSR to pop up, you may need to use the SETDOS /L1

command to convince the TSR that it is at the DOS prompt, or

because it traps the DOS line input interrupt to do some of its

work.

If you have trouble getting a TSR to unload, the problem may be

due to the method used by the TSR to remove itself from memory.

In most cases programs which cannot be unloaded directly can be

removed using the MARK and RELEASE utilities available from

TurboPower Software. These programs are part of a package called

TSRCOM which also contains many other useful utilities, and is

available free on many bulletin boards and on-line services, and

is included on the 4DOS Utility Disk available from J.P.

Software.

4DOS Reference Manual Copyright 1990, J.P. Software

161

Glossary

4DSHELL: An environment variable which defines the 4DOS switch

values for secondary shells.

4START: A batch file which is executed whenever 4DOS is started,

either as a primary shell or a secondary shell.

Alias: A shorthand name for a command or series of commands.

Alias Argument: A numeric variable included in an alias

definition, allowing a different value to be used in the alias

each time it is executed.

ANSI.SYS: A device driver supplied with MS-DOS which provides

enhanced screen display and keyboard macros, or one of the many

similar programs available free or as shareware or retail

products.

Append: Concatenation of one file or string onto the end of

another. (There is also an MS-DOS external command, APPEND,

which has an entirely different meaning -- and should be used

extreme with caution!)

Application: A program run from the command prompt or a batch

file. The term is used broadly to mean any program other than

the command processor; and more narrowly to mean a program with a

specific purpose such as a spreadsheet or word processing

program, as opposed to a utility.

Archive: A file attribute indicating that the file has been

modified since the last backup (presuming that the last backup

cleared the archive attribute, as most backup programs do). Also

sometimes used to refer to a single file which contains a number

of other files in compressed form.

Argument: A piece of additional information placed after a

command or function name. For example in the command DIR XYZ,

XYZ is an argument. Also used to refer to an alias argument or

batch file argument.

ASCII: The American Standard Code for Information Interchange,

which defines numeric values for 128 different characters

comprising the English alphabet, numbers, punctuation, and some

control characters.

ASCII File: A file containing ASCII text, as opposed to a binary

file which may contain codes, numbers, or other information that

cannot be sensibly interpreted as text.

4DOS Reference Manual Copyright 1990, J.P. Software

162

Attribute: A characteristic of a file which can be set or

cleared. The standard attributes are Read-Only, Hidden, System,

and Archive. The special attributes Volume Label and Directory

are also used for files of those types.

AUTOEXEC.BAT: A batch file which is AUTOmatically EXECuted when

the computer is started.

BAT File: Same as a Batch File.

Batch File: A text file containing a sequence of MS-DOS or 4DOS

commands. Batch files are used to save command sequences so that

they can be re-executed at any time, transferred to another

system, etc.

Batch File Argument: A numeric variable used within a batch

file, allowing a different value to be used at that spot in the

file each time it is executed.

Binary File: A file containing information which does not

represent or cannot sensibly be interpreted as text. See also

ASCII File.

Block Device: A physical device for input or output which can

transmit or receive large blocks of data while the computer is

engaged in other activities. Examples include disk, tape, and

CD-ROM drives, and many networks.

Boot: The process of starting the computer and loading MS-DOS

and the command processor into memory.

Boot Directory: The current directory at the time the system is

booted, almost always the root directory of the boot drive.

Boot Drive: The disk drive that the system is booted from,

usually A: (the floppy disk) or C: (the hard disk).

Break: A signal sent to a program (including 4DOS) to tell it to

halt what it is doing. The Ctrl-C key or Ctrl-Break key is used

to send this signal. Some external commands abort when they

receive a break signal; others return to a previous screen or

menu, or abort the current operation .

BTM File: A special type of batch file which is loaded into

memory, dramatically speeding up execution.

Buffer: An area of memory set aside for storage. Usually refers

to disk buffers, used to save information as it is transferred

between your program and the disk; or to the keyboard buffer.

4DOS Reference Manual Copyright 1990, J.P. Software

163

Character Device: A physical device for input or output which

must communicate with your computer one character at a time.

Examples include the console, communications ports, and printers.

Code Page: A set of definitions which tells DOS how to get and

display date, time, and other information in the format

appropriate to a particular country.

Command Completion: A 4DOS feature which allows you to recall a

previous command by typing the first few letters of the command,

then an up-arrow or down-arrow.

Command Echoing: A feature which displays commands as they are

executed. Echoing can be turned on and off.

Command History: A 4DOS feature which retains commands you have

previously executed, so that they can be modified and re-executed

later.

Command Processor: A program, such as 4DOS or COMMAND.COM, which

interprets commands and executes other programs. The command

processor is the first program loaded when the system is booted.

Command Recall: See Command History.

Command Tail: The portion of a command consisting of all the

arguments, i.e. everything but the command name itself.

Compound Command: See Multiple Commands.

COMSPEC: An environment variable which defines where to get the

command processor for a secondary shell.

Conditional Commands: A 4DOS feature allowing commands to be

executed or skipped depending on the results of a previous

command. See also Exit Code.

CONFIG.SYS: A file which tells MS-DOS what device drivers to

install, what command processor to use, and other information

about what to do when your system boots. See your MS-DOS manual

for more information.

Console: A term describing the PC keyboard and display,.

4DOS Reference Manual Copyright 1990, J.P. Software

164

Control Character: A character which is part of the ASCII code,

but does not have a normal text representation, and which can be

generated by pressing the Ctrl key along with another key. For

example the control character called "BEL" is generated by

pressing Ctrl-G, and will cause the computer to beep if pressed

at the MS-DOS prompt.

Country Code: See Code Page.

CR: The ASCII character "carriage return", generated by pressing

the "Enter" key on the keyboard, and stored in most ASCII files

at the end of each line.

Critical Error: An error, usually related to input, output, or

network access, which prevents a program from continuing. When a

critical error occurs a prompt such as "R(etry), I(gnore),

F(ail), or A(bort)" is given and you must decide what action to

take.

Current Directory: The directory in which all file operations

will take place unless otherwise specified. For example if the

current directory is C:\MYFILES then the command "DEL XYZ" will

delete the file XYZ in the directory C:\MYFILES, and will not

affect other files with the same name which may be in other

directories.

Description: A string of up to 40 characters assigned to

describe a file with the 4DOS DESCRIBE command.

Device: A physical device for input or output such as the

console, a communications port, or a printer. Sometimes the term

"device" alone is used to refer to character devices such as

those listed above, and excludes block devices.

Device Driver: A program which allows DOS to communicate with a

device, and which is loaded into memory when the system is

booted, via a statement in CONFIG.SYS. Some device drivers are

used to manage memory or for other similar internal functions,

rather than to communicate with an external device.

Directory: A portion of any disk, identified by a name and a

relationship to other directories in a "tree" structure, with the

tree starting at the root directory. A directory separates files

on the disk into logical groups, but does not represent a

physical division of the data on the disk.

Disk Swapping: A type of swapping where the transient portion of

4DOS is stored on disk while an application is running.

4DOS Reference Manual Copyright 1990, J.P. Software

165

DOS Memory: The portion of your computer's memory available for

use by DOS, the command processor, and application programs. On

most PCs this area consists of the first 640K bytes of the

computer's memory (one K is 1024 bytes).

Echo: See Command Echoing.

EMS Memory: Memory which conforms to the Lotus - Intel -

Microsoft Expanded Memory Specification (LIM EMS). This

hardware/software standard allows programs to access large

amounts of memory outside of standard DOS memory or extended

memory. Most systems which have EMS memory have either a

specific EMS board (on any PC or compatible system), EMS

emulation software (on PC-AT compatible systems), or a 386

control program such as QEMM or 386MAX (on 386 systems). If you

do not have one of these items, you probably do not have EMS

memory.

EMS Swapping: A type of swapping where the transient portion of

4DOS is stored in EMS memory while an application is running.

Environment: An area of memory which contains multiple entries

in the form "NAME=value". Each entry is called an environment

variable, with the name "NAME". See also master environment and

passed environment.

Environment Variable: The name of a single entry in the

environment. Environment variables are entered with the SET

command, and used to associate the specified value with the

specified name for any purpose desired by the user. Typically,

their function is to set default switches for a program, specify

a directory path where files can be found, and so on. When 4DOS

encounters an environment variable name in a command in the form

"%NAME" (or "%NAME%"), it substitutes the corresponding value in

its place.

Errorlevel: A numeric value returned from an external command to

indicate its result (e.g. success, failure, response to a

question), and accessible via the IF ERRORLEVEL command and the

%? environment variable. The value is between 0 and 255, plus

256 if the program was interrupted by a break, 512 if it aborted

due to a critical error, or 768 if it remained resident in memory

as a TSR. See also Exit Code.

Escape Character: This term has two meanings. In some contexts

it means the 4DOS escape character, normally Ctrl-X, which is

used to suppress the normal meaning of or give special meaning to

the following character. In other cases it refers to the

specific ASCII character ESC. The meaning must be determined

from the context.

4DOS Reference Manual Copyright 1990, J.P. Software

166

Executable Extensions: A 4DOS feature which allows you to

specify the application to be executed when a file with a

particular extension is named at the command prompt.

Executable File: A file with the extension .COM or .EXE, which

can be loaded into memory and run as a program.

Exit Code: The error level returned by an external command, or a

similar exit code returned by a 4DOS internal command. 4DOS

internal commands return an exit code of 0 if successful, or non-

zero if unsuccessful.

Expansion: The process 4DOS goes through when it scans a command

line and substitutes the appropriate actual values for aliases,

alias arguments, batch file arguments, and environment variables.

Extended ASCII Character: A character which is not part of the

standard set of 128 ASCII characters, but is used on the PC as

part of an extended set of 256 characters. These characters

include international language symbols, and box and line drawing

characters.

Extended Memory: Any memory on a 286-based (PC-AT compatible) or

386-based computer system which is above the 1 MB (one megabyte,

or 1024*1024 bytes) of memory that DOS can address directly. Any

PC-AT compatible or 386 system with more than 640K of memory has

extended memory. This memory can be used for a variety of

purposes depending on the software installed to utilize it. See

also XMS.

External Command: A program which resides in an executable file,

as opposed to an internal command which is part of the command

processor. For example, FORMAT and DISKCOPY are external

commands; you can find them on your DOS disk under the names

FORMAT.COM and DISKCOPY.COM.

File Attribute: See Attribute.

File Description: See Description.

Filename Completion: A 4DOS feature which allows you to type

part of a filename on the command line, and have 4DOS fill in the

rest for you.

Free Memory: Usually, the amount of DOS memory which is

currently unoccupied and available for use by applications.

4DOS Reference Manual Copyright 1990, J.P. Software

167

Hidden: A file attribute indicating that the file should not be

displayed with a normal DIR command, and should not be available

for access by programs unless they specifically request use of

hidden files.

History: See Command History.

Insert Mode: When editing text, a mode in which newly typed

characters are inserted into the line at the cursor position,

rather than overwriting existing characters on the line. See

also overstrike mode.

Internal Command: A command which is part of the command

processor, as opposed to an external command. For example, DIR

and COPY are internal commands.

Keyboard Buffer: A buffer which holds keystrokes you have typed

that have not yet been used by the currently executing program.

Label: A marker in a batch file which allows GOTO or GOSUB

commands elsewhere in the batch file to "jump" to the command on

the line following the label. See also Volume Label.

LF: The ASCII character "line feed", not usually generated from

the keyboard, but stored in most ASCII files at the end of each

line after the CR character.

Master Environment: The master copy of the environment

maintained by the command processor. The master environment is

manipulated with the SET and UNSET commands. The size of the

master environment is set by the /E: command line switch.

Memory Resident Mode: A method of installing 4DOS where swapping

is disabled, and all of 4DOS remains permanently resident in

memory. Memory-resident mode requires much more memory than the

normal swapping mode.

Multiple Commands: A 4DOS feature which allows multiple commands

to be placed on a line, separated by a caret (^) or other user-

defined character.

Multitasking: A capability of some software (and the related

hardware) which allows two or more programs to run apparently

simultaneously on the same computer. Multitasking software for

PC compatible systems includes programs like DESQview.

Option: See Switch.

4DOS Reference Manual Copyright 1990, J.P. Software

168

Overstrike Mode: When editing text, a mode in which newly typed

characters overwrite existing characters on the line, rather than

being inserted into the line at the cursor position. See also

Insert Mode.

Parameter: See Argument.

Parsing: The process 4DOS performs when it analyzes the command

line, performs alias and environment variable expansion, and

finds the appropriate internal command or external command to

execute.

Passed Environment: A copy of the master environment created

before running an application, so that any changes made by the

application will not affect the master environment. The size of

the passed environment is determined by the amount of space

actually used in the master environment when the application is

started.

Path: A specification of the directories a file resides in,

including all parent directories. For example, the path for

C:\WPFILES\MYDIR\MEMO.TXT is C:\WPFILES\MYDIR\. Also used to

refer to the environment variable PATH, which contains a series

of path specifications used when searching for external commands

and batch files.

Pipe: A method for collecting the standard output of one program

and passing it on as the standard input of the next program to be

executed, signified by a vertical bar "|" on the command line.

See also Redirection.

Primary Shell: The copy of the command processor which is loaded

when the system boots.

RAM Disk: A pseudo "disk drive", created by software, which

appears like a normal physical disk drive to programs. RAM disks

can be stored in extended memory, XMS memory, EMS memory, or DOS

memory, and provide a convenient way for programs to use this

memory for temporary files.

Read-Only: A file attribute indicating that the file can be

read, but not written by MS-DOS and 4DOS.

Reboot: The process of restarting the computer, usually by

pressing the Ctrl, Alt, and Del keys simultaneously.

4DOS Reference Manual Copyright 1990, J.P. Software

169

Redirection: A method for collecting the standard output of a

program in a file, and/or of providing the standard input for a

program from a file, signified respectively by a greater than

symbol ">" or less than symbol "<" on the command line. See also

Pipe.

Replaceable Parameter: See Alias Argument and Batch File

Argument.

Resident Portion: The small portion of 4DOS stored permanently

in memory when swapping mode is in use, as opposed to the larger

transient portion. The resident portion is stored as close as

possible to the beginning of DOS memory.

Root Directory: The first directory, from which all other

directories are "descended." The root directory is referenced

with a single backslash (\). When a disk is first formatted, it

is the only directory.

Secondary Shell: Any copy of any command processor which is

loaded after the system boots. Secondary shells may be started

from the command line; by executing a "shell to DOS" operation

from within an application; implicitly by executing some MS-DOS-

related functions within certain applications; or by starting a

new partition in a multi-tasking or task switching system.

Shell: A command processor. Also used to refer to a program

which gives access to MS-DOS functions and commands through a

menu- or mouse-driven system.

Source: In the 4DOS file commands (COPY, MOVE, and RENAME), the

original files before any copying or modification has taken

place, i.e. those specified earlier on the command line. See

also Target.

Stack: An area of memory used by any program to store temporary

data while the program is running; more generally, any such

storage area where the last item stored is normally the first one

removed.

Standard Error: A file or character device where error messages

from a program are displayed. Standard error output always goes

to the console, unless redirection is used.

Standard Input: A file or character device where a program

obtains its normal input. Standard input always comes from the

console, unless redirection is used.

4DOS Reference Manual Copyright 1990, J.P. Software

170

Standard Output: A file or character device where normal output

from a program is displayed. Standard output always goes to the

console, unless redirection is used.

Subdirectory: Any directory other than the root directory. See

also Root Directory.

Swap File: A disk file created by 4DOS to store its transient

portion when disk swapping is in use.

Swapping: A 4DOS feature which removes the larger transient

portion of 4DOS from DOS memory while an application is running,

leaving the maximum possible amount of memory for the

application, yet allowing 4DOS to retain information such as the

command history after the application is finished. See also XMS

Swapping, EMS Swapping, and Disk Swapping.

Switch: An argument to an internal command or application which

specifies a particular behavior or setting. For example, the

command "DIR /P" might be referred to as "having the /P switch

set". Also, a configuration value for 4DOS specified on the

SHELL= line in CONFIG.SYS, or in 4DSHELL.

System: A file attribute indicating that the file belongs to MS-

DOS and should not be accessed by normal programs.

Target: In the 4DOS file commands (COPY, MOVE, and RENAME), the

final files after any copying or modification has taken place;

generally those referred to by the last specification on the

command line. See also Source.

Transient Portion: The larger portion of 4DOS stored in memory

temporarily when swapping mode is in use, as opposed to the

smaller resident portion. The transient portion is stored as

close as possible to the end of DOS memory, and is removed from

memory whenever an application is executed.

TSR: A Terminate and Stay Resident program, i.e. a program which

"terminates" but remains resident in DOS memory, to provide

capabilities such as network support, a pop-up notepad or

telephone dialer, a disk cache, or mouse support.

UMB: An XMS Upper Memory Block, whose address is above the end

of normal DOS memory, but is within the 1 megabyte of memory that

DOS can address directly.

4DOS Reference Manual Copyright 1990, J.P. Software

171

Variable: See Alias Argument, Batch File Argument, and

Environment Variable.

Volume Label: A special, hidden file placed on any disk whose

name constitutes a "label" for the entire disk.

White Space Character: Generally, a character used to separate

arguments on the command line. The white space characters

recognized by 4DOS are the space, tab, comma, semicolon, and

equals sign.

Wildcard: A character ("*" or "?") used in a filename to specify

the possibility that any single character ("?") or sequence of

characters ("*") can occur at that point in the actual name.

XMS Memory: A software method for accessing extended memory on

286 and 386 systems (and some systems which support version 4.0

of the EMS memory specification). XMS memory is not additional

memory, but is a software specification only. Its use generally

requires Microsoft's HIMEM.SYS be installed as a device driver,

or that another program such as 386MAX or MOVE-EM be used.

XMS Swapping: A type of swapping where the transient portion of

4DOS is stored in XMS memory while an application is running.

4DOS Reference Manual Copyright 1990, J.P. Software

172

Index

4DOS Cancel batch job 34

Features 1 CD 57

Memory Usage 18 CDD 58

Startup Options 21 CHCP 59

Swapping mode 22 CHDIR 57

4DOS.COM 9 CLS 60

4DOS.DOC 10 CMDLINE 3, 40

4DOS286.EXE 9 Code page 59

4DOS88.EXE 9 COLOR 61

4DOSSTAK 149 Colors 60, 114

4DSHELL 15, 25, 160 Command

4START 25, 27, 119, 151 Completion 29

Echoing 32

? 48 History and Recall 29

Line 3

ALIAS 35, 49 Line arguments 32

Alias Line editing 28

Expansion 35 Parsing 45

List 130 Processor 80

List size 21, 99 Reference Guide 46

Parameters 36 Separator 30, 119

Aliases 3, 10, 35, 37, 78, Syntax 47

130 COMMAND.COM 26, 157

AND 30 Comment 110

ANSI 60, 61, 119, 156 COMPAT.DOC 10

Append 62 Compatibility 10

Archive attribute 52, 62 COMPOUND 30, 119

Argument quoting 32 COMSPEC 15, 160

ASP 146 Conditional commands 3, 30

Association of Shareware Conditional execution 88, 91

Professionals 146 CONFIG.SYS 14, 19

ATTRIB 52, 89 Configuration 17

Attribute 52 Console 64

AUTOEXEC.BAT 14, 25, 27, 151 COPY 62

Automatic Installation 13 Country code 65

Create subdirectories 98

Batch Critical errors 154

File nesting 55 CTTY 64

File echoing 76 Current directory 57, 107,

109

File parameters 123 Cursor 113, 121, 155

File processing 56 File variables 34

DATE 65

Files 33 DEL 66

Processor 7 DELAY 67

Variables 157 DESCRIBE 68

BEEP 53 DESCRIPT.ION 68

Box 73 DIR 69

BREAK 54 Directory stack 72, 107

DIRS 72

CALL 55 Disk swapping 22

CANCEL 56, 108 Disk write verification 133

4DOS Reference Manual Copyright 1990, J.P. Software

173

DOS Shells 14 EXTENDED 89

DOS.HLP 10 Extended key codes 148

DOSMEM 89 Extended memory 99

DRAWBOX 73 External command 102

DRAWHLINE 74

DRAWVLINE 75 F1 28, 95

F8, F9 & F10 28, 30

ECHO 32, 76 File descriptions 2, 68

Edit 78 File attributes 52

EGA 156 Filename completion 30

ELSE[IFF] 91 Floppy disk 152

EMS 18, 89 FOR 81

Swapping 23, 153 FREE 82

ENDIFF 91 Frequency 53

ENDLOCAL 77, 122

ENDTEXT 126 GE 88

Environment 2, 131 GLOBAL 83

Size 2, 21 GOSUB 84, 112

Space 99 GOTO 85

Variables 2, 40, 78, 92, GT 88

93, 117, 122

@ext 42 Hardware errors 152

@full 42 HELP 10, 11, 86

@length[string] 42 Hidden attribute 52, 79

@name 42 HISTORY 87, 119

@path 42 History list 29, 87

@search 42 History size 22

@substr 42 Horizontal line 74

_BG 41

_CPU 41 I/O Redirection 43

_CWD 41 IF 88

_CWDS 41 IFF 91

_CWP 41 INKEY 92, 148

_CWPS 41 INPUT 93

_DATE 41 INSTALL 13

_DISK 41 INSTALL.BAT 9

_DOSVER 41 Installation 9, 150

_FG 41 INTERNAL 120

_SHELL 41 ISALIAS 89

_TIME 42 ISDIR 90

EQ 88

ERASE 66 Key Codes 148

Error messages 136 KEYSTACK 10, 11, 39, 94,

ERRORLEVEL 30, 41, 89 148, 149

ESCAPE 31, 119

Escape character 31, 119 Label 85, 134

ESET 78 Language support 59

EXCEPT 79 LE 88

Executable extensions 37 LINE 120

EXIST 89 Line editing mode 120

EXIT 80 LIST 95

Exit code 30 LOG 97

Expanded memory 99 LT 88

4DOS Reference Manual Copyright 1990, J.P. Software

174

Manual Installation 17 SCREEN 113

MARK 161 Screen length 156

MD 98 SCRPUT 114

MEMORY 99, 153 SELECT 115

Memory resident mode 18,23 SET 40, 117

Memory-resident programs 161 SETDOS 29, 30, 31, 32, 43,

MKDIR 98 76, 87, 110, 119,

MODE 120 155, 156, 161

MONITOR 90 SETLOCAL 77, 122

MOVE 100 SHAPE 121

Multiple arguments 4 Shell 14, 19, 21

Multiple commands 2, 30 Shelling to DOS 160

SHIFT 34, 123

Name conflicts 161 Standard

NE 88 Error 43

Network 3, 158 Input 43, 64, 125, 135

NOCLOBBER 43, 120 Output 43, 64, 125, 135

Starting 4DOS 27

OR 30 Stopwatch 128

OS/2 DOS box 1, 20 Subdirectory 98, 109

Subroutine 84, 112

Parent directory 109 SWAPPING 124

PATH 40, 98, 102 Swapping mode 18

PAUSE 103 System attribute 52

Pipes 44, 125,158

PKUNZIP 10, 11 TEE 125

POPD 104 TEXT 1 26

Primary shell 14 THEN 91

Programming for 4DOS 149 TIME 127

PROMPT 105 TIMER 128

PUSHD 107 Tips 150

TMP 41, 44, 159

Quick Start 12 Transient portion 18, 124

QUIT 108 Troubleshooting 150

Quotes 32 TSR 161

TSRCOM 161

RAM 99 TYPE 129

RD 109

Read-only attribute 52 UMB 23

README.DOC 10 UNALIAS 35, 50, 130

Redirection 3, 120 UNSET 131

RELEASE 161 UPPER 121

REM 110 Using 4DOS 27

REN 111

RENAME 111 Variable functions 42

Replaceable parameters 36 Variables 131

Resident portion 18 VER 132

RETURN 84, 112 VERBOSE 32, 76, 110, 121

RMDIR 109 VERIFY 63, 133

Root directory 98, 109 Version number 132

Root shell 14 Vertical line 75

ROWS 120 VGA 156

4DOS Reference Manual Copyright 1990, J.P. Software

175

VIDEO 90, 155

Video cursor 155

VOL 134

Volume label 134

Wildcards 2

XMS 18, 90

Memory 99

Swapping 23

Upper Memory Block 23

Y 135

4DOS Reference Manual Copyright 1990, J.P. Software

176