home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Depot 5
/
mediadepotvolume51993.iso
/
FILES
/
17
/
JP4REF.ZIP
/
REFMAN.DOC
< prev
Wrap
Text File
|
1994-10-12
|
1MB
|
23,806 lines
4DOS (r)
4OS2 (tm)
4DOS for Windows NT
Reference Manual
Developed By
Rex Conn and Tom Rawson
Documentation By
Hardin Brothers, Tom Rawson, and Rex Conn
Published By
JP Software Inc.
P.O. Box 1470
East Arlington, MA 02174
U.S.A.
(617) 646-3975
fax (617) 646-0904
ACKNOWLEDGMENTS
We couldn't produce products like 4DOS, 4OS2, and 4DOS/NT
without the dedication and quality work of many people. Our
thanks to:
JP Software Staff: Mike Bessy, Bobby Kelley, Ellen
Stone, Marcella Turner, Misty White.
Online Support: Brian Miller and Tess Heder of Channel 1
BBS; Don Watkins of CompuServe's IBMNET.
Beta Test Support: David Moskowitz and the sysops of
CompuServe's CONSULT forum.
Beta Testers: We can't list all of our beta testers
here! A special thanks to all of you who helped make
4DOS, 4OS2, and 4DOS/NT elegant, reliable, and friendly.
The following tools are used in creating and maintaining 4DOS,
4OS2, and 4DOS/NT:
Compilers: Microsoft C, Microsoft Macro Assembler,
IBM C-Set/2, Borland Turbo Pascal
Libraries: Spontaneous Assembly (Base Two
Development), Turbo Professional (Turbo
Power Software)
Editors: Edix (Emerging Technology), Brief
(Solution Systems)
Debuggers: Periscope (The Periscope Company), Soft-
ICE (Nu-Mega Technologies)
Version Control: PVCS (Sage Software)
Documentation: Microsoft Word for Windows with Adobe
Type Manager
Program and Documentation Copyright c 1988 - 1994, JP Software
Inc., All Rights Reserved. 4DOS is a registered trademark and
4OS2, JP Software, and the JP Software logo and product logos
are trademarks of JP Software Inc. Other product and company
names are trademarks of their respective owners.
10-94
CONTENTS
-------------------------------------------------------------------
CONTENTS
Introduction...............................................1
How to Use This Manual.................................2
Registration and Upgrade Information...................6
Technical Support......................................7
Chapter 1 / General Concepts..............................10
Operating Systems and Command Processors..............10
Primary and Secondary Shells......................12
Files and Directories.................................13
Drives and Volumes................................14
File Systems......................................14
Directories and Subdirectories....................15
File Names........................................16
File Attributes...................................18
Internal and External Commands........................19
Executable Files and File Searches....................20
The Environment.......................................21
ASCII and Key Codes...................................22
The Keyboard..........................................23
Video.................................................24
ANSI Drivers..........................................25
Chapter 2 / Conventions...................................26
Colors and Color Names................................26
Blinking Text and Bright Background Colors........28
Color-Coded Directories...............................30
Keys and Key Names....................................31
Chapter 3 / Using 4DOS, 4OS2, and 4DOS/NT.................34
At the Command Line...................................34
Command-Line Editing..............................35
Command History and Recall........................36
Local and Global Command History..................39
Command History Window............................40
Filename Completion...............................41
Filename Completion Window........................42
Directory Changes and CDPATH......................43
Directory History Window..........................45
Local and Global Directory History................45
Automatic Directory Changes.......................47
Multiple Commands.................................47
Temporarily Disabling Aliases.....................48
Command Line Help.................................48
Command-Line Length Limits........................50
Page and File Prompts................................ 50
Critical Errors.......................................51
Input and Output......................................52
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / i
CONTENTS
-------------------------------------------------------------------
Redirection.......................................52
Piping............................................55
Keystack..........................................57
File Selection........................................58
Extended Parent Directory Names...................59
Wildcards.........................................59
Date, Time, and Size Ranges.......................62
Multiple Filenames................................66
Include Lists.....................................67
Executable Extensions.............................68
Advanced Features.....................................71
Conditional Commands..............................71
Command Grouping..................................71
Escape Character..................................73
4DOS, 4OS2, and 4DOS/NT Compatibility.................74
Chapter 4 / Aliases and Batch Files.......................77
Aliases...............................................77
Batch Files...........................................80
.BAT, .CMD, and .BTM Files........................80
Echoing...........................................81
Batch File Parameters.............................81
Batch File Commands...............................83
Interrupting a Batch File.........................85
Automatic Batch Files.............................85
Detecting 4DOS, 4OS2, or 4DOS/NT..................86
Using Aliases in Batch Files......................87
Debugging Batch Files.............................89
Batch File String Processing......................91
Batch File Compression............................93
REXX Support......................................95
EXTPROC Support...................................96
Using the Environment.................................96
Configuration Variables...........................98
Internal Variables...............................100
Variable Functions...............................108
Command Parsing......................................121
Argument Quoting.................................123
Chapter 5 / Configuration................................126
Using the .INI File..................................126
.INI File Directives.................................127
Types of Directives..............................130
Initialization Directives........................131
Configuration Directives.........................136
Color Directives.................................141
Key Mapping Directives...........................143
Advanced Directives..............................148
Examples.........................................151
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / ii
CONTENTS
-------------------------------------------------------------------
Chapter 6 / Command Reference Guide......................153
Command Categories...................................154
How to Use the Command Descriptions..................155
?....................................................159
ACTIVATE.............................................160
ALIAS................................................161
ATTRIB...............................................173
BEEP.................................................176
BREAK................................................177
CALL.................................................179
CANCEL...............................................180
CD / CHDIR...........................................181
CDD..................................................183
CHCP.................................................184
CLS..................................................185
COLOR................................................186
COPY.................................................187
CTTY.................................................194
DATE.................................................195
DEL / ERASE..........................................196
DELAY................................................200
DESCRIBE.............................................201
DETACH...............................................203
DIR..................................................204
DIRS.................................................214
DO...................................................215
DPATH................................................218
DRAWBOX..............................................219
DRAWHLINE............................................221
DRAWVLINE............................................222
ECHO.................................................223
ECHOS................................................225
ENDLOCAL.............................................226
ESET.................................................227
EXCEPT...............................................229
EXIT.................................................231
FOR..................................................237
FREE.................................................242
GLOBAL...............................................243
GOSUB................................................245
GOTO.................................................246
HELP.................................................248
HISTORY..............................................249
IF...................................................251
IFF..................................................257
INKEY................................................259
INPUT................................................262
KEYBD................................................264
KEYS.................................................265
KEYSTACK.............................................266
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / iii
CONTENTS
-------------------------------------------------------------------
LH / LOADHIGH........................................269
LIST.................................................272
LOADBTM..............................................276
LOG..................................................277
MD / MKDIR...........................................279
MEMORY...............................................280
MOVE.................................................282
MSGBOX...............................................287
ON...................................................288
PATH.................................................290
PAUSE................................................293
POPD.................................................294
PROMPT...............................................295
PUSHD................................................299
QUIT.................................................301
RD / RMDIR...........................................302
REBOOT...............................................303
REM..................................................305
REN / RENAME.........................................306
RETURN...............................................309
SCREEN...............................................310
SCRPUT...............................................312
SELECT...............................................313
SET..................................................319
SETDOS...............................................322
SETLOCAL.............................................329
SHIFT................................................330
START................................................331
SWAPPING.............................................339
TEE..................................................340
TEXT.................................................342
TIME.................................................343
TIMER................................................344
TITLE................................................346
TRUENAME.............................................347
TYPE.................................................348
UNALIAS..............................................350
UNSET................................................351
VER..................................................352
VERIFY...............................................353
VOL..................................................354
VSCRPUT..............................................355
WINDOW...............................................357
Y....................................................358
Appendix A / Error Messages..............................359
Appendix B / ASCII and Key Codes.........................371
Keys and Key Codes...................................375
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / iv
CONTENTS
-------------------------------------------------------------------
Glossary.................................................381
Index....................................................393
Quick Reference..........................................407
Internal Variables...................................407
Variable Functions...................................408
.INI File Directives.................................409
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / v
CONTENTS
-------------------------------------------------------------------
CONTACTING JP SOFTWARE
You can contact JP Software at any of the following addresses. Our
normal business hours are 9:00 AM to 5:00 PM weekdays, eastern US
time. For more information about contacting us for technical
support, see page 7.
By mail:
JP Software Inc.
P.O. Box 1470
East Arlington, MA 02174
USA
By telephone / fax:
Voice: (617) 646-3975
Fax: (617) 646-0904
Order Line: (800) 368-8777 (orders only, USA only)
Electronically:
CompuServe: Customer Service 75020,244
Technical Support, GO JPSOFT or GO PCVENB
(section 10), User ID 75300,1215
Internet: Customer Service 75020.244@compuserve.com
Technical Support 75300.1215@compuserve.com
BBS Support: Via Channel 1 BBS, Boston, 617-354-5776 at
2,400 - 14,400 baud, no parity, 8 data
bits, 1 stop bit
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / vi
INTRODUCTION
-------------------------------------------------------------------
INTRODUCTION
Welcome to our Reference Manual. We have designed this manual
to accompany three of our products: 4DOS, 4OS2, and 4DOS for
Windows NT.
Technically, each of these programs is a command interpreter
or "shell." That means that they respond to the commands you
type at the C:\> or [C:\] prompt. Each is designed to replace
the default command interpreter that was supplied with your
operating system:
4DOS replaces COMMAND.COM from DOS
4OS2 replaces CMD.EXE from OS/2
4DOS/NT replaces CMD.EXE from Windows NT
4DOS can also be used as the command interpreter for DOS
sessions running under OS/2, and under Windows 3.0 and above.
Each of our products is highly compatible with the command
interpreter that it replaces. That means that you don't have
to change your computing habits or unlearn anything to use any
of these products. Each also adds many new features and
commands to its operating environment. They make the
operating system friendlier, easier to use, and much more
powerful and versatile, without requiring you to learn a new
program, a new set of commands, or a new style of work.
Each product is shipped with this manual plus a smaller
Introduction and Installation Guide. Please start with the
smaller manual. It will tell you how to get started with the
product you purchased and also contains some other information
that applies specifically to that product.
Once you have installed 4DOS, 4OS2, or 4DOS for Windows NT,
you can learn its features at your own pace. Relax, enjoy the
power of your new program, and browse through both manuals
occasionally. Press the F1 key whenever you need help. The
program will soon become an essential part of your computer,
and you'll wonder how you ever got along without it.
If you are a new user and want to take your new program for a
spin without performing a complete installation, see the
Guided Tour pamphlet included with your copy of 4DOS, 4OS2, or
4DOS/NT.
We are constantly working to improve these programs. If you
have suggestions for features or commands that you think we
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 1
INTRODUCTION
-------------------------------------------------------------------
should include in the next version, or any other way we could
improve our product, please let us know. Many of the
improvements in this version were suggested by our users, and
while we can't promise to include every suggested feature, we
really do appreciate and pay attention to your comments.
How to Use This Manual
This manual covers three separate products: 4DOS, 4OS2, and
4DOS for Windows NT. We have combined reference information
for the products in one manual because 4DOS, 4OS2, and 4DOS
for Windows NT offer almost exactly the same features and
commands, so individual manuals would be almost identical.
Many of our customers use more than one of these products;
they find that a single manual helps them understand the
similarities and differences of the three products. In
addition, printing a single manual reduces our costs and lets
us bring you the most powerful command interpreters available
for the lowest possible price.
Most of this manual describes commands and features which are
available in all three products. When we need to discuss the
features or behavior of a single product, we mention it
specifically in the text. When an entire paragraph or section
applies to a specific product, we use marginal text to
identify that product:
4DOS marks sections that apply only to 4DOS.
4OS2 marks sections that apply only to 4OS2.
4NT marks sections that apply only to 4DOS for Windows NT. For
brevity, we often refer to this product as "4DOS/NT", or by
the actual program name, "4NT", in this manual.
Occasionally, a feature will be marked with two of these
marginal notations when it applies to two different products.
We have designed this manual to serve as a gentle introduction
to our products for novice users and as a reference manual for
advanced users.
You will likely find some parts of the manual too simple or
too technical for your tastes. Unless you are convinced that
one of those sections holds just the information you need for
a specific task, feel free to skip to the next part of the
manual that is more to your liking. You can use almost every
feature of our products without having to worry about other
features or commands.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 2
INTRODUCTION
-------------------------------------------------------------------
As you read the manual, you will occasionally see an
exclamation point [!] next to a paragraph. The exclamation
point means that that paragraph contains a caution or warning
you should observe when using the feature it discusses.
You will also see the symbol ## next to certain paragraphs.
This indicates an in-depth discussion or a more advanced topic
which you can skip if you wish to stick with the basics. Come
back to this topic later for more details, or if you're having
trouble with the particular issue it discusses. If you see
the ## next to a section heading, it means the entire section
contains such information.
You may find the information in such marked sections useful
even if you're relatively new to computers or to our products.
However, you can also skip the marked section and still
understand and use the basic topic of the larger section
you're reading.
This manual is divided into six chapters and two appendices,
plus a glossary and index. Here's a brief overview of what
you'll find in each:
Chapter 1 / General Concepts
This chapter is an introduction to several terms and
concepts that we use throughout the manual. If you're a
novice, you might want to browse through the entire
chapter. If you're a power user and all of the topics in
this chapter seem simple, then go on to the next chapter.
If you think you need to brush up a bit on the basics of
a couple of terms and ideas, you'll probably find them
here.
Chapter 2 / Conventions and Restrictions
This chapter contains information about three conventions
that are used throughout 4DOS, 4OS2, and 4DOS/NT: colors
and color names, color-coded directories, and keys and
key names. You'll find many references in the manual to
the information in this chapter. You may choose to read
through this chapter to see what is available, or refer
to the topics here when you come to a cross reference
later in the manual.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 3
INTRODUCTION
-------------------------------------------------------------------
Chapter 3 / Using 4DOS, 4OS2, and 4DOS/NT
This chapter is for everyone. It contains a description
of 4DOS, 4OS2, and 4DOS/NT features, and lots of examples
to help you learn to use each one. Even if you are a
novice user and want to ignore some of these features
until later, skim through this chapter to get an idea of
what is available and where to find the information that
you will eventually want. Our products offer both
features which are not related to specific commands, and
a complete set of over 80 internal commands. This
chapter has complete reference information on most of the
non-command features. Reference information on commands
is in Chapter 6.
Chapter 4 / Aliases and Batch Files
This chapter introduces two of the most powerful features
in 4DOS, 4OS2, and 4DOS/NT: Aliases and Batch Files.
You can use both to automate much of your computing work.
Even if you are a novice user, you should skim through
this chapter to see what is available. This chapter also
contains information about using environment variables,
and the internal variables and variable functions that
make aliases and batch files extremely powerful and
flexible.
Chapter 5 / Configuration
This chapter is for advanced users who want to be sure
that 4DOS, 4OS2, or 4DOS/NT is running at top efficiency
on their systems. It includes detailed information on
setting up your command processor and on changing its
configuration.
Chapter 6 / Command Reference
Each of our products offers over 80 internal commands.
This chapter explains the purpose of each command and
tells you how to use it. It has examples that will help
you learn each command and the technical details you will
need to get the command to behave exactly as you wish.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 4
INTRODUCTION
-------------------------------------------------------------------
Appendices
We've included some helpful tables here, as well as
information for those who like to know technical details.
There are two appendices.
Appendix A lists all error messages. Look here if you
need an explanation of an error message, or if you aren't
sure if the message came from 4DOS, 4OS2, or 4DOS/NT.
Appendix B lists codes for the ASCII character set (your
computer's internal method for representing letters,
digits, and other characters) and for the keys on your
keyboard. These codes can be useful with certain
commands.
Glossary
If you need help with any of the terminology in this
manual, look here.
Index
If you can't find the information you need, this should
help you find it.
Quick Reference
This quick index will give you the page number for
detailed information on each internal variable, variable
funtion, and .INI file directive.
Additional Files
Files distributed with 4DOS, 4OS2, and 4DOS/NT cover
important additional information beyond what's included
in this manual. README.DOC contains general notes,
highlights of the latest release, and brief installation
instructions for those upgrading from a downloaded copy
of 4DOS, 4OS2, or 4DOS/NT. MANMOD.DOC covers changes or
corrections in the manual, if any, and UPDATxxx.DOC
contains detailed information for users with older
versions on what has changed in the latest release ("xxx"
is the version number). For 4DOS users we also include
APPNOTES.DOC, which contains application notes for a
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 5
INTRODUCTION
-------------------------------------------------------------------
variety of other software packages to help you use those
packages with 4DOS.
Registration and Upgrade Information
If you purchased 4DOS, 4OS2, or 4DOS/NT from a software
dealer, your copy came with a registration card. Please fill
out this card and return it promptly to JP Software. It
ensures that we have a record of your registration so that we
can give you ongoing technical support and notices of
upgrades. If you purchased 4DOS, 4OS2, or 4DOS/NT directly
from JP Software, you are already registered and no
registration card is necessary.
Once you are a registered user, you will receive:
* A subscription to The Prompt Solution, JP Software's
customer newsletter. The Prompt Solution includes
tips for using 4DOS, 4OS2, and 4DOS/NT; notification
of upgrades; and information about other products from
JP Software.
* Technical support via electronic mail, fax, mail, or
telephone.
* A downloadable upgrade to the next version of 4DOS;
see below for details.
4DOS, 4OS2, and 4DOS/NT are upgraded regularly through
maintenance releases, designed to fix minor problems or
improve compatibility, and major upgrades which contain
enhancements and additional features. Maintenance releases
are identified by a change in the hundredths digit of the
version number, for example from 5.0 to 5.01 or 5.02. Major
upgrades are identified by a change in the tenths digit or
"ones" digit, for example from 5.0 to 5.1 or 6.0.
Major upgrades can be purchased from JP Software or your
dealer for a modest charge. For most users the first major
upgrade released after your initial purchase is available at
no charge if you download it from one of our support areas
(see below). You can also download maintenance releases from
one of the support areas, or order them on disk at a nominal
cost.
As a registered user, you will automatically be notified when
a major upgrade is released. We don't send out notices when
maintenance releases become available, because you don't
usually need them unless you're having a problem. If you call
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 6
INTRODUCTION
-------------------------------------------------------------------
with a problem that's been addressed in a maintenance release,
we'll mail you a copy on disk or assist you in downloading it.
As a registered user, you can download maintenance releases
and your first major upgrade from the JP Software support area
on CompuServe (GO PCVENB, library 10), or Channel 1 (see
below). If you are familiar with the Internet, you can also
obtain JP Software files via anonymous ftp from the 4DOS
directory on simtel20 or any of its mirrors.
The file names used for updates vary from time to time
depending on the extent of the changes made, but typically
will look like 4DOS5*.ZIP, 4OS22*.ZIP, etc. The "*" refers to
one or more characters further identifying the file. .ZIP
files are "archives" which contain many other files within
them. The files stored inside the .ZIP file are compressed
for more efficient downloads. To decompress the .ZIP file and
gain access to the actual 4DOS, 4OS2, or 4DOS/NT files you
will need the PKUNZIP program or an equivalent. Such programs
are available from the same source as the .ZIP files
themselves. Check the directory listings and file
descriptions on the service you are using to identify the
files you need.
Downloads are also available from many other local bulletin
boards and online services. Lists of download locations,
including bulletin boards outside the USA, are published from
time to time in The Prompt Solution and are included in the
SUPPORT.BBS file that comes with each product.
We offer BBS support through Channel 1 in Boston, one of the
largest and best-run bulletin boards in the US. Channel 1 is
an independent bulletin board and is not owned or operated by
JP Software. To access Channel 1 set your modem to any speed
from 2,400 to 14,400 baud, no parity, 8 data bits, and 1 stop
bit, and dial 617-354-5776. Join conference 5 for 4DOS
downloads. You can leave support messages and download files
at no charge, but if you want to use any of Channel 1's other
excellent services you may need to purchase a membership to
have sufficient online time.
Technical Support
Technical support is available via public electronic support
conferences, private electronic mail, telephone, fax, and
mail. When you contact us for support please give us your
serial number so that we can verify your status as a customer,
keep track of your inquiry, and contact you if necessary.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 7
INTRODUCTION
-------------------------------------------------------------------
Often the best way to contact us for support is in one of the
following public electronic support conferences. The numbers
in parentheses indicate the usual delay, in business days, to
receive a reply to a message.
CompuServe / ZiffNet: Primary support is via the JP Software
section of the CompuServe PCVENB forum (GO JPSOFT or GO
PCVENB, section 10, "JP Software") (1 day).
Bulletin Boards: Primary support is via the Channel 1 BBS,
Boston, MA (1 - 3 days; see above for access details).
Messages may be left in any of the 4DOS conferences; check the
online list for exact conference numbers. Support is also
available from many local BBSes via the 4DOS conferences on
the RIME, ILink, SmartNet, and FidoNet BBS Networks (3-5
days).
To contact JP Software for support by mail, telephone, fax, or
electronic mail, see our addresses and phone numbers on page
vi of this manual.
If you call for support and no technical support
representative is available, we will do our best to return
your call within 24 hours (weekends and holidays excluded).
If your problem is urgent and requires a faster response,
please let us know and we will try to accommodate you. If you
contact us by telephone and don't receive a reply within 24
hours, please try again. We may have tried to return your
call and been unable to reach you.
Before contacting us for support, please check the manuals and
other documentation for answers to your question. If you
can't find what you need, try the Index. If you're having
trouble getting 4DOS, 4OS2, or 4DOS/NT to run properly, either
alone or with your particular hardware or software, see the
Introduction and Installation Guide, and (for 4DOS) the
APPNOTES.DOC file on your disk. Also look through the
README.DOC and UPDATxxx.DOC files, as they may contain updates
to this manual or other important information ("xxx" is the
version number).
If you do need to contact us for support, it helps if you can
give us some basic information:
* What exactly did you do? A concise description of
what steps you must take to make the problem appear is
much more useful than a long analysis of what might be
happening.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 8
INTRODUCTION
-------------------------------------------------------------------
* What went wrong? At what point did the failure occur?
If you saw an error message or other important or
unusual information on the screen, what exactly did it
say?
* Briefly, what techniques did you use to try to resolve
the problem? What results did you get?
* What computer and operating system are you using?
* Are you running a network, or using a particular
operating environment (such as DESQview or Windows)?
* What are the contents of any startup files you use
(such as CONFIG.SYS, AUTOEXEC.BAT, 4START, 4EXIT, and
the .INI file), any batch files they call, and any
alias or environment variable files they load?
* Can you repeat the problem or does it occur randomly?
If it's random, does it seem related to the programs
you're using when the problem occurs?
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 9
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
CHAPTER 1 / GENERAL CONCEPTS
You can start using 4DOS, 4OS2, or 4DOS/NT as soon as you finish
installing it, because each of our products is compatible with the
traditional commands you're used to. But most users find that the
more they know about their computer systems, the more power they
get from our products. And, the more experience they gain, the
more they want to know about their computer system as a whole.
This section of the manual explains some fundamental concepts about
your computer, operating system, and 4DOS, 4OS2, and 4DOS/NT. It
should help you understand the terms and concepts in the pages that
follow. If you find some of the concepts overwhelming, just
remember that they are here when you need them. If you find this
material too simple, skim over the topics and then go on to the
next section. Each topic in this chapter is independent, so if you
read it straight through you won't necessarily find a natural
"flow" from one topic to another.
If you come across terms or concepts in this chapter that you are
unsure about, refer to the Glossary on page 381 or the Index.
Operating Systems and Command Processors
This section explains briefly what an operating system is,
what a command processor is, and how the command processor
works under DOS, OS/2, and Windows NT.
An operating system is nothing more than a collection of
software. However, unlike application software, which
performs a specific, user-oriented task (such as creating and
printing documents, or performing calculations on rows and
columns of numbers), operating system software is designed to
perform some special functions. The operating system
typically:
* Starts the computer system. The operating system is
the first software loaded when you turn on the
computer.
* Provides services to other software. These include
basic file access, assignment of your computer's
memory for use by different programs, and the control
of hardware devices like the keyboard, display,
printer, and serial ports.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 10
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
* Ensures that programs don't interfere with each other
while they are running.
* Provides a way for you to start programs to do your
work.
* Includes utilities to control and manage your system,
for example to organize disks and files, display
status information, or adjust your system for
international conventions.
More complex operating systems may include many more
functions, such as built-in network connections, the ability
to switch rapidly between many tasks, support for high-quality
sound output, and so on.
Our products run under the DOS, OS/2, and Windows NT operating
systems.
Each of these operating systems includes a command processor:
a program that accepts your instructions and carries them out.
The basic operation of a command processor is very simple: It
prompts you for a command, you type in the command, the
command processor executes it, and the cycle repeats. This
sometimes called a "command line" interface, because commands
are typically executed line by line.
Under DOS, the command-line interface is the only way to tell
the operating system what you want it to do. OS/2 and Windows
NT each include a graphical user interface that is intended to
replace the command line as the primary method for providing
instructions to the operating system. However, most OS/2 and
Windows NT users find that the command line is required for
some tasks, and much more efficient for many others. They
therefore use both the graphical interface and the command
line, depending on the task at hand.
The command processor shipped with DOS is called COMMAND.COM.
The command processors shipped with OS/2 and Windows NT are
both called CMD.EXE.
When you install 4DOS, 4DOS.COM replaces COMMAND.COM as your
command processor. 4OS2 replaces the OS/2 version of CMD.EXE
with 4OS2.EXE, and 4DOS/NT replaces the Windows NT version of
CMD.EXE with 4NT.EXE. All of these command processors are
normal programs that know how to translate your commands into
actions. 4DOS, 4OS2, and 4DOS/NT are simply much more
powerful command processors than those supplied with each
operating system.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 11
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
4DOS Under DOS, the command processor is started automatically at
the end of the boot process. If you don't want to use
COMMAND.COM as your command processor, you use the SHELL
statement in CONFIG.SYS to specify a different command
processor.
4OS2 Under OS/2, the command processor is started whenever you
select the appropriate object on your OS/2 desktop. If you
don't want to use CMD.EXE as your command processor, you use
the SET OS2_SHELL statement in CONFIG.SYS to specify a
different command processor. Because OS/2 includes the
ability to run DOS programs, it also includes a copy of
COMMAND.COM as its default DOS command processor. You can
change to a different DOS command processor with the SHELL
statement in the OS/2 CONFIG.SYS file.
4NT Under Windows NT, there is no CONFIG.SYS file, and no special
way to specify a default command processor. Instead, you
simply create a desktop object for any command processor you
want to use.
Primary and Secondary Shells
Technically, the command processor is a shell: a program that
understands your commands and makes the correct calls to the
underlying operating system to perform various tasks,
including running programs.
4DOS Under DOS, the command processor that runs when the computer
boots up, or when an OS/2 DOS session starts, is called the
primary shell.
Any command processor that is started as a "child" to a
primary shell is a secondary shell. Typically, secondary
shells are started by application programs with a "shell to
the command prompt" feature, and by multitasking environments
like Windows or DESQView. A secondary shell has most of the
same features as a primary shell.
There are a few differences between primary and secondary
shells under DOS. Generally, less memory is available when a
secondary shell is running, because at least part of the
program that started it is still in memory waiting to spring
back to life when you exit. And normally only the primary
shell automatically executes the instructions in your
AUTOEXEC.BAT file.
Under DOS you can leave a secondary shell with the EXIT
command, but there is normally no way to exit from the primary
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 12
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
shell, because DOS requires a shell present to operate.
However, if you are running 4DOS in a DOS session under OS/2
version 2.0 or later you can use EXIT in the primary DOS shell
to close the session and return to the OS/2 desktop.
4OS2, Under OS/2 and Windows NT, each 4OS2 or 4DOS/NT session that
4NT is started from the desktop is a primary shell. Secondary
shells are started by applications with a "shell to the
command prompt" feature, and are also used for a special kind
of communication between programs called a pipe (see page 55).
Under 4OS2 and 4DOS/NT, you can exit from both primary and
secondary shells. When you exit from a primary shell, the
command processor session is closed and you are returned to
the desktop.
You may also see the term shell used to describe programs
which assist you in managing your files (for example XTree or
Lotus Magellan for DOS, or Norton Commander for OS/2). This
is a different and less precise meaning of "shell" than the
one used above and elsewhere in this manual. Such programs
are also sometimes called "visual shells" because they use a
menu or graphical interface to receive commands. Unlike 4DOS,
4OS2, and 4DOS/NT, these programs are not command processors,
and cannot replace COMMAND.COM or CMD.EXE.
Each time 4DOS, 4OS2, or 4DOS/NT starts as either a primary or
secondary shell, it looks for and executes one or more
"automatic" batch files. These files are explained on page
. 85
Files and Directories
You may have dozens, hundreds, or thousands of files stored on
your computer's disks. Your operating system is responsible
for managing all of these files. In order to do so, it uses a
unique name to locate each file in much the same way that the
post office assigns a unique address to every residence.
The unique name of any file is composed of a drive letter, a
directory path, and a filename. Each of these parts of the
file's name is case insensitive; you can mix upper and lower
case letters in any way you wish.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 13
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
Drives and Volumes
A drive letter designates which drive contains the file. In a
file's full name, the drive letter is followed by a colon.
Drive letters A: and B: are normally reserved for the floppy
disk drives. (Systems with a single drive use both A: and B:
for that drive. The operating system asks you to swap
diskettes as necessary to turn that single physical drive into
two separate logical disk drives.)
Normally, drive C: is the first (or only) hard disk drive.
Later versions of DOS, some DOS-based utility programs, and
both OS/2 and Windows NT can divide a large hard disk into
multiple logical drives or volumes that are usually called C:,
D:, E:, etc. Also, the DOS and Windows NT utility SUBST lets
you use drive letters as a substitute for directory names.
Many network systems (LANs) use a similar feature to give
drive letters to sections of the network file server drives.
Some computers also have "RAM disks" (sometimes called
"virtual disks"), which are areas of memory set aside by
software (a "RAM disk driver") for use as fast but temporary
storage. RAM disks are also assigned drive letters, typically
using letters beyond that used by the last hard disk in the
system, but before any network drives. For example, on a
system with a large hard disk you might have A: and B: as
floppy drives, C:, D:, and E: as parts of the hard disk, F: as
a RAM disk, and G: and H: as network drives.
File Systems
Each disk volume is organized according to a file system. The
file system determines how files are named and how they are
organized on the disk. The DOS file system uses a File
Allocation Table or FAT to keep track of each file, and
therefore it is often called a FAT file system. Both OS/2 and
Windows NT also include support for the traditional FAT file
system.
OS/2 also supports the High Performance File System or HPFS.
Windows NT can work with HPFS disk volumes plus volumes
formatted with its own file system, which is called NTFS.
The file system type (FAT, HPFS, or NTFS) is determined when a
hard disk volume is formatted and applies to the entire
volume. For example, you might have a 200 MB hard disk
divided into four 50 MB volumes, with the first three volumes
(C:, D:, and E:) formatted for the FAT file system, and the
fourth formatted for HPFS or NTFS.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 14
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
When you are using DOS, only files on FAT volumes are visible
and available. HPFS and NTFS volumes are completely
inaccessible. If you boot your system under OS/2, you can
access FAT and HPFS volumes, both from OS/2 itself and from
DOS sessions running under OS/2 (DOS sessions can only access
files with FAT-compatible names; see page 17 for details). If
you boot under Windows NT, you can access FAT, HPFS, and NTFS
volumes.
4NT Files on an NTFS volume have both a "long" and a "short" or FAT-
compatible file name. You can view the short file name with
the DIR /X command. If you use 4DOS/NT to COPY or MOVE files
from an NTFS volume to a FAT volume, the files will saved with
their short, FAT-compatible names. Beginning with version 3.5,
Windows NT supports the use of long filenames even on FAT
drives; see page 18 for additional details.
4OS2 Finally, OS/2 also supports installable file systems, which
are installed with the IFS= directive in the OS/2 CONFIG.SYS
file. The CD-ROM file system supplied with OS/2 2.x is an
example of an installable file system, and many OS/2 networks
are also implemented as installable file systems.
Directories and Subdirectories
A file system is a method of organizing all of the files on an
entire disk or hard disk volume. Directories are used to
divide the files on a disk into logical groups that are easy
to work with. Their purpose is similar to the use of file
drawers to contain groups of hanging folders, hanging folders
to contain smaller manila folders, and so on.
Every drive has a root or base directory, and many have one or
more subdirectories. Subdirectories can also have
subdirectories, extending in a branching tree structure from
the root directory. The collection of all directories on a
drive is often called the directory tree, and a portion of the
tree is sometimes called a subtree. The terms directory and
subdirectory are typically used interchangeably to mean a
single subdirectory within this tree structure.
Subdirectory names follow the same naming rules as files in
each operating system (see below). However, under DOS it is
best to use a name of 8 characters or less, without an
extension, when naming subdirectories, because some
application programs do not properly handle subdirectory names
that have an extension.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 15
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
The drive and subdirectory portion of a file's name are
collectively called the file's path. For example, the file
name C:\DIR1\DIR2\MYFILE.DAT says to look for the file
MYFILE.DAT in the subdirectory DIR2 which is part of the
subdirectory DIR1 which is on drive C. The path for
MYFILE.DAT is C:\DIR1\DIR2. The backslashes between
subdirectory names are required. The total length of a file's
path may not exceed 64 characters in DOS, and on FAT volumes
under OS/2 and Windows NT. (This limit excludes the file name
and extension, but includes the drive letter and colon). On
HPFS and NTFS volumes, the path and file name must each be 255
characters or less in length, and in addition the total length
of the path and file name together cannot exceed 260
characters.
The operating system and command processor remember both a
current or default drive for your system as a whole, and a
current or default directory for every drive in your system.
Whenever a program tries to create or access a file without
specifying the file's path, the operating system uses the
current drive (if no other drive is specified) and the current
directory (if no other directory path is specified).
The root directory is named using the drive letter and a
single backslash. For example, D:\ refers to the root
directory of drive D:. Using a drive letter with no directory
name at all refers to the current directory on the specified
drive. For example, E:4DOS.DOC refers to the file 4DOS.DOC in
the current directory on drive E:.
There are also two special subdirectory names that are useful
in many situations: a single period [.] by itself means "the
current default directory." Two periods together [..] means
"the directory which contains the current default directory"
(often referred to as the parent directory). These special
names can be used wherever a full directory name can be used.
4DOS, 4OS2, and 4DOS/NT allow you to use additional periods to
specify directories further "up" the tree (see page 59).
File Names
Finally, each file has a filename. Under the FAT file system,
the filename consists of a base name of 1 to 8 characters plus
an optional extension composed of a period plus 1 to 3 more
characters. You can use alphabetic and numeric characters
plus the punctuation marks ! # $ % & ' ( ) - @ ^ _ ` { } and ~
in both the base name and the extension. Because the
exclamation point [!], percent sign [%], caret [^], at sign
[@], parentheses [()], and back-quote [`] also have other
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 16
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
meanings to 4DOS, 4OS2, and 4DOS/NT, it is best to avoid using
them in filenames.
The HPFS file system, which can be used under OS/2 and Windows
NT, allows file names with a maximum of 255 characters,
including spaces and other characters that are not allowed in
a FAT system file name, but excluding some punctuation
characters which are allowed in FAT file names. See your
operating system documentation for details on the characters
allowed. If you use HPFS filenames which contain semicolons
[;], see page 62 for details on avoiding problems with
interpretation of the semicolon under 4OS2 and 4DOS/NT.
The NTFS file system which can be used under Windows NT also
allows file names with a maximum of 255 characters.
HPFS and NTFS filenames, and all filenames under Windows NT
3.5 and above, are stored and displayed exactly as you entered
them, and are not automatically shifted to upper or lower case.
For example, you could create a file called MYFILE, myfile, or
MyFile, and each name would be stored in the directory just as
you entered it. However, case is ignored when looking for
filenames, so you cannot have two files whose names differ
only in case (i.e., the three names given above would all
refer to the same file). This behavior is sometimes described
as "case- retentive but not case-sensitive" because the case
information is retained, but does not affect access to the
files.
Files stored on HPFS and NTFS volumes often have "FAT-
compatible" names: names which contain only those characters
legal on a FAT volume, and which meet the 8-character name /
3-character extension limits. Programs which cannot handle
the long names supported by HPFS and NTFS (for example, DOS
programs running under OS/2) generally can access files with
FAT-compatible names.
4DOS 4DOS is compatible with FAT volumes. When running in a DOS
session under OS/2, 4DOS can also access files on HPFS volumes
and installable file system volumes (see below), provided the
files have FAT-compatible names. Files on such volumes which
do not have FAT-compatible names will be invisible to 4DOS.
If an HPFS or NTFS-compatible file name includes spaces or
other characters that would not be allowed in a FAT name, you
must place double quotes around the entire name. For example,
suppose you have a file named LET3 on a FAT volume, and you
want to copy it to the LETTERS directory on drive F:, an HPFS
partition, and give it the name Letter To Sara. To do so, use
either of these commands in 4OS2 or 4DOS/NT:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 17
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
[c:\wp] copy let3 f:\LETTERS\"Letter To Sara"
[c:\wp] copy let3 "f:\LETTERS\Letter To Sara"
HPFS and NTFS do not explicitly define an "extension" for file
names which are not FAT-compatible. However, the convention
used by 4OS2 and 4DOS/NT (and by CMD.EXE) is to treat all
characters after the last period in the file name as the
extension. For example, the file name "Letter to Sara" has no
extension, whereas the name "Letter.to.Sara" has the extension
Sara.
4NT Beginning with version 3.5, Windows NT supports the use of
long filenames even on FAT drives. 4DOS/NT will take this
difference into account automatically under Windows NT 3.5 and
above. For example, COPY will retain long filenames if
possible when copying files to a FAT drive, and DIR will use
the HPFS / NTFS display format which accommodates long
filenames on all drives by default.
As a result of this change in Windows NT, for compatibility
4DOS/NT assumes that all file and directory names retain their
case under Windows NT 3.5 and above, even on FAT drives
(normally this assumption is made only for HPFS and NTFS
drives; see page 17 above for details).
File Attributes
Each file also has attributes which define characteristics of
the file which may be useful to the operating system, to you,
or to an application program. Attributes can be set with the
ATTRIB command (see page 173) and viewed with the ATTRIB and
DIR commands.
Every time a program modifies a file, the operating system
sets the Archive attribute, which signals that the file has
been modified since it was last backed up. This can be used
by 4DOS, 4OS2, or 4DOS/NT to determine which files to COPY,
and by backup programs to determine which files to back up.
When the Read-only attribute is set, the file can't be changed
or erased; this can be used to protect important files from
damage. The Hidden and System attributes prevent the file
from appearing in normal directory listings. The DIR command
(see page 204) has options which allow you to select filenames
to view based on their attributes, to view the attributes
themselves, and to view information about normally "invisible"
hidden and system files.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 18
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
When a file is created, and every time it is modified, the
operating system records the system time and date in a time
stamp in the file's directory entry. Several 4DOS, 4OS2, and
4DOS/NT commands and variable functions, and many backup and
utility programs, use this time stamp to determine the
relative ages of files.
Internal and External Commands
Whenever you type something at the command line and press the
Enter key, you have given a command to the command processor,
which must figure out how to execute your command. If you
understand the general process that 4DOS, 4OS2, and 4DOS/NT
use, you will be able to make the best use of them and their
commands.
The command processor begins by dividing the line you typed
into a command name and a command tail. The command name is
the first word in the command; the tail is everything that
follows the command name. For example, in this command line:
dir *.txt /2/p/v
the command name is "dir", and the command tail is " *.txt
/2/p/v."
If the command name is not an alias (see page 77), the command
processor tries to find the name in its list of internal
commands. An internal command is one that the command
processor can perform itself, without running another program.
DIR and COPY are examples of internal commands.
If the command name is not found in the command processor's
list of internal commands, it assumes that it must find and
execute an external command. This means that the command
processor must load and run a separate program, either an
executable program or a batch file. DOS, OS/2, and Windows NT
are shipped with a number of external utility programs (such
as FORMAT and DISKCOPY), and any program or application you
install on your system becomes a new external command.
The advantage of internal commands is that they run almost
instantly. When you give an internal command, the command
processor interprets the command line and carries out the
necessary activities without having to look for, load, and run
another program.
The advantage of external commands is that they can be large,
varied, and complex without taking space inside the system
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 19
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
command processor. External commands can also be renamed or
replaced easily. If you want to rename the external DOS
command XCOPY to MYCOPY, for example, all you need to do is
find the file called XCOPY.EXE on your DOS disk or directory
and change its name to MYCOPY.EXE. If you want to replace
XCOPY with a more efficient program, you can do so. 4DOS,
4OS2, and 4DOS/NT add this flexibility to internal commands.
You can rename or replace any internal command by using an
alias (see pages 77 and 161), and you can enable or disable
internal commands whenever you wish (see SETDOS /I on page
324).
Executable Files and File Searches
Once the command processor knows that it is supposed to run an
external command, it tries to find an executable file (one
with a .COM or .EXE extension) whose name matches the command
name. It runs the executable file if it finds one. (See the
previous section for more information on external commands.)
If the command processor cannot find an external program to
run, it next looks for a batch file (a file with one or more
commands in it) whose name matches the command name. 4DOS
recognizes a file as a batch file if its extension is .BAT or
.BTM. 4OS2 recognizes .CMD, .BTM, and .BAT as batch file
extensions. It will run .CMD and .BTM files itself, and will
start a DOS session to run .BAT files. 4DOS/NT can run batch
files with a .BAT, .CMD, or .BTM extension. If the command
processor finds such a file, it then reads each line in the
file as a new command.
If the search for a batch file fails, the command processor
checks to see if the command name matches the name of a file
with an extension that you have defined as executable. If a
match is found, the command processor runs the program you
specified when you defined the executable extension.
(Executable extensions are used to associate file extensions
with the specific program that processes a particular type of
file; see page 68 for details).
4DOS, 4OS2, and 4DOS/NT first search for an executable
program, a batch file, and a file with an executable extension
in the current directory. If the command name doesn't match a
.COM, .EXE, .BTM, .BAT or .CMD file or an executable extension
in the current directory, the command processor repeats its
search in every directory in your search path.
The search path is a list of directories that the command
processor (and some applications) search for executable files.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 20
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
For example, if you wanted the command processor to search the
root directory of the C: drive, the \DOS subdirectory on the
C: drive, and the \UTIL directory on the D: drive for
executable files, your search path would look like this:
PATH=C:\;C:\DOS;C:\UTIL
Notice that the directory names in the search path are
separated by semicolons.
You can create or view the search path with the PATH command
(see page 290). You can use the ESET command (see page 227)
to edit the path. Many programs also use the search path to
find their own files. The search path is stored in the
environment with the name PATH.
Remember, the command processor always looks for an executable
file or a file with an executable extension first in the
current subdirectory, and then in each directory in the search
path. (You can change the search order so the current
directory is not searched first; see the PATH command for
details.)
If you include an extension as part of the command name, the
command processor only searches for a file with that
extension. For example, if you enter the command WP, 4DOS,
4OS2, or 4DOS/NT will search for any executable file whose
base name is WP. However, if you enter WP.EXE as the command
name, the command processor will search the current directory
and each directory in your search path for WP.EXE, but will
not look for files with other extensions.
If the command processor cannot find an executable file, batch
program, or a file with an executable extension in the current
directory or any directory in the search path, it looks for an
alias called UNKNOWN_CMD (see ALIAS on page 161 for details).
If you have defined an alias with that name, it is executed.
Otherwise, the command processor displays an "Unknown command"
error message and waits for your next instruction.
The Environment
The command processor allows you to keep a list of information
in memory. This list is called the environment. Every
program receives a copy of the environment when it begins, and
many programs use some of its information to configure
themselves or to find files.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 21
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
The environment is arranged as a series of variables and their
related values. Each variable is a name stored in upper case.
The name is followed by an equal sign [=] and some text. You
can view the environment by typing SET, and add new entries or
edit existing entries with the SET and ESET commands. You can
erase entries in the environment with both the UNSET and SET
commands.
A typical environment entry looks like this:
LIB=c:\lib
In this example, the name of the variable is "LIB" and its
value is "c:\lib". The text string or value can include any
characters except nulls (ASCII 0).
The format and meaning of each entry in the environment is up
to the program that uses the particular variable. Environment
variables can contain just about anything, and can be used for
any purpose the author of a program desires. The "purpose" of
the environment as a whole is simply to hold small amounts of
text which programs can then access according to their own
rules. Most environment variables are used by single programs
for their own information; a few have well-defined meanings
and are used by many different programs.
4DOS, 4OS2, and 4DOS/NT use several environment variables to
control their own behavior. They also provide a wide range of
facilities for manipulating and managing the environment. See
"Using the Environment" beginning on page 96 for details about
these special variables, the size of the environment, and
other environment-related features.
ASCII and Key Codes
Internally, computers use numbers for everything. To
represent the text that you type, a computer must translate
each letter to and from a number. For all PC-compatible
computers, the code used for this translation is called ASCII
(American Standard Code for Information Interchange). ASCII
codes are used both for the characters you type and for the
characters that are displayed on the screen.
The original ASCII code has 128 values for upper and lower
case letters, numerals, punctuation marks, and control codes
(control codes correspond to pressing the Ctrl key plus
another character). Some control codes are represented on the
keyboard with such keys as Tab, Enter, Backspace, and Esc.
IBM, in its original PC, defined an additional 128 extended
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 22
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
ASCII codes for math symbols, international characters, the
line characters used to draw boxes, and some miscellaneous
symbols. You can enter extended ASCII codes on the keyboard
by holding down the Alt key while you type the code number on
the numeric key pad.
The symbol that the computer displays for each ASCII and
extended ASCII code, and the code generated by each key on the
keyboard, depends in part on the country and language support
that your computer is configured to use. Through the use of
code pages in DOS and OS/2, and the Registry in Windows NT,
your computer can be configured for use in most countries.
See your operating system documentation for more information
about country and language support.
Do not confuse extended ASCII with extended key codes. The
latter include special codes that the computer generates when
you press a function key, cursor key, or Alt plus a letter
(see below). Those keys do not have any representation in
either the ASCII or extended ASCII code systems. Another set
of key codes, called scan codes, is discussed in the section
on the keyboard below.
Appendix B on page 371 has a complete list of ASCII, extended
ASCII, and extended key codes.
The Keyboard
When you press a single key or a key combination on the
keyboard, the computer translates your keystroke into two
numbers. For all alphabetic, numeric, and punctuation keys,
the Tab, Enter, Backspace, Esc keys and Ctrl plus an
alphabetic key, these numbers are an ASCII code plus a scan
code. The ASCII code represents the key's meaning; the scan
code identifies which specific key was pressed. For example,
many keyboards have two plus [+] keys, one above the equal
sign and one on the numeric keypad. Both generate the same
ASCII code, but they generate different scan codes.
Keys which are not represented by ASCII codes are translated
to an ASCII 0 plus an extended key code. These keys include
the function keys, the cursor keys, and Alt plus a key. The
extended key code for a key is generally the same as the scan
code for that key.
Some keys, like the Alt, Ctrl, and Shift by themselves or in
combination with each other, plus Print Screen, SysReq, Scroll
Lock, Pause, Break, Num Lock, and Caps Lock, do not have any
code representations at all. The computer performs special
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 23
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
actions automatically when you press these keys (for example,
it switches your keyboard into Caps Lock mode when you press
the Caps Lock key), and does not report the keystrokes to
whatever program is running unless the program has been
written specially to accept them.
Appendix B has a complete list of ASCII and scan codes for the
keys on most keyboards.
Video
4DOS, 4OS2, and 4DOS/NT are "character-based" programs, which
means they work in text mode on your computer. In text mode,
the screen or window used by the program displays text in a
single, fixed-pitch font (a font where every character is the
same width), but cannot mix fonts or display graphics. All
three command processors can run graphics programs which
change your screen to graphics mode, but the screen must be
returned to text mode whenever the command processor is
active. In the early days of the IBM PC, text mode was a
single, simple video operating environment. Today, advanced
video boards and video software have created a wide range of
text modes.
The original IBM PC monochrome and CGA color video cards can
display 80 columns and 25 rows of text. Newer, advanced video
systems normally run in this 80 x 25 display mode but can also
display more columns and rows. For example, EGA video cards
can display 43 rows of text and VGA video cards can display 50
rows. With special driver programs, a VGA can display 60 rows
or more and up to 132 columns of text. Each of these
different screen configurations is a different text mode.
In addition to running in a variety of text modes, 4DOS, 4OS2,
and 4DOS/NT can run in "normal" full-screen mode or in a
window inside a graphical environment such as the Windows or
Windows NT desktop, or the OS/2 Workplace Shell. When they
run in such a window, they are still operating in text mode.
The underlying graphical environment translates their text
commands into the appropriate graphics for your video display.
4DOS, 4OS2, and 4DOS/NT support whatever number of rows and
columns of text you decide to use. They don't have commands
to switch from one screen size to another - you will need to
use the software that came with your computer or video board
to do that - but they can read and work with the number of
rows and columns on your screen.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 24
CHAPTER 1 / GENERAL CONCEPTS
-------------------------------------------------------------------
ANSI Drivers
4DOS Every version of DOS includes a program called ANSI.SYS. This
program lets you use text colors other than drab white on
black, redefine keys, and control screen output. Commercial
ANSI drivers are available as replacements for ANSI.SYS. The
commercial programs usually include many new features, boost
screen display speed dramatically, and support text displays
that have more than 80 columns and 25 lines.
In most cases, 4DOS automatically determines whether you have
an ANSI driver installed (if the automatic determination does
not work on your system you can set the ANSI state manually).
If you do have an ANSI driver installed, 4DOS will use the
driver to clear the screen and set screen colors.
4OS2 OS/2 includes ANSI support for character mode sessions. 4OS2
enables this feature when it starts, and assumes that it
remains enabled. You can turn off ANSI support with OS/2's
external ANSI command (ANSI.EXE). If you do, however, 4OS2
will not notice the change and will display unusual characters
or ignore colors in your CLS and COLOR commands.
4NT There is no provision for ANSI support in Windows NT, and
4DOS/NT always assumes that no ANSI driver is present.
Several 4DOS, 4OS2, and 4DOS/NT commands provide replacements
for traditional ANSI commands. For example, there are
commands to set the screen colors and display text in specific
colors. These commands are easier to understand and use than
the traditional ANSI control sequences. Some of these
commands manipulate screen colors directly. Others use an
ANSI driver if one is installed (under 4DOS) or expected
(under 4OS2), but save you the work of figuring out complex
ANSI control sequences. Any special interaction between 4DOS
or 4OS2 and the ANSI driver is described in the documentation
for each command.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 25
CHAPTER 2 / CONVENTIONS
-------------------------------------------------------------------
CHAPTER 2 / CONVENTIONS
This chapter contains information about three conventions that are
used throughout 4DOS, 4OS2, and 4DOS/NT: colors and color names,
color-coded directories, and keys and key names. These topics are
combined here in a central reference spot so that they will be easy
to find when you need to refer to them. You will find cross
references to this chapter in several other parts of this manual.
Colors and Color Names
You can use color names in several of the directives in the
.INI file and in many commands. The general form of a color
name is:
[BRIght] [BLInk] fg ON [BRIght] bg [BORder bc]
where fg is the foreground or text color, bg is the background
color, and bc is the border color.
The available colors are:
Black Blue Green Red
Magenta Cyan Yellow White
Color names and the words BRIght, BLInk, and BORder may be
shortened to the first 3 letters. BORder is valid only in
4DOS and 4OS2.
You can also specify colors by number instead of by name. The
numbers are most useful in potentially long INI file
directives like ColorDir. The following numbers are
recognized:
0 - Black 8 - Gray (bright black)
1 - Blue 9 - Bright blue
2 - Green 10 - Bright green
3 - Cyan 11 - Bright cyan
4 - Red 12 - Bright red
5 - Magenta 13 - Bright magenta
6 - Yellow 14 - Bright yellow
7 - White 15 - Bright white
Use one number to substitute for the [BRIght] fg portion of
the color name, and a second to substitute for the [BRIght] bg
portion. For example, instead of bright cyan on blue you
could use 11 on 1 to save space in a ColorDir specification.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 26
CHAPTER 2 / CONVENTIONS
-------------------------------------------------------------------
There are several subtleties that complicate the use of colors
and color names. In order to understand them, you will need
to read through the restrictions described below. You may
also want to review the Video section in the previous chapter
(see page 24). These restrictions are due to the design of
your PC video hardware, BIOS, and video drivers, and are not
inherent in 4DOS, 4OS2, or 4DOS/NT. Some of the restrictions
are complex, so feel free to skip over those that do not apply
to color combinations you use.
Some restrictions depend on the display "mode." 4DOS, 4OS2,
and 4DOS/NT can run in either normal display mode, when the
command processor is using the full screen and has more direct
control over the video hardware; or in windowed display mode,
when the command processor appears in a window as part of a
graphical display under Windows 3.x, OS/2, or Windows NT.
Monochrome Video Adapters
If you have a monochrome video adapter, you cannot display any
colors except white and black in either normal or bright
intensity. If you have a color video adapter, you can use any
of the standard colors listed above (provided you meet the
other restrictions below).
Color Errors
A standard color specification allows sixteen foreground and
eight background colors (sixteen if bright backgrounds are
enabled, see below). However, most video adapters and
monitors do not provide true renditions of certain colors.
For example, most users see normal "yellow" as brown, and
bright yellow as yellow; many also see normal red as red, and
"bright red" as pink. Color errors are often much worse when
running in windowed mode (see above), because the graphical
environment that created the window may not map the text-mode
colors the way you expect. These problems are inherent in the
monitor, video adapter, and driver software. They cannot be
corrected using 4DOS, 4OS2, or 4DOS/NT color specifications.
Border Colors
In order to use border colors, you must have a color video
adapter (monochrome adapters do not support border colors).
4NT 4DOS/NT does not support border colors, and will ignore the
BORder keyword.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 27
CHAPTER 2 / CONVENTIONS
-------------------------------------------------------------------
4DOS, 4DOS and 4OS2 can only accept border colors in the CLS and
COLOR
4OS2 commands, and in the StdColors directive in the .INI file.
Border colors will be ignored, or will cause an error, if they
are used elsewhere.
Border colors do not work in windowed mode, and will be
ignored if used in a windowed session under Windows or OS/2.
Blinking Text and Bright Background Colors
The interactions between blinking characters, bright
backgrounds, and your display mode can be complex. You will
need to understand them if you use either attribute in your
color specifications.
Bright background colors are only available if you have an
EGA- or VGA-compatible display adapter. If you have a
monochrome or CGA adapter, you can use blinking displays and
ignore the interactions described below.
The effects of blinking and bright background color
specifications depend partly on whether you are in normal or
windowed display mode.
Normal Display Mode
In normal, full-screen display mode your video hardware can be
configured via software commands to display either blinking
text, or text with a bright background, but not both. This is
due to the design of PC video hardware, and is not a software
restriction.
The memory on your video adapter includes a "flag" for each
character on the screen. The flag controls blinking text and
bright background colors. If the flag is off, the character
is displayed with a normal background and does not blink. If
the flag is "on," the character either blinks or is displayed
with a bright background, depending on which way your video
adapter is currently configured.
4DOS, In normal display mode, the configuration of your video
4OS2 adapter can be controlled by 4DOS and 4OS2 with the BrightBG
directive in the 4DOS.INI file (see page 141) or the SETDOS /B
command (page 323). If you set BrightBG = No or use the
SETDOS /B0 command, 4DOS and 4OS2 will configure the video
adapter for blinking text, and characters with the blink /
bright background flag set will blink. If you set BrightBG =
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 28
CHAPTER 2 / CONVENTIONS
-------------------------------------------------------------------
Yes or use SETDOS /B1, 4DOS and 4OS2 will configure the video
adapter for bright background colors, and the characters will
be displayed with a bright background instead.
4NT BrightBG and SETDOS /B are not available under 4DOS/NT,
because Windows NT always enables bright backgrounds and
disables blinking text.
Because there is only one flag for each character to specify
both blinking text and bright background color, it doesn't
matter which attribute you use when you specify the color.
Whether you specify blinking text or a bright background, you
will see the same thing on your screen. For example, these
two COLOR commands will always produce the same results:
color blink white on blue
color white on bright blue
If bright backgrounds are enabled, both commands will produce
white text on a bright blue background. If blinking text is
enabled, both commands will produce blinking white text on a
blue background.
If you don't use BrightBG or SETDOS /B, 4DOS and 4OS2 will not
attempt to configure your video hardware. Most video adapters
default to blinking text in normal mode, but this can be
changed by application programs. If you use BrightBG or
SETDOS /B, 4DOS and 4OS2 will configure the hardware each time
they display the prompt.
The method used to adjust the video hardware may not be
compatible with all video cards. If you see screen "flashes"
at each prompt when you use BrightBG or SETDOS /B, discontinue
using both commands. This problem is very rare and is not
likely to occur on standard EGA and VGA systems.
Windowed Mode
In windowed mode, the command processor cannot control your
hardware to select blinking or bright backgrounds. Instead,
Windows, OS/2, and Windows NT all display bright background
colors, regardless of the BrightBG or SETDOS /B setting. They
do not provide a way to display blinking characters in
windowed mode. As an example, the two commands given above
would both display white text on a bright blue background when
run in windowed mode.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 29
CHAPTER 2 / CONVENTIONS
-------------------------------------------------------------------
Switching Modes
Windows and OS/2 allow you to switch any DOS session between
full-screen and windowed mode; Windows NT allows you to switch
modes for any console (non-graphical) session. For example,
when running 4DOS in a DOS session under Windows, you can
switch modes by pressing Alt-Enter. Switching modes will
usually alter color rendition, as you switch between direct
interaction with the video board (in full-screen mode) and the
color mapping provided by your graphical environment (in
windowed mode). In addition, switching modes may alter the
display of blinking text and bright background characters.
4DOS Under 4DOS, if BrightBG is set to Yes, bright background
colors will be preserved when you switch modes. However, if
BrightBG is set to No, the display will shift from blinking
text in the full-screen mode to bright background colors
behind that text in the windowed mode. This effect can be
disturbing; you may need to take it into account if you write
batch files or aliases which may be used in either mode.
4OS2 You cannot switch modes for OS/2 sessions, so 4OS2 is not
directly affected by mode switching. However, if you write
batch files or aliases which run in both modes, you may need
to take into account that OS/2 defaults to displaying blinking
text in full-screen mode and bright backgrounds in windowed
mode.
Color-Coded Directories
The DIR and SELECT commands can display each file name in a
different color, depending on the file's extension.
To choose the DIR and SELECT display colors, you must either
use the SET command to create an environment variable called
COLORDIR, or use the ColorDir directive in your .INI file.
If you do not use the COLORDIR variable or the ColorDir
directive, DIR will use the default screen colors and SELECT
will use the default screen colors or those set with the
SelectColors directive.
If you use both the COLORDIR variable and the ColorDir
directive, the environment variable will override the settings
in your .INI file. You may find it useful to use the COLORDIR
variable for experimenting, then to set permanent directory
colors with the ColorDir directive.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 30
CHAPTER 2 / CONVENTIONS
-------------------------------------------------------------------
The format for both the COLORDIR environment variable and the
ColorDir directive in the .INI file is:
ext ... :ColorName; ...
where "ext" is a file extension (which may include wildcards)
or one of the following file types:
DIRS Directories
RDONLY Read-only files
HIDDEN Hidden files
SYSTEM System files
ARCHIVE Files modified since the last backup
and "ColorName" is any valid color name (see page 26 for
information on color names).
Unlike most color specifications, the background portion of
the color name may be left out for directory colors. If you
don't specify a background color, DIR and SELECT will use the
current screen background color.
For example, to display the .COM and .EXE files in red on the
current background, the .C and .ASM files in bright cyan on
the current background, and the read-only files in blinking
green on white (this should be entered on one line):
c:\> set colordir=com exe:red; c asm:bright cyan;
rdonly:blink green on white
Extended wildcards (for example "BA[KXC]" for .BAK, .BAX, and
.BAC files) can be used in directory color specifications.
See page 59 for more information on extended wildcards.
4DOS ## 4DOS normally writes text directly to the screen when
displaying color-coded directories. If you have an unusual
display adapter which does not support direct video output,
see the OutputBIOS directive on page 150.
Keys and Key Names
Key names are used to define keystroke aliases, in several of
the .INI file directives, and with the 4DOS KEYSTACK command.
The format of a key name is the same in all three uses:
[Prefix-]Keyname
The key prefix can be left out, or it can be any one of the
following:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 31
CHAPTER 2 / CONVENTIONS
-------------------------------------------------------------------
Alt followed by A - Z, 0 - 9, F1 - F12, or Bksp
Ctrl followed by A - Z, F1 - F12, Tab, Bksp, Enter,
Left, Right, Home, End, PgUp, PgDn, Ins, or Del
Shift followed by F1 - F12 or Tab.
The possible key names are:
A - Z Enter PgDn
0 - 9 Up Home
F1 - F12 Down End
Esc Left Ins
Bksp Right Del
Tab PgUp
All key names must be spelled as shown. Alphabetic keys can
be specified in upper-case or lower-case. You cannot specify
a punctuation key.
The prefix and key name must be separated by a dash [-]. For
example:
Alt-F10 This is okay
Alt F10 The space will cause an error
If you prefer, you can use a numeric value instead of a key
name. Use the ASCII code for an ASCII, extended ASCII, or
control character. Use the scan code preceded by an at sign
[@] for extended key codes like F1 or the cursor keys. For
example, use 13 for Enter, or @59 for F1. In general, you
will find it easier to use the names described above rather
than key numbers. See Appendix B (page 371) for an
explanation and list of ASCII and key codes.
Some keys are intercepted by your operating system or BIOS and
are not passed on to 4DOS, 4OS2, or 4DOS/NT. For example,
under DOS Ctrl-S pauses screen output temporarily, and on some
systems Ctrl-P toggles Print Echo mode (where text displayed
on the screen is automatically echoed to the printer). Keys
which are intercepted by the operating system or BIOS
generally cannot be assigned to aliases or with key mapping
directives, because the command processor never receives these
keystrokes and therefore cannot act on them.
You also may not be able to use certain keys if your keyboard
is not 100% IBM-compatible, your keyboard driver does not
support them, or, under DOS, if you have an ANSI driver which
does not support them. For example, on some systems the F11
and F12 keys are not recognized; others may not support
unusual combinations like Ctrl-Tab. These problems are rare;
when they do occur, they are usually due to the operating
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 32
CHAPTER 2 / CONVENTIONS
-------------------------------------------------------------------
system and/or your ANSI driver, and not to any problem with
4DOS, 4OS2, or 4DOS/NT.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 33
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
4DOS, 4OS2, and 4DOS/NT are both a collection of commands and a set
of features which make your computer easier to use. The commands
are explained in the Command Reference section which begins on page
153. This chapter explains each of the features that are not
directly related to individual commands.
Most of the features described in this section are easy to use, but
a few are more technical in nature. Such features are marked with
a ## next to the feature name or the paragraph which describes the
feature's operation.
As you read through this section, we urge you to experiment with
the features that catch your interest and pass over any which seem
too complicated. Come back to this section as you gain expertise,
and you will probably discover that the more complex features will
seem easy and very useful. You don't need to learn any more than
you want, and even if you are a computer novice, you'll find some
features that will interest you immediately.
If you come across terms or concepts in this chapter that you are
unsure about, refer to Chapter 1 / General Concepts, the Glossary
on page , or the Index. 381
At the Command Line
4DOS displays a c:\> prompt when it is waiting for you to
enter a command. 4OS2 and 4DOS/NT display the similar [c:\]
prompt. (In each case, the actual text depends on the current
drive and directory as well as your PROMPT settings.) This is
called the command line and the prompt is asking you to enter
a command, an alias or batch file name, or the instructions
necessary to begin an application program.
This section of the manual explains the features that will
help you while you are typing in commands, and how keystrokes
are interpreted when you enter them at the command line. The
keystrokes discussed here are the ones normally used by 4DOS,
4OS2, and 4DOS/NT. If you prefer using different keystrokes
to perform these functions, you can assign new ones with
keystroke directives in the .INI file (see page 126).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 34
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Command-Line Editing
The command line works like a single-line word processor,
allowing you to edit any part of the command at any time
before you press Enter to execute it, or Esc to erase it.
The command line extends to a maximum of 255 characters under
4DOS and 1023 characters under 4OS2 and 4DOS/NT.
You can use the following editing keys when you are typing a
command (the words Ctrl and Shift mean to press the Ctrl or
Shift key together with the other key named):
Cursor Movement:
Left arrow Move the cursor left one character.
Right arrow Move the cursor right one character.
Ctrl-Left arrow Move the cursor left one word.
Ctrl-Right arrow Move the cursor right one word.
Home Move the cursor to the beginning of
the line.
End Move the cursor to the end of the
line.
Insert and Delete:
Ins Toggle between insert and overtype
mode.
Del Delete the character at the cursor.
Backspace Delete the character to the left of
the cursor.
Ctrl-L Delete the word or partial word to
the left of the cursor.
Ctrl-R or Ctrl-Bksp Delete the word or partial word to
the right of the cursor.
Ctrl-Home Delete from the beginning of the line
to the cursor.
Ctrl-End Delete from the cursor to the end of
the line.
Esc Delete the entire line.
Ctrl-C Cancel the command.
or Ctrl-Break
Enter Execute the command line.
4OS2, ## 4OS2 and 4DOS/NT will prompt for additional command-line
4NT text when you include the escape character as the very last
character of a typed command line. The default escape
character in both programs is the caret [^]. For example,
[c:\] echo The quick brown fox jumped over the lazy^
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 35
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
More? sleeping dog. > alphabet
## Sometimes you may want to enter one of the above keystrokes on
the command line instead of performing the key's usual action.
For example, suppose you have a program that requires a Ctrl-R
character on its command line. Normally you couldn't type
this keystroke at the prompt, because it would be interpreted
as a "Delete word right" command.
To get around this problem, use the special keystroke Alt-255.
You enter Alt-255 by holding down the Alt key while you type
255 on the numeric keypad, then releasing the Alt key (you
must use the number keys on the numeric pad; the row of keys
at the top of your keyboard won't work). This forces the
command processor to interpret the next keystroke literally
and places it on the command line, ignoring any special
meaning it would normally have as a command-line editing or
history keystroke. You can use Alt-255 to suppress the normal
meaning of command-line editing keystrokes even if they have
been reassigned with key mapping directives in the .INI file
(see page 126), and Alt-255 itself can be reassigned with the
CommandEscape directive.
If you want your input at the command line to be in a
different color from the command processor's prompts or
output, you can use the InputColors directive in your .INI
file. You must have an ANSI driver installed to use
InputColors under 4DOS. See page 142 for more details on
InputColors.
Most of the command-line editing capabilities are also
available when a 4DOS, 4OS2, or 4DOS/NT command prompts you
for a line of input. For example, you can use the command-
line editing keys when DESCRIBE (page 201) prompts for a file
description, when INPUT (page 262) prompts for input from an
alias or batch file, or when LIST (page 272) prompts you for a
search string.
Command History and Recall
Each time you execute a command, the entire command line is
saved in a command history list. You can display the saved
commands, search the list, modify commands, and rerun
commands.
The simplest use of the command history list is to repeat a
command exactly. For example, you might enter the command
c:\> dir b:*.wks;*.doc
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 36
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
to see some of the files on drive B. You might move some new
files to drive B and then want to repeat the DIR command.
Just press the Up Arrow key repeatedly to scan back through
the history list. When the DIR command appears, press Enter
to execute it again.
After you have found a command, you can edit it before
pressing Enter. You will appreciate this feature when you
have to execute a series of commands that differ only slightly
from each other.
The history list is "circular". If you move to the last
command in the list and then press the down arrow one more
time, you'll see the first command in the list. Similarly, if
you move to the first command in the list and then press the
up arrow one more time, you'll see the last command in the
list.
You can search the command history list to find a previous
command quickly using command completion. Just enter the
first few characters of the command you want to find and press
Up Arrow. You only need to enter enough characters to
identify the command that you want to find. For example, to
find the DIR command, enter DI and then press Up Arrow. If
you press the Up Arrow key a second time, you will see the
previous command that matches. The system will beep if there
are no matching commands. The search process stops as soon as
you type one of the editing keys, whether or not the line is
changed. At that point, the line you're viewing becomes the
new line to match if you press Up Arrow again.
You can specify the size of the command history list with the
History directive in the .INI file (see page 133). When the
list is full, the oldest commands are discarded to make room
for new ones. You can also use the HistMin directive in the
.INI file to enable or disable history saves and to specify
the shortest command line that will be saved (see page 139).
You can prevent any command line from being saved in the
history by beginning it with an at sign [@].
When you execute a command from the history, that command
remains in the history list in its original position. The
command is not copied to the end of the list (unless you
modify it). If you want each command to be copied to the end
of the list when it is re-executed, set HistCopy to Yes in
your .INI file (see page 139).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 37
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Command History Keys:
Up Arrow Recall the previous (or most recent)
command, or the most recent command
that matches a partial command line.
Down Arrow Recall the next (or oldest) command,
or the oldest command that matches a
partial command line.
F3 Fill in the rest of the command line
from the previous command, beginning
at the current cursor position.
Ctrl-D Delete the currently displayed
history list entry, erase the command
line, and display the previous
matching history list entry.
Ctrl-E Display the last entry in the history
list.
Ctrl-K Save the current command line in the
history list without executing it,
and then clear the command line.
Ctrl-Enter Copy the current command line to the
end of the history list even it has
not been altered.
@ As the first character in a line: Do
not save the current line in the
history list when it is executed, or
store it in the CMDLINE environment
variable (see CMDLINE on page 99 for
further details).
Use F3 when your new command is different from your old one by
just a character or two at the beginning. For example,
suppose you want to execute a DIR on several file names then
use DEL to delete those same files. After the DIR is complete
type DEL and press F3; the rest of the command line will be
completed for you. Check that it's correct, and then press
Enter to delete the files. F3 also retrieves the entire
previous command (like up-arrow) if nothing has been typed on
the line.
Use Ctrl-E to "get your bearings" by returning to the end of
the list if you've scrolled around so much that you aren't
sure where you are any more.
Use Ctrl-K to save some work when you've typed a long command
and then realize that you weren't quite ready. For example,
if you forget to change directories and notice it after a
command is typed or mostly typed, but before you press Enter,
just press Ctrl-K to save the command without executing it.
Use the CD or CDD command to change to the right directory,
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 38
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
press up-arrow twice to retrieve the command you saved, make
any final changes to it, and press Enter to execute it.
Use Ctrl-Enter to organize the history list for repetitive
tasks. Instead of searching through the command history for
the next command in a sequence, you can place all of the
necessary commands next to each other and make them easier to
repeat.
Local and Global Command History
The command history can be stored in either a "local" or
"global" list.
With a local history list, any changes made to the history
will only affect the current copy of the command processor.
They will not be visible in other shells, or other sessions.
A local history list is the default under 4DOS.
With a global history list, all copies of the command
processor will share the same command history, and any changes
made to the history in one copy will affect all other copies.
Global lists are the default for 4OS2 and 4DOS/NT.
You can control the type of history list with the LocalHistory
directive in the .INI file (see page 134), and with the /L and
/LH options of the START command (see page 331).
There is no fixed rule for deciding whether to use a local or
global history list. Depending on your work style, you may
find it most convenient to use one type, or a mixture of types
in different sessions or shells. We recommend that you start
with the default approach for your command processor, then
modify it if you find a situation where the default is not
convenient.
4DOS If you select a global history list for 4DOS running under
DOS, you can share the history among all copies of 4DOS.
However, if you run 4DOS under OS/2, global lists will apply
within each DOS session, but will not allow you to share the
history between different DOS sessions.
4OS2, ## If you select a global history list for 4OS2 or 4DOS/NT, you
4NT can share the history among all copies of the command
processor running in any session. When you close all 4OS2 or
4DOS/NT sessions, the memory for the global history list is
released, and a new, empty history list is created the next
time you start 4OS2 or 4DOS/NT. If you want the history list
to be retained in memory even when no command processor
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 39
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
session is running, you need to load the SHRALIAS program,
which performs this service for the global history and alias
lists. SHRALIAS is described in more detail under the ALIAS
command (see page 170).
Whenever you start a secondary shell (see page 12) which uses
a local history list, it inherits a copy of the command
history from the previous shell. However, any changes to the
history made in the secondary shell will affect only that
shell. If you want changes made in a secondary shell to
affect the previous shell, use a global history list in both
shells.
Command History Window
You can also view the command history in a scrollable command
history window, and select the command to modify or re-execute
from those displayed in the window. To activate the command
history window press PgUp or PgDn at the command line. A
window will appear in the upper right corner of the screen,
with the command you most recently executed marked with a
highlight. (If you just finished re-executing a command from
the history, then the next command in sequence will be
highlighted.)
You can scroll the command history window up and down one line
at a time with Up Arrow and Down Arrow, and one page (screen)
at a time with PgUp and PgDn. The display is not circular as
it is at the prompt; it has a fixed beginning and end. Left
Arrow and Right Arrow will pan the text in the history to the
left or right. Home or Ctrl-PgUp will go to the beginning of
the history, and End or Ctrl-PgDn will go to the end. The
Ctrl-D (delete from history) key works within the history
window as it does at the command line.
Once you have selected a command in the history window, press
Enter to execute it immediately, or Ctrl-Enter to move the
line to the prompt for editing (you cannot edit the line
directly in the history window).
You can bring up a "filtered" history window by typing some
characters on the command line, then pressing PgUp or PgDn.
Only those commands matching the typed characters will be
displayed in the window.
You can control the position and size of the history window
with directives in the .INI file (see page 139). You can also
change the keys used in the window with key mapping directives
in the .INI file (see page 146).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 40
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Command History Window:
PgUp or PgDn (from the command line) Open the
command history window.
Up Arrow Scroll the display up one line.
Down Arrow Scroll the display down one line.
Left Arrow Scroll the display left 4 columns.
Right Arrow Scroll the display right 4 columns.
PgUp (inside the window) Scroll the
display up one page.
PgDn (inside the window) Scroll the
display down one page.
Ctrl-PgUp or Home Go to the beginning of the history
list.
Ctrl-PgDn or End Go to the end of the history list.
Ctrl-D Delete the selected line from the
history list.
Enter Execute the selected line.
Ctrl-Enter Move the selected line to the command
line for editing.
Filename Completion
Filename completion can help you by filling in a complete file
name on the command line when you only remember part of the
name. For example, suppose you want to copy a file. You know
that its name begins AU but you can't remember the rest of the
name. Type:
c:\> copy au
and then press the Tab key or F9 key. 4DOS, 4OS2, or 4DOS/NT
will search the current directory for filenames that begin AU
and insert the first one onto the command line in place of the
AU that you typed.
If this is the file that you want, simply complete the
command. If the command processor didn't find the file that
you were looking for, press Tab or F9 again to substitute the
next filename that begins with AU. When there are no more
filenames that match your pattern, the system will beep each
time you press Tab or F9.
If you go past the filename that you want, press Shift-Tab or
F8 to back up and return to the previous matching filename.
After you back up to the first filename, the system will beep
each time you press Shift-Tab or F8.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 41
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
If you want to enter more than one matching filename on the
same command line, press F10 when each desired name appears.
This will keep that name and place the next matching filename
after it on the command line. You can then use Tab (or F9)
and Shift-Tab (or F8) to move through the remaining matching
files.
The pattern you use for matching may contain any valid
filename characters, as well as wildcard characters and
extended wildcards (see page 59). For example, you can copy
the first matching .TXT file by typing
c:\> copy *.txt
and then pressing Tab.
If you don't specify part of a filename before pressing Tab,
the matching pattern will be *.*. If you type a filename
without an extension, the command processor will add *.* to
the name. It will also place a "*" after a partial extension.
If you are typing a group of file names in an include list
(see page 67), the part of the include list at the cursor will
be used as the pattern to match.
When filename completion is used at the start of the command
line, it will only match directories, executable files (see
page 20), and files with executable extensions, since these
are the only file names that it makes sense to use at the
start of a command. If a directory is found, a "\" will be
appended to it to enable an automatic directory change (see
page 47).
Filename Completion Keys:
F8 or Shift-Tab Get the previous matching filename.
F9 or Tab Get the next matching filename.
F10 Keep the current matching filename
and display the next matching name
immediately after the current one.
Filename Completion Window
You can also view filenames in a scrollable filename
completion window and select the file you want to work with.
To activate the window, press F7 or Ctrl-Tab at the command
line. You will see a window in the upper-right corner of the
screen, with the names of files that match any partial
filename you have entered on the command line. If you haven't
yet entered a file name, the window will contain the name of
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 42
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
all files in the current directory. (Ctrl-Tab will work only
if your keyboard and BIOS or keyboard driver support it. If
it does not work on your system, use F7 instead.)
You can scroll the filename completion window up and down one
line at a time with Up Arrow and Down Arrow, and one page
(screen) at a time with PgUp and PgDn. Home or Ctrl-PgUp will
go to the beginning of the list of file names; End or Ctrl-
PgDn will go to the end. You can scroll the window left and
right 4 spaces at a time with the Left Arrow or Right Arrow.
Once you have selected the filename you want, press Enter to
insert it into the command line.
Filename Completion Window:
F7 or Ctrl-Tab (from the command line) Open the
filename completion window.
Up Arrow Scroll the display up one line.
Down Arrow Scroll the display down one line.
Left Arrow Scroll the display left 4 columns.
Right Arrow Scroll the display right 4 columns.
PgUp Scroll the display up one page.
PgDn Scroll the display down one page.
Ctrl-PgUp or Home Go to the beginning of the filename
list.
Ctrl-PgDn or End Go to the end of the filename list.
Enter Insert the selected filename into the
command line.
Directory Changes and CDPATH
The operating system and command processor remember both a
current or default drive for your system as a whole, and a
current or default directory for every drive in your system.
The current directory on the current drive is sometimes called
the current working directory.
You can change the current drive by simply typing the new
drive letter plus a colon at the prompt. You can change the
current working directory with the CD command (see page 181),
the CDD command (page 183), the PUSHD and POPD commands (pages
47 and 299), and with automatic directory changes (page 294).
The CD command can change the default directory on any drive,
but it cannot change the current working directory from one
drive to another. The other methods of changing the current
working directory can change both the current drive and the
current directory in a single command.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 43
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Whenever you change the current working directory, 4DOS, 4OS2,
or 4DOS/NT saves the original directory in up to three places.
First, the directory is saved as the previous working
directory. You can change to the previous working directory
with the CD - and CDD - commands (see pages 181 and 183). You
can use either of these commands repeatedly to switch back and
forth between two directories.
The original directory is also saved in the directory history
(see the next topic below). You can use this list to change
to a recent directory with the cursor keys instead of typing a
directory name.
Finally, the PUSHD command records the old directory in the
directory stack. You can view the contents of this stack with
the DIRS command and return to the directory on the top of the
stack with the POPD command.
If CD, CDD, PUSHD, or an automatic directory change can't
locate the specified directory to change to, they will look
for the CDPATH environment variable. The command will append
the specified directory name to each directory in CDPATH and
attempt to change to that drive and directory, until the first
match or the end of the CDPATH argument. This allows you to
use CDPATH as a quick way to find commonly used subdirectories
which have unique names. For example, if you are currently in
the directory C:\WP\LETTERS\JANUARY and you'd like to change
to D:\SOFTWARE\UTIL, you could enter the command:
c:\wp\letters\january> cdd d:\software\util
However, if the D:\SOFTWARE directory is listed in your CDPATH
variable, and is the first directory in the list with a UTIL
subdirectory, you can simply enter the command
c:\wp\letters\january> cdd util
to change to D:\SOFTWARE\UTIL.
You can create CDPATH with the SET command. The format of the
CDPATH is similar to that of PATH: a list of directories
separated by semicolons [;]. For example, if you want the
directory change commands to search the C:\DATA directory, the
D:\SOFTWARE directory, and the root directory of drive E:\ for
the subdirectories that you name, you should create CDPATH
with this command:
c:\> set cdpath=c:\data;d:\software;e:\
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 44
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Directory History Window
Every time you change to a new directory or drive, the current
directory is recorded in an internal directory history list.
You can set the size of the list with the DirHistory directive
in the .INI file (see page 132). As new entries are added,
old entries are deleted from the list. Directory changes are
recorded whether you make them from the command line with the
CD, CDD, PUSHD, or POPD commands, with an automatic directory
change, or by typing a new drive letter followed by a colon.
Directories are recorded whether you change from one to
another at the command line, from within a batch file, or from
within an alias. In order to conserve space, each directory
name is recorded just once in the directory history, even if
you move into and out of that directory several times.
You can view the directory history from a scrollable directory
history window and change to any drive and directory on the
list. To activate the directory history window, press Ctrl-
PgUp or Ctrl-PgDn at the command line. You can then select a
new directory with the Enter key.
Directory History Window:
Ctrl-PgUp (from the command line) Open the
or Ctrl-PgDn directory history window.
Up Arrow Scroll the display up one line.
Down Arrow Scroll the display down one line.
Left Arrow Scroll the display left 4 columns.
Right Arrow Scroll the display right 4 columns.
PgUp Scroll the display up one page.
PgDn Scroll the display down one page.
Ctrl-PgUp or Home Go to the beginning of the directory
list.
Ctrl-PgDn or End Go to the end of the directory list.
Ctrl-D Delete the selected line from the
directory list.
Enter Change to the selected drive and
directory.
Ctrl-Enter Move the selected line to the command
line for editing.
Local and Global Directory History
The directory history can be stored in either a "local" or
"global" list.
With a local directory history list, any changes made to the
list will only affect the current copy of the command
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 45
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
processor. They will not be visible in other shells, or other
sessions. A local directory history list is the default under
4DOS.
With a global list, all copies of the command processor will
share the same directory history, and any changes made to the
list in one copy will affect all other copies. Global lists
are the default for 4OS2 and 4DOS/NT.
You can control the type of directory history list with the
LocalDirHistory directive in the .INI file (see page 134), and
with the /L and /LD options of the START command (see page
331). You can control where a global directory history list
is stored with the UMBDirHistory directive in the .INI file
(see page 135).
There is no fixed rule for deciding whether to use a local or
global directory history list. Depending on your work style,
you may find it most convenient to use one type, or a mixture
of types in different sessions or shells. We recommend that
you start with the default approach for your command
processor, then modify it if you find a situation where the
default is not convenient.
4DOS If you select a global directory history list for 4DOS running
under DOS, you can share the list among all copies of 4DOS.
However, if you run 4DOS under OS/2, global lists will apply
within each DOS session, but will not allow you to share the
history between different DOS sessions.
4OS2, ## If you select a global directory list for 4OS2 or 4DOS/NT, you
4NT can share the list among all copies of the command processor
running in any session. When you close all 4OS2 or 4DOS/NT
sessions, the memory for the global directory history list is
released, and a new, empty list is created the next time you
start 4OS2 or 4DOS/NT. If you want the list to be retained in
memory even when no command processor session is running, you
need to load the SHRALIAS program, which performs this service
for the global command history, directory history, and alias
lists. SHRALIAS is described in more detail under the ALIAS
command (see page 170).
Whenever you start a secondary shell (see page 12) which uses
a local directory history list, it inherits a copy of the
directory history from the previous shell. However, any
changes to the list made in the secondary shell will affect
only that shell. If you want changes made in a secondary
shell to affect the previous shell, use a global directory
history list in both shells.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 46
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Automatic Directory Changes
The automatic directory change feature gives you a quick
method for changing directories. You can use an automatic
directory change in place of the CD or CDD command. To do so,
simply type the name of the directory you want to change to at
the prompt, with a backslash [\] at the end. For example:
c:\> 4dos\
c:\4dos>
This feature can make directory changes very simple when it's
combined with the CDPATH environment variable (see page 44).
CDPATH is a list of directories for the CD and CDD commands to
search if the directory you name does not exist below the
current directory. Automatic directory changes use CDPATH as
well. For example, suppose CDPATH is set to C:\;D:\;E:\, and
the directory WIN exists on drive E:. You can change to this
directory with a single word on the command line:
c:\4dos> win\
e:\win>
In executing the command shown above, the command processor
first looks for a WIN subdirectory of the current directory,
i.e., C:\4DOS\WIN. If no such directory exists it looks for a
WIN subdirectory in every directory in the CDPATH list, and
changes to the first one it finds.
Internally, automatic directory changes use the CDD command,
so the text before the backslash can include a drive letter, a
full path, or a partial path. Commands like "....\" can be
used to move up the directory tree quickly (see page 59).
Automatic directory changes save the current directory, so it
can be recalled with a "CDD -" or "CD -" command. For more
information on directory changes see page 181, CD on page 44,
and CDD on page 183.
Multiple Commands
At times, you probably know the next two or three commands
that you want to execute. Instead of waiting for each one to
finish before you type the next, you can type them all on the
same command line, separated by a caret [^] in 4DOS, or an
ampersand [&] in 4OS2 or 4DOS/NT. For example, if you know
you want to copy all of your .TXT files to drive A: and then
run CHKDSK to be sure that drive A's file structure is in good
shape, in 4DOS you could enter the following command:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 47
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
c:\> copy *.txt a: ^ chkdsk a:
You may put as many commands on the command line as you wish,
as long as the total length of the command line does not
exceed 255 characters in 4DOS or 1023 characters in 4OS2 and
4DOS/NT.
You can use multiple commands in batch files (see page 80) and
alias definitions (see page 77) as well as from the command
line.
If you don't like using the default command separator, you can
pick another character using the SETDOS /C command (see page
323) or the CommandSep directive in the .INI file (see page
137). If you plan to share aliases or batch files between
4DOS, 4OS2, and 4DOS/NT, see page 74 for details about
choosing compatible command separators for two or more
products.
Temporarily Disabling Aliases
Aliases can be used to create shorthand names for commonly
used commands, or to define default options for existing
commands (for more information see pages 161 and 77). At
times, you may want to temporarily disable an alias that you
have defined. You may have an alias that changes the defaults
of a particular command, for example, and want to run the
unmodified version of the command. To do so, precede the
command name with an asterisk [*]. For example, if you have
an alias for DIR which displays directories in 2-column paged
mode by default, you can use the following command to display
a directory in the normal single-column, non-paged mode:
c:\> *dir
You can also disable aliases temporarily with the SETDOS /X
command (see page 327).
Command Line Help
All of our products include complete online help. You can
start the help system by typing HELP or HELP plus a command
name at the prompt, or by pressing the F1 key at any time at
the command line.
4DOS In 4DOS,a special program (4HELP.EXE) displays the online
help. If you press F1, the 4DOS help system will display the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 48
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
list of all help topics just as if you had entered the HELP
command.
4OS2, In 4OS2 and 4DOS/NT, the online help uses the operating
4NT system's built-in help facility. If you press F1, the table
of contents will be displayed and you can select the desired
help topic using the standard help "navigation" keys for your
system.
If you have already typed part or all of a command on the
line, the help system will provide "context-sensitive" help by
using the first word on the line as a help topic. If it's a
valid topic, you will see help for that topic automatically;
if not, you will see the list of all help topics (in 4DOS) or
the table of contents (in 4OS2 and 4DOS/NT), and you can then
pick the topic you want. For example, if you press F1 after
entering each of the command lines shown below you will get
the display indicated:
c:\> Topic list / table of contents
c:\> copy *.* a: Help on COPY
c:\> c:\util\map Topic list / table of contents
If you type the name of any internal command at the prompt,
followed by a slash and a question mark [/?] like this:
copy /?
then you will see help for the command in a "quick-reference"
style. Output from a /? display may be redirected with > or
>> (see page 52). The /? option may not work correctly if you
have redefined how the command operates with an alias. In
this case you may need to add an asterisk to the beginning of
the command to disable alias processing:
alias copy copy /r
*copy /?
/? will only access the help system when you use it with an
internal command. If you use it with an external command
name, the external command will be executed and will interpret
the /? parameter according to its own rules. Some external
commands, including some DOS and OS/2 external utility
programs, do display help when run with a /? parameter, but
this a characteristic of these commands and does not depend on
the command processor. Many other external commands do not
have this feature.
Please see the Introduction and Installation Guide that was
supplied with your version of 4DOS, 4OS2, or 4DOS/NT for a
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 49
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
more thorough explanation of the online Help available with
the program you use.
## Command-Line Length Limits
Under 4DOS, when you first enter a command at the prompt or in
an alias or batch file, it can be up to 255 characters long.
The 4OS2 and 4DOS/NT command lines can hold 1,023 characters.
As the command processor scans the command line and
substitutes the contents of aliases and environment variables
for their names, the line usually gets longer. This expanded
line is stored in an internal buffer which allows each
individual command to grow to 255 characters during the
expansion process (1,023 characters in 4OS2 and 4DOS/NT). In
addition, if you have multiple commands on a single line,
during expansion the entire line can grow to as much as 511
characters in 4DOS, or 2,047 characters in 4OS2 and 4DOS/NT.
If your use of aliases or environment variables causes the
command line to exceed either of these limits as it is
expanded, you will see an error message and the remainder of
the line will not be executed.
Page and File Prompts
Several 4DOS, 4OS2, and 4DOS/NT commands can generate prompts,
which wait for you to press a key to view a new page or to
perform a file activity.
When 4DOS, 4OS2, or 4DOS/NT is displaying information in page
mode, for example with a DIR /P or SET /P command, it displays
the message
Press Esc to Quit or any other key to continue...
At this prompt, you can press Esc, Ctrl-C, or Ctrl-Break if
you want to quit the command. You can press almost any other
key to continue with the command and see the next page of
information.
During file processing, if you have activated prompting with a
command like DEL /P, you will see this prompt before
processing every file:
Y/N/R ?
You can answer this prompt by pressing "Y" for "Yes, process
this file;" "N" for "No, do not process this file;" or "R"
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 50
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
for "process the Remainder of the files without further
prompting." You can also press Ctrl-C or Ctrl-Break at this
prompt to cancel the remainder of the command.
If you press Ctrl-C or Ctrl-Break while a batch file is
running, you will see a "Cancel batch job" prompt. For
information on responses to this prompt see page 85.
Critical Errors
DOS, OS/2, and Windows NT all watch for physical errors during
input and output operations. Physical errors are those due to
hardware problems, such as trying to read a floppy disk while
the drive door is open.
These errors are called critical errors because the operating
system, command processor, or application program cannot
proceed until the error is resolved.
When a critical error occurs, you will see a message asking
you to choose one of four error handling options. The message
comes from the command processor or the operating system, and
will vary slightly depending on your operating system and
(under OS/2 and Windows NT) whether you are in full-screen or
windowed mode. You can respond with a single character (under
DOS), or a mouse click or menu selection (under OS/2 or
Windows NT). However, the options and their meanings are
similar in all cases:
Retry Retry the operation. Choose this option if you
have corrected the problem.
Ignore Ignore the error and continue. Use caution when
choosing this option. Ignoring critical errors,
especially on the hard disk, can cause errors in
your applications or damage data on the disk.
Fail Tell the program that the operation failed. This
option returns an error code to the command
processor or to the application program that was
running when the error occurred. 4DOS, 4OS2, and
4DOS/NT generally stop the current command when
an operation fails. This option is not available
for all errors; if you don't see it, use Abort
instead. Under DOS, you can force a Fail
response to all critical errors with the CritFail
directive in 4DOS.INI (see page 148).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 51
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Abort Abort the program. Choose this option to stop
the program that was running when the error
occurred. Choosing Abort after an error in 4DOS,
4DOS/NT, or the 16-bit version of 4OS2 will abort
the command, but not the command processor
itself. Choosing Abort after an error in the 32-
bit version of 4OS2 will abort both the command
and the command processor. To avoid this, use
Fail rather than Abort if possible.
Input and Output
Internal commands and many external programs get their input
from the computer's standard input device and send their
output to the standard output device. Some programs also send
special messages to the standard error device. Normally, the
keyboard is used for standard input and the video screen for
both standard output and standard error, but you can
temporarily change these assignments for special tasks.
For example, suppose you want a printed list of the files in a
directory. If you change the standard output to the printer
and issue a DIR command, the task is easy. DIR prints to
standard output, and you have redirected standard output to
the printer, so the DIR command prints filenames instead of
displaying them on the screen. You can just as easily send
the output of DIR (or any other command) to a file or a serial
port.
We offer three methods of manipulating input and output:
Redirection, Piping, and (under 4DOS) the Keystack. All three
are explained in this section.
Redirection and piping affect the standard input, standard
output, and standard error devices. They do not work with
application programs which read the keyboard hardware
directly, or which write directly to the screen.
Redirection
Redirection assigns standard input, standard output, and
standard error to a device like the printer or serial port, or
to a file. (You must use some discretion when you use
redirection with a device; there is no way to get input from
the printer, for example.)
Redirection always applies to a specific command, and lasts
only for the duration of that command. When the command is
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 52
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
finished, the assignments for standard input, standard output,
and standard error revert to whatever they were before the
command.
In the descriptions below, filename means either the name of a
file or of an appropriate device (PRN, LPT1, LPT2, or LPT3 for
printers; COM1 to COM4 for serial ports; CON for the keyboard
and screen; etc.).
To use redirection, place the redirection symbol and filename
at the end of the command line, after the command name and any
parameters. For example, to redirect the output of the DIR
command to a file called DIRLIST, you could use a command line
like this:
c:\> dir /b *.dat > dirlist
You can use both input and output redirection for the same
command, if both are appropriate:
c:\> sort < dirlist > dirlist.srt
If you redirect the output of a single internal command like
DIR, the redirection ends automatically when that command is
done. If you start a batch file with redirection, all of the
batch file's output is redirected, and redirection ends when
the batch file is done. Similarly, if you use redirection at
the end of a command group (see page 71), all of the output
from the command group is redirected, and redirection ends
when the command group is done.
Here are the redirection options supported by 4DOS, 4OS2, and
4DOS/NT:
To get input from a file or device instead of from the
keyboard:
< filename
To redirect standard output to a file or device:
> filename
To redirect standard output and standard error to a file
or device:
>& filename
To redirect standard error only to a file or device:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 53
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
>&> filename
If you want to append output to the end of an existing file,
rather than creating a new file, replace the first ">" in the
last three commands above with ">>" (use >>, >>&, and >>&>).
## When output is directed to a file with >, >&, or >&>, if the
file already exists, it will be overwritten. You can protect
existing files by using the SETDOS /N1 command (see page 325)
or the NoClobber directive in the .INI file (see page 140).
## When output is appended to a file with >>, >>&, or >>&>, the
file will be created if it doesn't already exist. Setting
NoClobber will also prevent the creation of a new file.
## You can temporarily override the current setting of NoClobber
by using an exclamation mark [!] after the redirection symbol.
For example, to redirect the output of DIR to the file DIROUT,
and allow overwriting of any existing file despite the
NoClobber setting:
c:\> dir >! dirout
## Redirection is fully nestable. For example, you can invoke a
batch file and redirect all of its output to a file or device.
Output redirection on a command within the batch file will
take effect for that command only; when the command is
completed, output will revert to the redirected output file or
device in use for the batch file as a whole.
## You can use redirection if you need to create a zero-byte
file. To do so, enter >filename as a command, with no actual
command before the > character.
4DOS ## For another method of changing the standard input and output
devices see CTTY on page 194.
4OS2, In addition to the extended 4DOS redirection options, 4OS2 and
4NT 4DOS/NT also support the OS/2 and Windows NT CMD.EXE syntax
n>file
and
n>&m
where [n] and [m] are digits between 0 and 9. You may not put
any spaces between the n and the >, or between the >, &, and m
in the second form. The digits represent file handles; OS/2
and Windows NT interpret "0" as standard input, "1" as
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 54
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
standard output, and "2" as standard error. Handles 3 to 9
will probably not be useful unless you have an application
which uses those handles for a specific, documented purpose,
or have opened a file with the %@FILEOPEN variable function
(see page 114) and the file handle is between 3 and 9.
The n>file syntax redirects output from handle n to a file.
You can use this form to redirect two handles to different
places. For example:
[c:\] dir > outfile 2> errfile
sends normal output to a file called OUTFILE and any error
messages to a file called ERRFILE.
The n>&m syntax redirects handle n to the same location as the
previously assigned handle m. For example, to send standard
error to the same file as standard output, you could use this
command:
[c:\] dir > outfile 2>&1
Notice that you can perform the same operations by using 4OS2
or 4DOS/NT's enhanced redirection features. The two examples
above could be written as
[c:\] dir > outfile >&> errfile
and
[c:\] dir >&outfile
Piping
You can also create a "pipe," which means sending the standard
output of one command to the standard input of another
command. To send the standard output of command1 to the
standard input of command2:
command1 | command2
To send the standard output and standard error of command1 to
the standard input of command2:
command1 |& command2
For example, to take the output of the SET command (which
displays a list of your environment variables and their
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 55
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
values) and pipe it to the SORT utility to generate a sorted
list, you would use the command:
c:\> set | sort
To do the same thing and then pipe the sorted list to the
internal LIST command for full-screen viewing (see page 272):
c:\> set | sort | list /s
## The TEE and Y commands (see pages 340 and 358) are "pipe
fittings" which add more flexibility to pipes.
## Like redirection, pipes are fully nestable. For example, you
can invoke a batch file and send all of its output to another
command with a pipe. A pipe on a command within the batch
file will take effect for that command only; when the command
is completed, output will revert to the pipe in use for the
batch file as a whole. You may also have 2 or more pipes
operating simultaneously if, for example, you have the pipes
running in different windows in a multitasking system.
4DOS ## 4DOS creates one or two temporary files to hold the output of
pipes. The files are given unique names. By default, these
files are stored in the root directory of the boot drive, but
you can override this with either the TEMP4DOS or TEMP
environment variable (see page 100).
4OS2, ## 4OS2 and 4DOS/NT implement pipes by starting a new process for
4NT the receiving program instead of using temporary files. The
sending and receiving programs run simultaneously; the sending
program writes to the pipe and the receiving program reads
from the pipe. When the receiving program finishes reading
and processing the piped data, it is ended automatically.
If you are used to using pipes under 4DOS, you normally will
not see any difference with a 4OS2 or 4DOS/NT pipe except
perhaps less disk activity. But you may not get the results
you expect if you use a pipe command like:
[c:\] echo test | input %%var
4DOS In 4DOS, this pipe will create an environment variable called
VAR and set its value as "test." You will be able to see the
new variable by typing SET at the prompt.
4OS2, In 4OS2 and 4DOS/NT, VAR will be set in the environment that
4NT belongs to the receiving program. But that environment will
be discarded when the pipe has been emptied and the process
ends. You will never see VAR in the environment even though
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 56
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
the command processor and the operating system are both
operating correctly.
The same cautions apply to the "pipe-fitting" commands, TEE
and Y. When you use pipes with 4OS2 or 4DOS/NT, make sure you
think about any possible consequences that can occur from
using a separate process to run the receiving program.
4DOS Keystack
The 4DOS Keystack overcomes two weaknesses of input
redirection: many programs ignore standard input and read the
keyboard directly, and input redirection doesn't end until the
program or command terminates. You can't, for example, use
redirection to send the opening commands to a program and then
type the rest of the commands yourself. But the Keystack lets
you do exactly that.
The 4DOS Keystack sends keystrokes to an application program.
Once the Keystack is empty, the program will receive the rest
of its input from the keyboard. The Keystack is useful when
you want a program to take certain actions automatically when
it starts. It is most often used in batch files and aliases.
The Keystack is invoked with the KEYSTACK command (see page
266). It depends on a small resident program called
KSTACK.COM, which may be installed from your AUTOEXEC.BAT file
(see page 86). If you don't have KSTACK.COM installed, the
KEYSTACK command will display an error message. If you are
using a multitasking system such as DESQview or Windows, see
your 4DOS Introduction and Installation Guide for information
on loading KSTACK within a window.
To place the letters, digits, and punctuation marks you would
normally type for your program into the keystack, enclose them
in double quotes:
c:\> keystack "myfile"
Many other keys can be entered into the Keystack using their
names. This example puts the F1 key followed by the Enter key
in the keystack:
c:\> keystack F1 Enter
See page 31 for details on how key names are entered. See the
KEYSTACK command on page 266 for information on using numeric
key values along with or instead of key names, and other
details about using the Keystack.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 57
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
The following command creates an alias (see page 161) that
will run a dBASE report called TIMEREP (it should be entered
on one line):
c:\> alias drpt `keystack "use times index times" Enter
"report form timerep to print" Enter "quit" Enter
^ dbase`
This command creates an alias called DRPT which puts the
following characters on the keystack:
the characters "use times index times"
the Enter key's code
the characters "report form timerep to print"
the Enter key's code
the characters "quit"
and one more Enter key
The alias then runs the program dBASE which receives those
characters just as if you had typed them.
When you use the Keystack, remember that you must put the
keystrokes into the Keystack before you run the program that
will receive them. The Keystack will hold the keystrokes
until the program asks for them.
File Selection
Most internal commands (like COPY, DIR, etc.) work on a file
or a group of files. Besides typing the exact name of the
file you want to work with, you can use several shorthand
forms for naming or selecting files: Extended Parent
Directory Names; Wildcards; Date, Time, and Size Ranges;
Multiple Filenames; Include Lists; and Executable Extensions.
These six features are explained in this section.
These features apply to 4DOS, 4OS2, and 4DOS/NT commands only,
and generally can not be used to pass file names to external
programs. For example, the file name ...\FILE.DAT uses an
extended parent directory name ("..."). It can be used in an
internal command like COPY or MOVE. However, your editor
probably was not designed to support this extension to
traditional directory names, and is likely to give an error
message if you try to pass it such a name.
Remember throughout this section that, if you are using DOS,
or the FAT file system under OS/2 or Windows NT, a filename is
a base name of 1 to 8 characters, optionally followed by an
extension which is a period [.] and 1 to 3 more characters.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 58
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
On an HPFS or NTFS drive, file names can contain up to 255
characters, including spaces. If an HPFS or NTFS filename
includes spaces, you must place it in quotation marks on the
command line. (See page 13 for additional details on
filename formats and restrictions.)
Extended Parent Directory Names
4DOS, 4OS2, and 4DOS/NT allow you to extend the traditional
DOS ".." syntax for naming the parent directory, by adding
additional [.] characters. Each additional [.] represents an
additional directory level above the current directory. For
example, .\FILE.DAT refers to a file in the current directory,
..\FILE.DAT refers to a file one level up (in the parent
directory), and ...\FILE.DAT refers to a file two levels up
(in the parent of the parent directory). If you are in the
C:\DATA\FINANCE\JANUARY directory and want to copy the file
LETTERS.DAT from the directory C:\DATA to drive A:
C:\DATA\FINANCE\JANUARY>copy ...\LETTERS.DAT A:
Wildcards
Wildcards let you specify a file or group of files by typing a
partial filename. The appropriate directory is scanned to
find all of the files that match the partial name you have
specified.
Most internal commands accept filenames with wildcards
anywhere that a full filename can be used. There are two
wildcard characters, the asterisk [*] and the question mark
[?], plus a special method of specifying a range of
permissible characters.
An asterisk [*] in a filename means "any zero or more
characters in this position." For example, this command will
display a list of all files in the current directory:
c:\> dir *.*
If you want to see all of the files with a .TXT extension, you
could type this:
c:\> dir *.txt
If you know that the file you are looking for has a base name
that begins with ST and an extension that begins with .D, you
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 59
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
can find it this way. Filenames such as STATE.DAT,
STEVEN.DOC, and ST.D will all be displayed:
c:\> dir st*.d*
With 4DOS, 4OS2, or 4DOS/NT, you can also use the asterisk to
match filenames with specific letters somewhere inside the
name. The following example will display any file with a .TXT
extension that has the letters AM together anywhere inside its
base name. It will, for example, display AMPLE.TXT,
STAMP.TXT, CLAM.TXT, and AM.TXT:
c:\> dir *am*.txt
A question mark [?] matches any single filename character.
You can put the question mark anywhere in a filename and use
as many question marks as you need. The following example
will display files with names like LETTER.DOC and LATTER.DAT,
and LITTER.DU:
c:\> dir l?tter.d??
The use of an asterisk wildcard before other characters, and
of the character ranges discussed below, are enhancements to
the standard wildcard syntax, and are not likely to work
properly with software other than 4DOS, 4OS2, and 4DOS/NT.
## "Extra" question marks in your wildcard specification are
ignored if the file name is shorter than the wildcard
specification. For example, if you have files called
LETTER.DOC, LETTER1.DOC, and LETTERA.DOC, this command will
display all three names:
c:\> dir letter?.doc
The file LETTER.DOC is included in the display because the
"extra" question mark at the end of "LETTER?" is ignored when
matching the shorter name LETTER.
## In some cases, the question mark wildcard may be too general.
You can also specify what characters you want to accept (or
exclude) in a particular position in the filename by using
square brackets. Inside the brackets, you can put the
individual acceptable characters or ranges of characters. For
example, if you wanted to match LETTER0.DOC through
LETTER9.DOC, you could use this command:
c:\> dir letter[0-9].doc
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 60
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
You could find all files that have a vowel as the second
letter in their name this way. This example also demonstrates
how to mix the wildcard characters:
c:\> dir ?[aeiouy]*.*
You can exclude a group of characters or a range of characters
by using an exclamation mark [!] as the first character inside
the brackets. This example displays all filenames that are at
least 2 characters long except those which have a vowel as the
second letter in their names:
c:\> dir ?[!aeiouy]*.*
The next example, which selects files such as AIP, BIP, and
TIP but not NIP, demonstrates how you can use multiple ranges
inside the brackets. It will accept a file that begins with
an A, B, C, D, T, U, or V:
c:\> dir [a-dt-v]ip
## You may use a question mark character inside the brackets, but
its meaning is slightly different than a normal (unbracketed)
question mark wildcard. A normal question mark wildcard
matches any character, but will be ignored when matching a
name shorter than the wildcard specification, as described
above. A question mark inside brackets will match any
character, but will not be discarded when matching shorter
filenames. For example:
c:\> dir letter[?].doc
will display LETTER1.DOC and LETTERA.DOC, but not LETTER.DOC.
## A pair of brackets with no characters between them [], or an
exclamation point and question mark together [!?],will match
only if there is no character in that position. For example,
[c:\] dir letter[].doc
will not display LETTER1.DOC or LETTERA.DOC, but will display
LETTER.DOC. This is most useful for commands like
[c:\] dir /I"[]" *.btm
which will display a list of all .BTM files which don't have a
description.
## You can repeat any of the wildcard characters in any
combination you desire within a single file name. For
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 61
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
example, the following command lists all files which have an
A, B, or C as the third character, followed by zero or more
additional characters, followed by a D, E, or F, followed
optionally by some additional characters, and with an
extension beginning with P or Q. You probably won't need to
do anything this complex, but we've included it to show you
the flexibility of extended wildcards:
c:\> dir ??[abc]*[def]*.[pq]*
4OS2, ## You can also use the square bracket wildcard syntax to work
4NT around a conflict between HPFS and NTFS filenames containing
semicolons [;], and the use of a semicolon to indicate an
include list (see page 67). For example, if you have a file
on an HPFS drive named C:\DATA\LETTER1;V2 and you enter this
command:
[c:\] del \data\letter1;v2
you will not get the results you expect. Instead of deleting
the named file, 4OS2 or 4DOS/NT will attempt to delete LETTER1
and then V2, because the semicolon indicates an include list.
However if you use square brackets around the semicolon it
will be interpreted as a filename character, and not as an
include list separator. For example, this command would
delete C:\DATA\LETTER1;V2:
[c:\] del \data\letter1[;]v2
Date, Time, and Size Ranges
Most internal commands which accept wild cards also allow
date, time, and size ranges to further define the files that
you wish to work with. 4DOS, 4OS2, and 4DOS/NT will examine
the files' timestamps (which record when the file was last
modified), and the files' sizes, to determine which files meet
the range criteria that you specify.
A range begins with the switch character (usually a slash
[/]), followed by a left square bracket ("[") and a character
that specifies the range type: "s" for a size range, "d" for
a date range, or "t" for a time range. The "s", "d", or "t"
is followed by a start value, and an optional comma and end
value. The range ends with a right square bracket ("]").
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 62
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Size Ranges
Size ranges simply select files whose size is between the
limits given. For example, /[s10000,20000] selects files
between 10,000 and 20,000 bytes long.
Either or both values in a size range can end with "k" to
indicate thousands of bytes, "K" to indicate kilobytes (1,024
bytes), "m" to indicate millions of bytes, or "M" to indicate
megabytes (1,048,576 bytes). For example, the range above
could be rewritten as /[s10k,20k].
All ranges are inclusive. Both examples above will match
files that are exactly 10,000 bytes and 20,000 bytes long, as
well as all sizes in between.
The second argument of a size range is optional. If you use a
single argument, like /[s10k], you will select files of that
size or larger. You can also precede the second argument with
a plus sign [+]; when you do, it is added to the first value
to determine the largest file size to include in the search.
For example, /[s10k,+1k] select files from 10,000 through
11,000 bytes in size.
Some further examples of size ranges:
Specification Selects Files
/[s0,0] of length zero (empty)
/[s1M] 1 megabyte or more in length
/[s10k,+200] between 10,000 and 10,200 bytes
Date Ranges
Date ranges select files that were created or last modified at
any time between the two dates. For example,
/[d12-1-93,12-5-93] selects files that were last modified
between December 1, 1993, and December 5, 1993.
The time for the starting date defaults to 00:00:00 and the
time for the ending date defaults to 23:59:59. You can alter
these defaults, if you wish, by including a start and stop
time inside the date range. The time is separated from the
date with an at sign [@]. For example, the range
/[d7-1-94@8:00a,7-3-94@6:00p] selects files that were modified
at any time between 8:00 am on July 1, 1994 and 6:00 pm on
July 3, 1994. If you prefer, you can specify the times in 24-
hour format (e.g., @18:00 for the end time in the previous
example).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 63
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
If you omit the second argument in a date range, the command
processor substitutes the current date and time. For example,
/[d10-1-93] selects files dated between October 1, 1993 and
today.
You can use an offset value for either the beginning or ending
date, or both. An offset begins with a plus sign [+] or a
minus sign [-] followed by an integer. If you use an offset
for the second value, it is calculated relative to the first.
If you use an offset for the first (or only) value, the
current date is used as the basis for calculation. For
example:
Specification Selects Files
/[d10-27-93,+3] modified between 10-27-93 and
10-30-93
/[d10-27-93,-3] modified between 10-24-93 and
10-27-93
/[d-0] modified today (from today minus zero
days, to today)
/[d-1] modified yesterday or today (from
today minus one day, to today)
/[d-1,+0] modified yesterday (from today minus
one day, to zero days after that)
You cannot use offsets in the time portion of a date range
(the part after an at sign), but you can combine a time with a
date offset. For example, /[d12-8-93@12:00,+2@12:00] selects
files that were last modified between noon on December 8 and
noon on December 10, 1993. Similarly, /[d-2@15:00,+1] selects
files last modified between 3:00 pm the day before yesterday
and the end of the day one day after that, i.e., yesterday.
The second time defaults to the end of the day because no time
is given.
Time Ranges
A time range specifies a file modification time without
reference to the date. For example, to select files modified
between noon and 2:00 pm on any date, use /[t12:00p,2:00p].
The times in a time range can either be in 12-hour format,
with a trailing "a" for AM or "p" for PM, or in 24-hour
format.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 64
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
If you omit the second argument in a time range, you will
select files that were modified between the first time and the
current time, on any date. You can also use offsets,
beginning with a plus sign [+] or a minus sign [-] for either
or both of the arguments in a time range. The offset values
are interpreted as minutes. Some examples:
Specification Selects Files
/[t12:00p,+120] modified between noon and 2:00 PM on
any date
/[t-120,+120] modified between two hours ago and
the current time on any date
/[t0:00,11:59] modified in the morning on any date
Using Ranges
If you combine two types of ranges, a file must satisfy both
ranges to be included. For example, /[d2-8-94,2-9-94]
/[s1024,2048] means files last modified between February 8 and
February 9, 1994, which are also between 1,024 and 2,048 bytes
long.
When you use a date, time, or size range in a command, it
should immediately follow the command name. Unlike some
command switches which apply to only part of the command line,
the range usually applies to all file names specified for the
command. Any exceptions are noted in the descriptions of
individual commands.
For example, to get a directory of all the *.C files dated
October 1, 1993, you could use this command:
c:\> dir /[d10-1-93,+0] *.c
To delete all of the 0-byte files on your hard disk, you could
use this command:
c:\> del /[s0,0] *.* /s
And to copy all of the non-zero byte files that you changed
yesterday or today to your floppy disk, you can use this
command:
c:\> copy /[d-1] /[s1] *.* a:
Date, time, and size ranges can be used with the ATTRIB, COPY,
DEL, DESCRIBE, DIR, EXCEPT, FOR, LIST, MOVE, RD, REN, SELECT,
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 65
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
and TYPE commands. They cannot be used with filename
completion or in filename arguments for variable functions.
## It can be complex to type all of the elements of a range,
especially when it involves multiple dates and times. In this
case you may find it easier to use aliases for common
operations. For example, if you often wish to select from
.DAT files modified over the last three days and copy the
selected files to the floppy disk, you might define an alias
like this:
alias workback `select /[d-2] copy (*.dat) a:`
For more complex requirements, you may want to use internal
variables (e.g. _DATE or _TIME, see page 100) and variable
functions (e.g. @DATE, @TIME, @MAKEDATE, @MAKETIME, @FILEDATE,
@FILETIME, or @EVAL, see page 108). These variables and
functions allow you to perform arithmetic and date / time
calculations.
4OS2, The HPFS and NTFS file systems maintain 3 sets of dates and
4NT times for each file: creation, last access, and last
modification. By default, date and time ranges work with the
last modification time stamp. You can use the "last access"
(a) or "created" (c) time stamp in a date or time range with
the syntax:
/[da...] or /[dc...] or .. /[ta...] or /[tc...]
For example, to select files that were last accessed yesterday
or today:
/[da-1]
Multiple Filenames
Most file processing commands can work with multiple files at
one time. To use multiple file names, you simply list the
files one after another on the command line, separated by
spaces. You can use wildcards in any or all of the filenames.
For example, to copy all .TXT and .DOC files from the current
directory to drive A, you could use this command:
c:\> copy *.txt *.doc a:
If the files you want to work with are not in the default
directory, you must include the full path with each filename:
c:\> copy a:\details\file1.txt a:\details\file1.doc c:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 66
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Multiple filenames are handy when you want to match a group of
files which cannot be defined with a single filename and
wildcards. They let you be very specific about which files
you want to work with in a command.
! When you use multiple filenames with a command that expects
both a source and a destination, like COPY or MOVE, be sure
that you always include a specific destination on the command
line. If you don't, the command will assume that the last
filename is the destination and may overwrite important files.
Like extended wildcards and include lists (see below), the
multiple filename feature will work with internal commands but
not with external programs, unless those programs have been
written to handle multiple file names on the command line.
If you have a list of files to process that's too long to put
on the command line or too time-consuming to type, see the
SELECT command on page 313 for another way of passing multiple
file names to a command.
Include Lists
Any internal command that accepts multiple filenames will also
accept one or more include lists. An include list is simply a
group of filenames, with or without wildcards, separated by
semicolons [;]. All files in the include list must be in the
same directory. You may not add a space on either side of the
semicolon.
If you used an include list instead of multiple file names for
the previous examples, they would look like this:
c:\> copy *.txt;*.doc a:
c:\> copy a:\details\file1.txt;file1.doc c:
Include lists are similar to multiple filenames, but have
three important differences. First, you don't have to repeat
the path to your files if you use an include list, because all
of the included files must be in the same directory. Second,
if you use include lists, you aren't as likely to accidentally
overwrite files if you forget a destination path for commands
like COPY, because the last name in the list will be part of
the include list, and won't be seen as the destination file
name. (Include lists can only be used as the source parameter
- the location files are coming from - for COPY and other
similar commands. They cannot be used to specify a
destination for files.)
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 67
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Third, multiple filenames and include lists are processed
differently by the DIR and SELECT commands. If you use
multiple filenames, all of the files matching the first
filename are processed, then all of the files matching the
second name, and so on. When you use an include list, all
files that match any entry in the include list are processed
together, and will appear together in the directory display or
SELECT list. You can see this difference clearly if you
experiment with both techniques and the DIR command. For
example,
c:\> dir *.txt *.doc
will list all the .TXT files with a directory header, the file
list, and a summary of the total number of files and bytes
used. Then it will do the same for the .DOC files. However,
c:\> dir *.txt;*.doc
will display all the files in one list.
Like extended wildcards and multiple filenames (see above),
the include list feature will work with internal commands, but
not with external programs (unless they have been programmed
especially to support it).
Executable Extensions
Normally, when you type a filename (as opposed to an alias or
internal command name) as the first word on the command line,
the command processor looks for a file with that name to
execute. The file's extension may be .EXE or .COM to indicate
that it contains a program, or it may have a batch file
extension like .BTM (under OS/2, a file's contents may also
indicate that it is executable).
The exact list of default extensions for executable files
varies slightly depending on which operating system you use,
because each has its own rules for batch file extensions(see
20 page for details).
You can add to this default list of extensions, and have 4DOS,
4OS2, or 4DOS/NT take the action you want with files that are
not executable programs or batch files. The action taken is
always based on the file's extension. For example, you could
start your text editor whenever you type the name of a .DOC
file, or start your database manager whenever you type the
name of a .DAT file.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 68
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
Environment variables define the internal command, external
program, batch file, or alias to run for each defined file
extension. To create an executable extension, use the SET
command to create a new environment variable. An environment
variable is recognized as an executable extension if its name
begins with a period.
For example, if you want to run a word processor called EDITOR
whenever you type the name of a file that has an extension of
.EDT, you could use this command:
c:\> set .edt=c:\edit\editor.exe
The syntax for creating an executable extension is:
set .ext=command [options]
where .EXT is the executable file extension; command is the
name of the internal command, external program, alias, or
batch file to run; and [options] are any command-line startup
options you want to specify for the program, batch file, or
alias.
If the command is a batch file or external program, the
command processor will search the PATH for it if necessary.
However, you can make sure that the correct program or batch
file is used, and speed up the executable extension, by
specifying the full name including drive, path, filename, and
extension.
Once an executable extension is defined, any time you name a
file with that extension the corresponding program, batch
file, or alias is started, with the name of your file passed
to it as a parameter.
The following example defines QBASIC.EXE as the processor for
.BAS files:
c:\> set .bas=c:\dos\qbasic.exe /run
With this definition, if you have a file named PUSHCART.BAS in
the current directory and enter the command:
c:\> pushcart
the command processor will execute the command:
c:\dos\qbasic.exe /run pushcart.bas
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 69
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
The next example defines B.EXE (the Brief text editor) as the
processor for .C files:
c:\> set .c=c:\brief\b.exe -Mxyz
Now, if you have a file called HELLO.C and enter the command
c:\> hello -i30
This will be expanded to:
c:\brief\b.exe -Mxyz hello.c -i30
Notice that the text from the .C environment variable is
inserted at the beginning of the line, including any options,
followed by the original file name plus its extension, and
then the remainder of the original command line.
In order for executable extensions to work, the command,
program, batch file, or alias must be able to interpret the
command line properly. For example, if a program you want to
run doesn't accept a file name on its command line as shown in
these examples, then executable extensions won't work with
that program.
The search for executable files starts in the current
directory, then proceeds to each subdirectory specified by the
PATH environment variable (if a "." is used in the PATH the
current directory is not searched first; see the PATH command
on page 290 for details).
You may need to take this search order into account when using
executable extensions. Using the .BAS example above, if you
had a file named FORMAT.BAS in the current directory and
entered the command FORMAT A:, your command would run the
QBASIC processor specified by the executable extension,
instead of finding the standard DOS FORMAT command as you
intended. You can get around this by remembering that the DOS
FORMAT command is in the file FORMAT.COM. If you entered the
command FORMAT.COM A: then the .BAS executable extension would
not match, and the search would continue until it found the
FORMAT.COM file.
## Executable extensions may include wildcards, so you could, for
example, run your text editor for any file with an extension
beginning with T by defining an executable extension called
.T*. Extended wildcards (e.g., DO[CT] for .DOC and .DOT
files) may also be used.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 70
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
## Advanced Features
The next three features are designed for advanced users. If
you are a novice user, you might want to skim over this
section and return to it as your computing skills and needs
progress.
Conditional Commands
When an internal command or external program finishes, it
returns a result called the exit code. Conditional commands
allow you to perform tasks based upon the previous command's
exit code. Many programs return a 0 if they are successful
and a non-zero value if they encounter an error.
If you separate two commands by && (AND), the second command
will be executed only if the first returns an exit code of 0.
For example, the following command will only erase files if
the BACKUP operation succeeds:
c:\> backup c:\ a: && del c:\*.bak;*.lst
If you separate two commands by || (OR), the second command
will be executed only if the first returns a non-zero exit
code. For example, if the following BACKUP operation fails,
then ECHO will display a message:
c:\> backup c:\ a: || echo Error in the backup!
All internal commands return an exit code, but not all
external programs do. Conditional commands will behave
unpredictably if you use them with external programs which do
not return an explicit exit code.
Command Grouping
Command grouping allows you to logically group a set of
commands together by enclosing them in parentheses. The
parentheses are similar in function to the BEGIN and END block
statements in some programming languages.
There are two primary uses for command grouping. One is to
execute multiple commands in a place where normally only a
single command is allowed. For example, suppose you want to
copy then rename all the .WKQ files on drives A: and B: using
the FOR command. You could do it like this:
c:\> for %drv in (A B) do copy %drv:*.wkq d:\wksave\
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 71
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
c:\> for %drv in (A B) do ren %drv:*.wkq *.old
But with command grouping you can do the same thing in one
command (enter this on one line):
c:\> for %drv in (A B) do (copy %drv:*.wkq d:\wksave\
^ ren %drv:*.wkq *.sav)
The COPY and REN commands enclosed in the parentheses appear
to FOR as if they were a single command, so both commands are
executed for every element of the FOR list. (To try a command
like this under 4OS2 or 4DOS/NT, replace the caret [^] with an
ampersand [&].)
This kind of command grouping is most useful with the EXCEPT,
FOR, GLOBAL, and IF commands. You cannot use command grouping
to make SELECT execute several commands, because SELECT will
assume that the parentheses are marking the list of files from
which to select, and will display an error message or give
incorrect results if you try to use parentheses for command
grouping instead. (You can use a SELECT command inside the
command grouping parentheses, you just can't use command
grouping to specify a group of commands for SELECT to
execute.)
The second common use of command grouping is to redirect input
or output for several commands without repeatedly using the
redirection symbols. For example, consider the following
batch file fragment which places some header lines (including
today's date) and directory displays in an output file using
redirection. The first ECHO command creates the file using >,
and the other commands append to the file using >>:
echo Data files %_date > filelist
dir *.dat >> filelist
echo. >> filelist
echo Text files %_date >> filelist
dir *.txt >> filelist
Using command grouping, these commands can be written much
more simply. Enter this example on one line (use an ampersand
[&] as the command separator if you try this under 4OS2 or
4DOS/NT):
(echo Data files %_date ^ dir *.dat ^ echo. ^ echo Text
files %_date ^ dir *.txt) > filelist
The redirection, which appears outside the parentheses,
applies to all the commands within the parentheses. Because
the redirection is performed only once, the commands will run
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 72
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
slightly faster than if each command was entered separately.
The same approach can be used for input redirection and for
piping.
You can also use command grouping in a batch file or at the
prompt to split commands over several lines. This last
example is like the redirection example above, but is entered
at the prompt. Note the "More?" prompt after each incomplete
line. None of the commands are executed until the command
group is completed with the closing parenthesis. This example
does not have to be entered on one line:
c:\> (echo Data files %_date
More? dir *.dat
More? echo.
More? echo Text files %_date
More? dir *.txt) > filelist
c:\>
A group of commands in parentheses is like a long command
line. The total length of the group may not exceed 511
characters in 4DOS, or 2,047 characters in 4OS2 and 4DOS/NT,
whether the commands are entered from the prompt, an alias, or
a batch file. The limit includes the space required to expand
aliases and environment variables invoked within the group.
In addition, each line you type at the normal prompt or the
More? prompt, and each individual command within the line,
must meet the usual length limits: 255 characters in 4DOS, or
1,023 characters in 4OS2 and 4DOS/NT.
Escape Character
4DOS, 4OS2, and 4DOS/NT recognize a user-definable escape
character. This character gives the following character a
special meaning; it is not the same as the ASCII ESC that is
often used in ANSI and printer control sequences.
The default 4DOS escape character is Ctrl-X (ASCII 24), which
will be displayed on your screen as an up arrow (in this ASCII
version of our manual, <Ctrl-X> is used to represent this
character). The default 4OS2 and 4DOS/NT escape character is
a caret [^].
If you don't like using the default escape character, you can
pick another character using the SETDOS /E command (see page
324) or the EscapeChar directive in your .INI file (see page
138). If you plan to share aliases or batch files between
4DOS, 4OS2, and 4DOS/NT, see page 74 for details about
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 73
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
choosing compatible escape characters for two or more
products.
Eight special characters are recognized when they are preceded
by the escape character. The combination of the escape
character and one of these characters is translated to a
single character, as shown below. These are useful for
redirecting codes to the printer; <Ctrl-X>e is also useful to
generate ANSI "escape sequences" in your PROMPT, ECHO, or
other output commands; and <Ctrl-X>r can be used in keystroke
aliases. The special characters which can follow the escape
character are:
b backspace
c comma
e the ASCII ESC character (ASCII 27)
f form feed
n line feed
r carriage return
s space
t tab character
If you follow the escape character with any other character,
the escape character is removed and the second character is
copied directly to the command line. This allows you to
suppress the normal meaning of special characters (such as ? *
/ \ | " ` > < and &).
For example, to send a form feed followed by the sequence ESC
Y to the printer, you can use this command:
c:\> echos <Ctrl-X>f<Ctrl-X>eY > prn
4DOS, 4OS2, and 4DOS/NT Compatibility
4DOS, 4OS2, and 4DOS/NT are highly compatible with each other.
However, there are minor differences between them. These
differences are caused by the different requirements of each
operating system and by our design goal of maintaining
compatibility between each product and the default command
processor which it replaces.
We discuss the differences between our products in this manual
as part of the description of each feature and command. Most
of the differences are minor: different command line lengths,
a few different options in some commands, and some commands
that only make sense in one or two products.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 74
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
If you use two or more of our products, or if you want to
share aliases and batch files with users of different
products, you need to be aware of the differences in three
important characters: the Command Separator (see page 47),
the Escape Character (page 73), and the Parameter Character
(page 81).
The default values of each of these characters in each product
is shown in the following chart:
Character 4DOS Default 4OS2 and 4NT Default
----------------- ------------ --------------------
Command Separator ^ &
Escape Character <Ctrl-X> ^
Parameter Character & $
In your batch files and aliases, and even at the command line,
you can smooth over these differences in two ways:
* Select a consistent set of characters with .INI file
directives (see page 126) or the SETDOS command (page
322). For example, to set the 4DOS characters to
match 4OS2 and 4DOS/NT, use:
CommandSep = &
EscapeChar = ^
ParameterChar = $
in 4DOS.INI, or use the command:
SETDOS /C& /P$ /E<Ctrl-X>^
(Note the use of the old escape character [<Ctrl-X>]
before the new one [^]. This is because the new
escape character is also the old command separator,
and will be interpreted as the end of the command if
it does not have an escape character before it!)
* Use internal variables that contain the current
special character, rather than using the character
itself (see page 100). For example, this command:
if "%1" == "" (echo Argument missing! ^ quit)
will only work if the command separator is a caret.
However, this version works regardless of the current
command separator:
if "%1" == "" (echo Argument missing! %+ quit)
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 75
CHAPTER 3 / USING 4DOS, 4OS2, AND 4DOS/NT
-------------------------------------------------------------------
The following chart shows the correspondence between the
appropriate SETDOS command options, .INI file directives, and
internal variables:
Special SETDOS INI File Internal
Character Switch Directive Variable
----------------- ------ ---------- --------
Command Separator /C CommandSep %+
Escape Character /E EscapeChar %=
Parameter Character /P ParameterChar (none)
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 76
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
CHAPTER 4 / ALIASES AND BATCH FILES
This chapter introduces two of the most powerful features of 4DOS,
4OS2, and 4DOS/NT: aliases and batch files. It also discusses the
environment (a list of information available to all programs),
along with the command processor's internal variables and variable
functions. The discussion of the environment, variables, and
variable functions is included in this chapter because they are
most often used in aliases and batch files.
Aliases
Much of the power of 4DOS, 4OS2, and 4DOS/NT comes together in
aliases, which give you the ability to create your own
commands. An alias is a name that you select for a command or
group of commands. Simple aliases substitute a new name for
an existing command. More complex aliases can redefine the
default settings of internal or external commands, operate as
very fast in-memory batch files, and perform commands based on
the results of other commands.
This section of the manual will show you some examples of the
power of aliases. See the ALIAS command (page 161) for
complete details about writing your own aliases.
The simplest type of alias gives a new name to an existing
command. For example, you could create a command called ROOT
to switch to the root directory this way:
c:\> alias root = cd \
After the alias has been defined this way, every time you type
the command ROOT, you will actually execute the command CD \.
Aliases can also create customized versions of commands. For
example, the DIR command can sort a directory in various ways.
You can create an alias called DE that means "sort the
directory by filename extension, and pause after each page
while displaying it" like this:
c:\> alias de = dir /oe /p
Aliases can be used to execute sequences of commands as well.
The following command creates an alias called W which saves
the current drive and directory, changes to the WP directory
on drive C, runs the program E:\WP60\WP.EXE, and, when the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 77
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
program terminates, returns to the original drive and
directory:
c:\> alias w = `pushd c:\wp ^ e:\wp60\wp.exe ^ popd`
This alias is enclosed in back-quotes because it contains
multiple commands. You must use the back-quotes whenever an
alias contains multiple commands, environment variables,
parameters (see below), redirection, or piping. See the ALIAS
command for full details. Also, please note that throughout
this section we use the 4DOS command separator, a caret [^],
to separate multiple commands. If you are using 4OS2 or
4DOS/NT, substitute an ampersand [&] for the caret in the
examples.
Aliases can be nested, that is, one alias can invoke another.
For example, the alias above could also be written as:
c:\> alias wp = e:\wp60\wp.exe
c:\> alias w = `pushd c:\wp ^ wp ^ popd`
If you enter W as a command, the command processor will
execute the PUSHD command, detect that the next command (WP)
is another alias, and execute the program E:\WP60\WP.EXE, and
- when the program exits - return to the first alias, execute
the POPD command, and return to the prompt.
You can use aliases to change the default options for both
internal commands and external commands. Suppose that you
always want the DEL command to prompt before it erases a file:
c:\> alias del = *del /p
An asterisk [*] is used in front of the second "del" to show
that it is the name of an internal command, not an alias. See
page 163 for more information about this use of the asterisk.
You may have a program on your system that has the same name
as an internal command. Normally, if you type the command
name, you will start the internal command rather than the
program you desire, unless you explicitly add its full path on
the command line. For example, if you have a program named
LIST.COM in the C:\UTIL directory, you could run it with the
command C:\UTIL\LIST.COM. However, if you simply type LIST,
the internal LIST command will be invoked instead. Aliases
give you two ways to get around this problem.
First, you could define an alias that runs the program in
question, but with a different name:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 78
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
c:\> alias l = c:\util\list.com
Another approach is to rename the internal command and use the
original name for the external program. The following example
renames the LIST command as DISPLAY and then uses a second
alias to run LIST.COM whenever you type LIST:
c:\> alias display = *list
c:\> alias list = c:\util\list.com
You can also assign an alias to a key, so that every time you
press the key, the command will be invoked. You do so by
naming the alias with an at sign [@] followed by a key name.
After you enter this next example, you will see a 2-column
directory with paging whenever you press Shift-F5, then Enter:
c:\> alias @Shift-F5 = *dir /2/p
This alias will put the DIR command on the command line when
you press Shift-F5, then wait for you to enter file names or
additional switches. You must press Enter when you are ready
to execute the command. You can change this alias so that it
executes the command immediately, and does not display it on
the command line or wait for you to type a filename. To do
so, use two at signs at the start of the alias name:
c:\> alias @@Shift-F5 = *dir /2/p
The next example clears the screen whenever you press Alt-F1:
c:\> alias @@Alt-F1 = cls
Aliases have many other capabilities as well. This example
creates a simple command-line calculator. Once you have
entered the example, you can type CALC 4*19, for example, and
you will see the answer:
c:\> alias calc = `echo The answer is: %@eval[%&]`
Our last example in this section creates an alias called IN.
It will temporarily change directories, run an internal or
external command, and then return to the current directory
when the command is finished:
c:\> alias in = `pushd %1 ^ %2& ^ popd`
Now if you type
c:\> in c:\letters wp letter.txt
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 79
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
you will change to the C:\LETTERS subdirectory, execute the
command WP LETTER.TXT and then return to the current
directory.
Your copy of 4DOS, 4OS2, or 4DOS/NT includes a sample alias
file called ALIASES which contains several useful aliases and
demonstrates many alias techniques. Also, see the ALIAS and
UNALIAS commands on pages 161 and 350 for more information and
examples. See page 87 for tips about using aliases inside
your batch files.
Batch Files
A batch file is a file that contains a list of commands to
execute. 4DOS, 4OS2, and 4DOS/NT read and interpret each line
as if it had been typed at the keyboard. Like aliases, batch
files are handy for automating computing tasks. Unlike
aliases, batch files can be as long as you wish. Batch files
take up separate disk space for each file, and can't usually
execute quite as quickly as aliases, since they must be read
from the disk.
.BAT, .CMD, and .BTM Files
A batch file can run in two different modes. In the first,
traditional mode, each line of the batch file is read and
executed individually. In the second mode, the entire batch
file is read into memory at once. The second mode can be 5 to
10 times faster, especially if most of the commands in the
batch file are internal commands. However, only the first
mode can be used for self-modifying batch files (which are
rare), for batch files which install memory-resident utilities
under DOS, and for batch files larger than 64K bytes.
The batch file's extension determines its mode. Files with a
.BAT extension (in 4DOS and 4DOS/NT), or a .CMD extension (in
4OS2 and 4DOS/NT) are run in the slower, traditional mode.
Files with a .BTM extension are run in the faster, more
efficient mode. You can change the execution mode inside a
batch file with the LOADBTM command (see page 276).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 80
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
Echoing
By default, each line in a batch file is displayed or "echoed"
as it is executed. You can change this behavior, if you want,
in several different ways:
Any batch file line that begins with an [@] symbol will
not be displayed.
The display can be turned off and on within a batch file
with the ECHO OFF and ECHO ON commands.
The default setting can be changed with the SETDOS /V
command (see page 326) or the BatchEcho directive in the
.INI file (see page 137).
For example, the following line turns off echoing inside a
batch file. The [@] symbol keeps the batch file from
displaying the ECHO OFF command:
@echo off
Your command processor also has a command line echo that is
unrelated to the batch file echo setting. See the ECHO
command on page 223 for details about both settings.
Batch File Parameters
Like aliases and application programs, batch files can examine
the command line that is used to invoke them. The command
tail (everything on the command line after the batch file
name) is separated into individual parameters (also called
arguments or batch variables) by scanning for the spaces,
tabs, and commas that separate the parameters. A batch file
can work with the individual parameters or with the command
tail as a whole.
These parameters are numbered from %1 to %127. %1 refers to
the first parameter on the command line, %2 to the second, and
so on. It is up to the batch file to determine the meaning of
each parameter. You can use quotation marks to pass spaces,
tabs, commas, and other special characters in a batch file
parameter; see page 123 for details.
Parameters that are referred to in a batch file, but which are
missing on the command line, appear as empty strings inside
the batch file. For example, if you start a batch file and
put two parameters on the command line, any reference in the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 81
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
batch file to %3, or any higher-numbered parameter, will be
interpreted as an empty string.
A batch file can also work with three special parameters: %0
contains the name of the batch file as it was entered on the
command line, %# contains the number of command line
arguments, and in 4DOS %n& contains the complete command-line
tail starting with argument number "n" (for example, %3& means
the third parameter and all those after it). The default
value of "n" is 1, so %& contains the entire command tail.
The values of these special parameters will change if you use
the SHIFT command (see page 330).
4OS2, By default, 4OS2 and 4DOS/NT use a dollar sign [$] instead of
4NT an ampersand [&] to indicate the remainder of the command
tail. For example, %$ means all the parameters, and %2$ means
the second parameter and all those after it. If you want to
share batch files or aliases between 4DOS and these command
processors, you can select a new character for any product
with the SETDOS /P command (see page 325) or the ParameterChar
directive in your .INI file (see page 140).
For example, if your batch file interprets the first argument
as a subdirectory name then the following line would move to
the specified directory:
cd %1
A friendlier batch file would check to make sure the directory
exists and take some special action if it doesn't:
iff isdir %1 then ^ cd %1
else ^ echo Subdirectory %1 does not exist! ^ quit
endiff
(see the IF and IFF commands on pages 251 and 257).
## Batch files can also use environment variables, internal
variables, and variable functions. See pages 100 - 121 for a
complete list of the internal variables and variable functions
available. You can use these variables and functions to
determine system status (e.g., the type of CPU in the system),
resource levels (e.g., the amount of free disk space), file
information (e.g., the date and time a file was last
modified), and other information (e.g., the current date and
time). You can also perform arithmetic operations (including
date and time arithmetic), manipulate strings and substrings,
extract parts of a filename, and perform simple file access.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 82
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
## To create temporary variables for use inside a batch file,
just use the SET command to store the information you want in
an environment variable. Pick a variable name that isn't
likely to be in use by some other program (for example, PATH
would be a bad choice), and use the UNSET command (page 351)
to remove these variables from the environment at the end of
your batch file. You can use SETLOCAL (page 329) and ENDLOCAL
(page 226) to create a "local" environment so that the
original environment will be restored when your batch file is
finished.
## Environment variables used in a batch file may contain either
numbers or text. It is up to you to keep track of what's in
each variable and use it appropriately; if you don't (for
example, if you use %@EVAL to add a number to a text string),
you'll get an error message.
Batch File Commands
Several 4DOS, 4OS2, and 4DOS/NT commands are particularly
suited to batch file processing. Each command is explained in
detail in the Command Reference section of this manual,
beginning on page 153. Here is a list of some of the commands
you might find most useful:
BEEP produces a sound of any pitch and duration through
the computer's speaker.
CALL executes one batch file from within another.
CANCEL terminates all batch file processing.
CLS and COLOR set the screen display colors.
DO starts a loop. The loop can be based on a counter, or
on a conditional test like those used in IF and IFF.
DRAWBOX draws a box on the screen.
DRAWHLINE and DRAWVLINE draw horizontal and vertical
lines on the screen.
ECHO and ECHOS print text on the screen (the text can
also be redirected to a file or device).
GOSUB executes a subroutine inside a batch file. The
RETURN command terminates the subroutine.
GOTO branches to a different location in the batch file.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 83
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
FOR executes commands for each file that matches a set of
wildcards, or each entry in a list.
IF and IFF execute commands based on a test of string or
numeric values, program exit codes, or other conditions.
INKEY and INPUT collect keyboard input from the user and
store it in environment variables.
KEYSTACK places keystrokes into the 4DOS Keystack.
LOADBTM changes the batch file operating mode.
ON initializes error handling for Ctrl-C / Ctrl-Break, or
for program and command errors.
PAUSE displays a message and waits for the user to press
a key.
QUIT ends the current batch file and optionally returns
an exit code.
REM places a remark in a batch file.
SCREEN positions the cursor on the screen and optionally
prints a message at the new location.
SCRPUT displays a message in color.
SETLOCAL saves the current disk drive, default directory,
environment, and alias list. ENDLOCAL restores the
settings that were saved.
SHIFT changes the numbering of the parameters.
START starts another session or window in certain
multitasking environments.
TEXT displays a block of text. ENDTEXT ends the block.
TIMER starts or reads a stopwatch.
VSCRPUT displays a vertical message in color.
These commands, along with the internal variables and variable
functions, make the enhanced batch file language extremely
powerful. Your copy of 4DOS, 4OS2, or 4DOS/NT includes a
number of sample batch files, combined in the file
SAMPLES.BTM, that demonstrate some of the many things you can
do with batch files.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 84
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
Interrupting a Batch File
You can usually interrupt a batch file by pressing Ctrl-C or
Ctrl-Break. Whether and when these keystrokes are recognized
will depend on whether the command processor or an application
program is running, how the application (if any) was written,
whether BREAK is ON or OFF under DOS (see page 177), and
whether the ON BREAK command is in use (see page 288).
If 4DOS, 4OS2, or 4DOS/NT detects a Ctrl-C or Ctrl-Break (and
ON BREAK is not in use), it will display a prompt, for
example:
Cancel batch job C:\CHARGE.BTM ? (Y/N/A) :
Enter N to continue, Y to terminate the current batch file and
continue with any batch file which called it, or A to end all
batch file processing regardless of the batch file nesting
level. Answering Y is similar to the QUIT command (page 301);
answering A is similar to the CANCEL command (page 180).
Automatic Batch Files
4DOS, 4OS2, and 4DOS/NT support three "automatic" batch files,
files that run without your intervention, as long as the
command processor can find them.
Each time 4DOS, 4OS2, or 4DOS/NT starts as either a primary or
a secondary shell, it looks for an automatic batch file called
4START.BTM, 4START.BAT (for 4DOS), or 4START.CMD (for 4OS2 and
4DOS/NT). If the 4START batch file is not in the same
directory as your command processor itself, you should use the
4StartPath directive in your .INI file (see page 131) to
specify its location. 4START is optional, so the command
processor will not display an error message if it cannot find
the file.
4START is a convenient place to change the color or content of
the prompt for each shell, LOG the start of a shell, or put
other special startup or configuration commands. Under 4OS2
and 4DOS/NT, it is one way to set aliases and environment
variables (under 4DOS, these are normally set in
AUTOEXEC.BAT).
## With the exception of some 4DOS initialization switches, the
entire startup command line passed to the command processor is
available to 4START via batch file parameters (%1, %2, etc.).
This can be useful if you want to see the command line passed
to a secondary shell by an application. For example, to pause
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 85
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
if any parameters are passed to a secondary shell you could
include this command in 4START (enter this on one line):
if "%1" != "" .and. "%_shell" gt 0 pause Starting shell
%_shell with parameters [%&]
4DOS Whenever it is started as a primary shell, 4DOS runs
AUTOEXEC.BAT immediately after 4START. On a DOS system,
AUTOEXEC.BAT runs each time the computer boots up. (If
COMMAND.COM cannot find AUTOEXEC.BAT, it asks you for the time
and date. 4DOS skips that step and immediately displays a
prompt.)
Normally, AUTOEXEC.BAT must be in the root directory of the
boot drive. You can store it in a different location (and
even give it a different name) by using the 4DOS.INI directive
AutoExecPath (see page 131). You can also pass parameters to
AUTOEXEC.BAT using the AutoExecParms directive in 4DOS.INI.
4OS2 and 4DOS/NT do not execute AUTOEXEC.BAT.
Whenever a 4DOS, 4OS2, or 4DOS/NT shell ends, it runs a third
automatic batch file called 4EXIT.BTM, 4EXIT.BAT (for 4DOS),
or 4EXIT.CMD (for 4OS2 and 4DOS/NT). This file, if you use
it, should be in the same directory as your 4START batch file.
Like 4START, 4EXIT is optional. It is not necessary in most
circumstances, but it is a convenient place to put commands to
save information such as a history list before a shell ends,
or LOG the end of the shell.
Under 4DOS, 4START and 4EXIT should not load any memory
resident programs (TSRs). Otherwise, these three files can
include any commands that could be part of any batch file or
any commands which you could type from the command line.
## Detecting 4DOS, 4OS2, or 4DOS/NT
From a batch file, you can determine if 4DOS, 4OS2, or 4DOS/NT
is loaded by testing for the variable function @EVAL, with a
test like this:
if "%@eval[2+2]" == "4" echo 4DOS is loaded!
This test can never succeed in COMMAND.COM or CMD.EXE. Other
variable functions could be used for the same purpose.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 86
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
## Using Aliases in Batch Files
One way to simplify batch file programming is to use aliases
to hide unnecessary detail inside a batch file. For example,
suppose you want to implement a multiple choice list in a
batch file that will let you select among several different
applications. This example shows one way to do so:
alias in `pushd %1 ^ %2& ^ popd`
alias choice `elseiff "%userchoice"=="%1" then`
:dispmenu
screen 8 0
text
Enter your choice:
1. Word Processing
2. Spreadsheet
3. Communications
endtext
inkey %%userchoice
iff "1"=="2" then ^ rem Always fail and go to next line
choice 1 ^ in d:\letters c:\wp60\wp.exe
choice 2 ^ in d:\finance c:\quattro\q.exe
choice 3 ^ in d:\comm c:\comsw\pcplus.exe
else
scrput 23 0 bri whi on red Invalid choice, try again
goto dispmenu
endiff
unalias in choice
The first alias, IN, expects 2 or more command-line arguments.
It uses the first as a new working directory and changes to
that directory with a PUSHD command. The rest of the command
line is interpreted as another command plus possible command
line parameters, which the alias executes. This alias could
be used from the command line.
The second alias, CHOICE, expects one command-line argument.
It tests whether an environment variable called userchoice has
the same value as the command-line argument. This alias is
designed just for this particular batch file. If you try to
use CHOICE from the command line, you will see an error
because the alias uses ELSEIFF and THEN without the necessary
IFF and ENDIFF to define a block. (The last line of the batch
file "cleans up" by removing IN and CHOICE from the alias
list.)
The next 9 lines print a menu on the screen and then get a
keystroke from the user and store the keystroke in an
environment variable called userchoice. Then the batch file
tests the user's keystroke to decide what action to take.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 87
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
Since the CHOICE alias starts with an ELSEIFF command, there
has to be an IFF. But the first condition must fail in order
to get to the ELSEIFF command in the first CHOICE alias, so
the IFF statement starts with a condition that will always be
false. The three lines after the IFF are easy to follow and
much shorter than they would be without the aliases. If it
had to be typed in full, the first choice line would look like
this:
elseiff "%userchoice"=="1" then pushd d:\letters ^
c:\wp60\wp.exe ^ popd
There's another side to aliases in batch files. If you're
going to distribute your batch files to others, you need to
remember that they may have aliases defined for the commands
you're going to use. For example if the user has aliased CD
to CDD and you aren't expecting this, your file may not work
as you intended. There are two ways to address this problem.
First, you can use SETLOCAL, ENDLOCAL, and UNALIAS to clear
out aliases before your batch file starts and restore them at
the end. For example:
setlocal
unalias *
rem Aliases cleared, set up new aliases
alias ...
rem Other batch file commands go here
endlocal
Remember that SETLOCAL and ENDLOCAL will save and restore not
only the aliases but also the environment and the current
drive and directory.
If this method isn't appropriate or necessary for the batch
file you're working on, you can also use an asterisk [*]
before the name of any command. The asterisk means the
command that follows it should not be interpreted as an alias.
For example the following command redirects a list of file
names to the file FILELIST:
dir /b > filelist
However, if the user has redefined DIR with an alias this
command may not do what you want. To get around this just
use:
*dir /b > filelist
The same can be done for any command in your batch file. If
you use the asterisk, it will disable alias processing, and
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 88
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
the rest of the command will be processed normally as an
internal command, external command, or batch file. Using an
asterisk before a command will work whether or not there is
actually an alias defined with the same name as the command.
If there is no alias with that name, the asterisk will be
ignored and the command will be processed as if the asterisk
wasn't there.
## Debugging Batch Files
There are several tricks you can use in debugging batch files.
Probably the simplest is to turn ECHO on at the beginning of
the file while you're testing it, or use SETDOS /V2 to force
ECHO on even if an ECHO OFF command is used in the batch file.
This will give you a picture of what is happening as the file
is executed. It will make your output look messy of course,
so just turn it off once things are working. You can also
turn ECHO on at the beginning of a group of commands you want
to "watch", and off at the end, just by adding ECHO commands
at the appropriate spots in your file.
If an error occurs in a batch file, the error message will
display the name of the file, the number of the line that
contained the error, and the error itself. For example,
e:\test.bat [3] Invalid parameter "/d"
tells you that the file E:\TEST.BAT contains an error on line
3. The first line of the batch file is numbered 1.
You can also use the SETDOS /Y1 command to single step through
all or part of a batch file (see page 328). Insert the
command at the beginning of the portion of the batch file that
you wish to single-step through, and add a SETDOS /Y0 command
at the end of the section. After 4DOS, 4OS2, or 4DOS/NT
executes the SETDOS command, it will display each command
before it is executed, followed by a Y/N/R prompt. Press Y to
execute the command, N to skip the command and go on to the
next, or R or Esc to execute the remainder of the batch file
up to the next SETDOS /Y1 command without further prompting.
You can also press Ctrl-C or Ctrl-Break at the Y/N/R prompt to
halt execution of the remainder of the batch file and return
to the command processor prompt.
Another trick is to insert PAUSE commands wherever you need
them in order to be able to watch what's happening. For
complex debugging, you can make an alias that uses INKEY for a
similar purpose, but helps you out a little more. For example
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 89
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
(enter this on one line, and use an ampersand [&] as the
command separator if you are using 4OS2 or 4DOS/NT):
alias step `set skey=^ inkey Step: %%skey ^ iff
"%skey"=="S" then ^ set /P ^ elseiff "%skey"=="X"
then ^ quit ^ endiff`
Now anywhere you insert a STEP command in your file you'll get
the Step: prompt during execution. At that point you can type
S to do a SET /P and display the current contents of your
environment variables, X to exit the batch file, and any other
key to go on. (Of course you may need to modify this alias to
fit your particular needs.)
If you can't figure out how your aliases and variables are
expanded, try turning LOG on at the start of the batch file.
LOG keeps track of all commands after alias and variable
expansion are completed, and gives you a record in a file that
you can examine after the batch file is done. If you simply
want to see a record of what commands are executed, without
the expansion, use LOG /H.
You may also want to consider using redirection to capture
your batch file output. Simply type the batch file name
followed by the redirection symbols, for example:
c:\> mybatch >& testout
This records all batch file output, including error messages,
in the file TESTOUT, so you can go back and examine it. If
you have ECHO ON in the batch file you'll get the batch
commands intermingled with the output, which can provide a
very useful trace of what's happening. Of course, output from
full-screen commands and programs that don't write to the
standard output devices can't be recorded, but you can still
gain a lot of useful information if your batch file does much
output.
If you're using redirection to see the output, remember that
any prompts for input will probably go to the output file and
not to the screen, so you need to know in advance the sequence
of keystrokes required to get through the entire batch file,
and enter them by hand or with KEYSTACK. (As an example, the
raw text for the Guided Tour distributed with new copies of
4DOS, 4OS2, and 4DOS/NT was created by writing a 4DOS batch
file containing the demonstration commands, testing it to get
the proper keystroke sequence, and executing a command which
used KEYSTACK to send the keystrokes and redirected the batch
file's output to a disk file.)
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 90
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
## Batch File String Processing
As you gain experience with batch files, you're likely to find
that you need to manipulate text strings. You may need to
prompt a user for a name or password, process a list of files,
or find a name in a phone list. All of these are examples of
string processing - the manipulation of lines of readable
text.
4DOS, 4OS2, and 4DOS/NT include several features that make
string processing easier. For example, you can use the INKEY
and INPUT commands for user input; the ECHO, SCREEN, SCRPUT,
and VSCRPUT commands for output; and the FOR command or the
@FILEREAD function to scan through the lines of a file. In
addition, variable functions offer a wide range of string
handling capabilities (see page 108 for full details).
For example, suppose you need a batch file that will prompt a
user for a name, break the name into a first name and a last
name, and then run a hypothetical LOGIN program. LOGIN
expects the syntax /F:first /L:last with both the first and
last names in upper case and neither name longer than 8
characters. Here is one way to write such a program:
@echo off
setlocal
unalias *
input Enter your name (no initials): %%name
set first=%@word[%name,0]
set flen=%@len[%first]
set last=%@word[%name,1]
set llen=%@len[%last]
iff %flen gt 8 .or. %llen gt 8
echo First or last name too long
quit
endiff
login /F:%@upper[%first] /L:%@upper[%last]
endlocal
The SETLOCAL command at the beginning of this batch file saves
the environment and aliases. Then the UNALIAS * command
removes any existing aliases so they won't interfere with the
behavior of the commands in the remainder of the batch file
(you can accomplish the same thing by using an asterisk [*] in
front of each command). The first block of lines ends with an
INPUT command which asks the user to enter a name. The user's
input is stored in the environment variable NAME.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 91
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
The second block of lines extracts the user's first and last
names from the NAME variable and calculates the length of
each. It stores the first and last name, along with the
length of each, in additional environment variables. Note
that the @WORD function numbers the first word as 0, not as 1.
The IFF command in the third block of lines tests the length
of both the first and last names. If either is longer than 8
characters, the batch file displays an error message and ends.
Finally, in the last block, the batch file executes the LOGIN
program with the appropriate parameters, then uses the
ENDLOCAL command to restore the original environment and alias
list. At the same time, ENDLOCAL discards the temporary
variables that the batch file used (NAME, FIRST, FLEN, etc.).
When you're processing strings, you also need to avoid some
common traps. The biggest one is handling special characters.
Suppose you have a batch file with these two commands, which
simply accept a string and display it:
input Enter a string: %%str
echo %str
Those lines look safe, but what happens if the user enters the
string "some > none" (without the quotes). After the string
is placed in the variable STR, the second line becomes
echo some > none
The ">" is a redirection symbol, so the line echoes the string
"some" and redirects it to a file called NONE - probably not
what you expected. You could try using quotation marks (see
page 123) to avoid this kind of problem, but that won't quite
work. If you use back-quotes (ECHO `%STR`), the command will
echo the four-character string %STR. Environment variable
names are not expanded (replaced by their contents, see page
121) when they are inside back-quotes.
If you use double quotes (ECHO "%STR"), the string entered by
the user will be displayed properly, and so will the quotation
marks. With double quotes, the output would look like this:
"some > none"
As you can imagine, this kind of problem becomes much more
difficult if you try to process text from a file. Special
characters in the text can cause all kinds of confusion in
your batch files. Text containing back-quotes, double quotes,
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 92
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
or redirection symbols can be virtually impossible to handle
correctly.
One way to overcome these potential problems is to use the
SETDOS /X command (see page 327) to temporarily disable
redirection symbols and other special characters. The two-
line batch file above would be a lot more likely to produce
the expected results if it were rewritten this way:
setdos /x-15678
input Enter a string: %%str
echo %str
setdos /x0
The first line turns off alias processing and disables several
special symbols, including the command separator and all
redirection symbols. Once the string has been processed, the
last line re-enables the features that were turned off in the
first line.
If you need advanced string processing capabilities beyond
those provided by 4DOS, 4OS2, and 4DOS/NT, you may want to
consider using the REXX language. Our products support
external REXX programs for this purpose; see page 95 for
additional details.
## Batch File Compression
You can compress your .BTM files with a program called
BATCOMP.EXE, which is distributed with 4DOS, 4OS2, and
4DOS/NT. This program condenses batch files by about a third
and makes them unreadable with the LIST command and similar
utilities. Compressed batch files run at approximately the
same speed as regular .BTM files.
You may want to consider compressing batch files if you need
to distribute them to others and keep your original code
secret or prevent your users from altering them. You may also
want to consider compressing batch files to save some disk
space on the systems where the compressed files are used.
(However, you will not save space if you keep your compressed
batch files on a disk compressed with a program like DBLSPACE,
Stacker, or SuperStor.)
The full syntax for the batch compression program is
BATCOMP [/O] input file [output file]
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 93
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
You must specify the full name of the input file, including
its extension, on the BATCOMP command line. If you do not
specify the output file, BATCOMP will use the same base name
as the input file and add a .BTM extension. BATCOMP will also
add a .BTM extension if you specify a base name for the output
file without an extension. For example, to compress
MYBATCH.BAT and save the result as MYBATCH.BTM, you can use
any of these three commands:
c:\> batcomp mybatch.bat
c:\> batcomp mybatch.bat mybatch
c:\> batcomp mybatch.bat mybatch.btm
If the output file (MYBATCH.BTM in the examples above) already
exists, BATCOMP will prompt you before overwriting the file.
You can disable the prompt by including /O on the BATCOMP
command line immediately before the input file name. Even if
you use the /O option, BATCOMP will not compress a file into
itself.
JP Software does not provide a decompression utility to
uncompress batch files. If you use BATCOMP.EXE, make sure
that you also keep a copy of the original batch file for
future inspection or modification.
You can adopt one of two strategies for keeping track of your
original source files and compressed batch files. First, you
may want to create the source files with a traditional .BAT or
.CMD extension and reserve the .BTM extension for compressed
batch files. The advantage of this approach is that you can
modify and test the uncompressed versions at any time,
although they will run in the slower, traditional mode unless
they begin with a LOADBTM command (see page 276).
If you prefer, you can use a .BTM extension for both the
source and compressed files. In this case you will have to
use a different base name for each file. For example, you
might use MYBATCHS.BTM for the source file and MYBATCH.BTM for
the compressed file. This may make it more difficult to keep
track of the correspondence between the source file and the
compressed file, but it allows both files to run automatically
in the high-speed .BTM mode.
Each of our command processors includes its own version of
BATCOMP.EXE, set up to run under the corresponding operating
system. However, the output produced by each program is the
same, so a batch file compressed with any version of BATCOMP
can be used with any JP Software command processor.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 94
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
If you plan to distribute batch files to users of different
platforms, be sure to read the compatibility discussion on
74 page .
## REXX Support
REXX is a a powerful file and text processing language
developed by IBM, and available on many PC and other
platforms. You can invoke REXX programs from 4DOS, 4OS2, or
4DOS/NT. REXX is an ideal extension to the 4DOS, 4OS2, and
4DOS/NT batch language, especially if you need advanced string
processing capabilities.
The REXX language is not built into 4DOS, 4OS2, or 4DOS/NT.
Under DOS and Windows NT, you must have a copy of Personal
REXX from Quercus Systems in Saratoga, CA in order to use the
REXX language. Under IBM OS/2 1.3 and above you can use the
built-in REXX language provided by IBM, or use Quercus's
Personal REXX for OS/2. (Personal REXX is available from JP
Software or directly from Quercus Systems.)
4DOS Under 4DOS, REXX programs are stored in .REX files. To enable
REXX support you must install Personal REXX, and define an
executable extension (see page 68) that tells 4DOS to load
Personal REXX when you invoke a .REX file. For example:
set .rex=c:\prexx\rexx.exe
4OS2 Under 4OS2, REXX programs are stored in .CMD files. 4OS2
checks to see if the first two characters on the first line of
a .CMD file are [/*], the beginning of a REXX comment. If so,
it passes the file to OS/2's built-in REXX facility for
processing. If Personal REXX for OS/2 is installed, it
automatically replaces OS/2's built-in REXX, and handles all
REXX commands passed by 4OS2.
4NT Under 4DOS/NT, REXX programs may be stored in .CMD or .REX
files. 4DOS/NT checks to see if the first two characters on
the first line of a .CMD or .REX file are [/*]. If so, it
passes the file to Personal REXX for Windows NT for
processing. You must have Personal REXX for Windows NT
installed to enable 4DOS/NT's REXX support.
Both Personal REXX and OS/2's built-in REXX extend the
interface between REXX and the command processor by allowing
you to invoke 4DOS, 4OS2, or 4DOS/NT commands from within a
REXX program. For details, or for more information on any
aspect of REXX, see your Personal REXX or OS/2 REXX
documentation.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 95
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
4OS2, ## EXTPROC Support
4NT
4OS2 and 4DOS/NT offer an external processor (EXTPROC) option
for batch files that lets you define an external program to
process a particular .CMD file. To identify a .CMD file to be
used with an external processor, place the string "EXTPROC" as
the first word on the first line of the file, followed by the
name of the external program that should be called. The
command processor will start the program and pass it the name
of the .CMD file and any command-line arguments that were
entered.
For example, suppose GETDATA.CMD contains the following lines:
EXTPROC D:\DATAACQ\DATALOAD.EXE
OPEN PORT1
READ 4000
DISKWRITE D:\DATAACQ\PORT1\RAW
Then if you entered the command:
[d:\dataacq] getdata /p17
The command processor would read the GETDATA.CMD file,
determine that it began with an EXTPROC command, read the name
of the processor program, and then execute the command:
D:\DATAACQ\DATALOAD.EXE D:\DATAACQ\GETDATA.CMD /p17
The hypothetical DATALOAD.EXE program would then be
responsible for reopening the GETDATA.CMD file, ignoring the
EXTPROC line at the start, and interpreting the other
instructions in the file. It would also have to respond
appropriately to the command-line parameter entered (/p17).
Do not try to use 4OS2 or 4DOS/NT as the external processor
named on the EXTPROC line in the .CMD file. They will
interpret the EXTPROC line as a command to re-open themselves.
The result will be an infinite loop that will continue until
the computer runs out of resources and locks up.
Using the Environment
The environment is a collection of information about your
computer that every program receives. Each entry in the
environment consists of a variable name, followed by an equal
sign and a string of text. You can automatically substitute
the text for the variable name in any command. To create the
substitution, include a percent sign [%] and a variable name
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 96
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
on the command line or in an alias or batch file. For
example, you can create a variable named BACKUP like this:
c:\> set BACKUP=*.bak;*.bk!;*.bk
If you then type
c:\> del %BACKUP
it is equivalent to the following command:
del *.bak;*.bk!;*.bk
## The variable names you use this way may contain any alphabetic
or numeric characters, the underscore character [_], and the
dollar sign [$]. You can force acceptance of other characters
by including the full variable name in square brackets, like
this: %[AB##2]. You can also "nest" environment variables
using square brackets. For example %[%var1] means "the
contents of the variable whose name is stored in VAR1". A
variable referenced with this technique cannot contain more
than 255 characters of information. Nested variable expansion
can be disabled with the SETDOS /X command (see page 327).
In 4DOS, the size of the environment is specified by the
Environment and EnvFree directives in 4DOS.INI (see page 132)
or by the /E: startup switch (see the 4DOS Introduction and
Installation Guide). In 4OS2 and 4DOS/NT the size of the
environment is set automatically.
## Environment variables may contain alias names. The command
processor will substitute the variable value for the name,
then check for any alias name which may have been included
within the variable's value. For example, the following
commands would generate a 2-column directory of the .TXT
files:
c:\> alias d2 dir /2
c:\> set cmd=d2
c:\> %cmd *.txt
## The trailing percent sign that was traditionally required for
environment variable names is not usually required in 4DOS,
4OS2, or 4DOS/NT, which accept any character that cannot be
part of a variable name as the terminator. However, the
trailing percent can be used to maintain compatibility.
The trailing percent sign is needed if you want to join two
variable values. The following examples show the possible
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 97
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
interactions between variables and literal strings. First,
create two environment variables called ONE and TWO this way:
c:\> set ONE=abcd
c:\> set TWO=efgh
Now the following combinations produce the output text shown:
%ONE%TWO abcdTWO ("%ONE%" + "TWO")
%ONE%TWO% abcdTWO ("%ONE%" + "TWO%")
%ONE%%TWO abcdefgh ("%ONE%" + "%TWO")
%ONE%%TWO% abcdefgh ("%ONE%" + "%TWO%")
%ONE%[TWO] abcd[TWO] ("%ONE%" + "[TWO]")
%ONE%[TWO]% abcd[TWO] ("%ONE%" + "[TWO]%")
%[ONE]%TWO abcdefgh ("%[ONE]" + "%TWO")
%[ONE]%TWO% abcdefgh ("%[ONE]" + "%TWO%")
## If you want to pass a percent sign to a command, or a string
which includes a percent sign, you must use two percent signs
in a row. Otherwise, the single percent sign will be seen as
the beginning of a variable name and will not be passed on to
the command. For example, to display the string "We're with
you 100%" you would use the command:
echo We're with you 100%%
You can also use back-quotes around the text, rather than a
double percent sign. See page 123 for details.
4DOS Each copy of the command processor maintains its own copy of
the environment. The copy of the environment maintained by
the primary shell is called the master environment. When
using a secondary shell, 4DOS will allow you to access the
master environment in the primary shell with the commands SET
/M (page 319), UNSET /M (page 351), and ESET /M (page 227),
and with the %@MASTER variable function (page 118). Master
environment access is not available in 4OS2 or 4DOS/NT.
Configuration Variables
The following environment variables have special meanings in
4DOS, 4OS2, and 4DOS/NT.
CDPATH tells the command processor where to search for
directories specified by the CD, CDD, and PUSHD commands
and in automatic directory changes. (_CDPATH can be used
as an alternative to CDPATH if you are using Microsoft
Bookshelf, which uses a CDPATH variable for its own
purposes.) CDPATH is composed of a list of directories,
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 98
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
separated by semicolons [;]. See page 44 for more
information about using CDPATH.
CMDLINE is the fully expanded text of the currently
executing command line. CMDLINE is set just before
invoking any .COM, .EXE, .BTM, .BAT, or .CMD file. If a
command line is prefaced with an "@" to prevent echoing
(see page 38), it will not be put in CMDLINE, and any
previous CMDLINE variable will be removed from the
environment. Under DOS, this allows you to squeeze out
the last few bytes of environment space before loading
TSRs by prefacing each TSR command with an "@".
COLORDIR controls directory display colors used by DIR
and SELECT. See page 30 for a complete description of
the format of this variable.
COMSPEC contains the full path and name of the command
processor. COMSPEC is most commonly used by applications
which have a "shell to the command prompt" feature. For
details on how COMSPEC is set and used, see your
Introduction and Installation Guide.
DIRCMD is used by some versions of COMMAND.COM and
CMD.EXE to hold default options for the DIR command.
4DOS and its cousins do not support this variable, but
you can achieve the same effect with an alias. For
example, if you want the DIR command to default to a 2-
column display with a vertical sort and a pause at the
end of each page, you could use this alias:
c:\> alias dir = `*dir /2/p/v`
If you wish to continue to use DIRCMD for compatibility
with systems that do not use 4DOS, you can define the
alias this way:
c:\> alias dir = `*dir %dircmd`
PATH is a list of directories that 4DOS, 4OS2, or 4DOS/NT
will search for executable files that aren't in the
current directory. PATH may also be used by some
application programs to find their own files. See page
20 and the PATH command on page 290 for a full
description of this variable.
PROMPT defines the command-line prompt. It can be set or
changed with the PROMPT command (see page 295).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 99
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
4DOS TEMP specifies the directory where 4DOS should store
temporary pipe files if the TEMP4DOS variable doesn't
exist. Some other programs also use TEMP to define where
they should place their temporary files. Temporary pipe
files are not used in 4OS2 and 4DOS/NT.
4DOS TEMP4DOS specifies where 4DOS should store temporary pipe
files. Temporary pipe files are not used in 4OS2 and
4DOS/NT.
4NT In addition, 4DOS/NT uses the environment to keep track of the
default directory on each drive or hard disk volume. DOS and
OS/2 keep track of the default directory for each drive letter
internally; Windows NT does not. 4DOS/NT overcomes this
incompatibility by saving the default directory for each drive
in the environment, using variable names that cannot be
accessed by the user. Each variable begins with an equal sign
followed by the drive letter and a colon (for example, =C:).
You can view these variables with the SET command, but you
cannot change them with any of the commands in 4DOS/NT.
## Internal Variables
Internal variables are special environment variables built
into 4DOS, 4OS2, and 4DOS/NT to provide information about your
system. They are not actually stored in the environment, but
can be used in commands, aliases, and batch files just like
any other environment variable. The values of these variables
are stored internally in the command processor, and cannot be
changed with the SET, UNSET, or ESET command. However, you
can override any of these variables by defining a new variable
with the same name.
These internal variables are often used in batch files and
aliases to examine system resources and adjust to the current
computer settings. You can examine the contents of any
internal variable (except %= or %+) from the command line with
a command like this:
c:\> echo %variablename
The variables are listed below. The first list is by
category, to assist you in locating the information you want
quickly. The second list includes all the variables in
alphabetical order, and defines the meaning of each one.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 100
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
Internal Variable Categories
Hardware status:
_APMAC _APMBATT _APMLIFE _CPU
_KBHIT _MONITOR _NDP _VIDEO
Operating system and software status:
_ANSI _BOOT _CODEPAGE _COUNTRY
_DOS _DOSVER _DPMI _DV
_MOUSE _WIN _WINDIR _WINSYSDIR
_WINVER
Command processor status:
_4VER _ALIAS _BATCH _BATCHLINE
_BATCHNAME _DNAME _ENV _HLOGFILE
_KSTACK _LOGFILE _PID _PIPE
_PPID _PTYPE _SHELL _SID
_SWAPPING _TRANSIENT _WINTITLE
Screen and color:
_BG _COLUMN _COLUMNS _FG
_ROW _ROWS
Drives and directories:
_CWD _CWDS _CWP _CWPS
_DISK _LASTDISK
Dates and times:
_DATE _DAY _DOW _DOY
_HOUR _MINUTE _MONTH _SECOND
_TIME _YEAR
Error codes:
? ?? _? _SYSERR
Compatibility:
= +
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 101
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
Internal Variable Details
(In the list below the possible values for most variables are
shown in double quotes for ease of understanding. The actual
values returned by the variables do not include the double
quotes.)
? contains the exit code of the last external command. Many
programs return a "0" to indicate success and a non-zero value
to signal an error. However, not all programs return an exit
code. If no explicit exit code is returned, the value of %?
is undefined.
4DOS ?? returns a code which explains how the last program
terminated:
0 - program terminated normally.
1 - program terminated by Ctrl-C or Ctrl-Break.
2 - program terminated due to a critical error.
3 - program terminated and stayed resident in memory
(TSR).
_? contains the exit code of the last internal command. It is
set to "0" if the command was successful, "1" if a usage error
occurred, "2" if another command processor error or an
operating system error occurred, or "3" if the command was
interrupted by Ctrl-C or Ctrl-Break. You must use or save
this value immediately, because it is set by every internal
command.
= returns the current escape character. Use this variable,
instead of the actual escape character, if you want your batch
files and aliases to work regardless of how the escape
character is defined. For example, if the escape character is
a caret [^] (the default in 4OS2 and 4DOS/NT), both of the
commands below will send a form feed to the printer. However,
if the escape character has been changed, the first command
will send the string "^f" to the printer, while the second
command will continue to work as intended.
echos ^f > prn
echos %=f > prn
+ returns the current command separator. Use this variable,
instead of the actual command separator, if you want your
batch files and aliases to work regardless of how the command
separator is defined. For example, if the command separator
is an ampersand [&] (the default in 4OS2 and 4DOS/NT), both of
the commands below will display "Hello" on one line and
"world" on the next. However, if the command separator has
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 102
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
been changed the first command will display "Hello & echo
world", while the second command will continue to work as
intended.
echo Hello & echo world
echo Hello %+ echo world
_4VER is the current 4DOS, 4OS2, or 4DOS/NT version (for
example, "5.0").
4DOS _ALIAS contains the free space in the alias list, in bytes.
_ANSI contains "1" if internal flags indicate that ANSI.SYS or
a compatible driver is installed; "0" if not.
4OS2 4OS2 always enables OS/2's ANSI support, and assumes that it
remains enabled. Therefore _ANSI always returns "1" in 4OS2.
4NT Under 4DOS/NT, _ANSI always returns "0", because there is no
ANSI support in Windows NT.
4DOS In 4DOS, the internal flags which determine the value of _ANSI
depend on the SETDOS /A option (see page 323) and the ANSI
directive in 4DOS.INI (see page 137), as shown in the table
below. If SETDOS /A is 0 or ANSI is set to Auto, 4DOS tests
for the presence of an ANSI driver. In this case you may need
to experiment to see if this variable works properly with your
particular driver, because there is no standard and 100%
reliable way to detect an ANSI driver. See page 25 for more
information on ANSI drivers.
SETDOS /A ANSI Directive _ANSI Value
0 (default) Auto (default) Result of test
1 Yes 1
2 No 0
4DOS _APMAC is the Advanced Power Management AC line status ("on",
"off", or "unknown"). An empty string is returned if APM is
not installed on your system. (See the Glossary on page 381
for a short description of APM.)
4DOS _APMBATT is the Advanced Power Management battery status
("high", "low", "critical", "charging", or "unknown"). An
empty string is returned if APM is not installed.
4DOS _APMLIFE is the Advanced Power Management remaining battery
life (0 - 100 or "unknown"). An empty string is returned if
APM is not installed.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 103
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
_BATCH is the current batch nesting level. It is "0" if no
batch file is currently being processed.
_BATCHLINE is the current line number in the current batch
file. It is "-1" if no batch file is currently being
processed.
_BATCHNAME is the full pathname of the current batch file. It
is an empty string if no batch file is currently being
processed.
_BG is a string containing the first three characters of the
screen background color at the current cursor location (for
example, "Bla").
_BOOT is the boot drive letter, without a colon.
_CODEPAGE is the current code page number (see CHCP on page
). 184
_COLUMN is the current cursor column (for example, "0" for the
left side of the screen).
_COLUMNS is the current number of screen columns (for example,
"80").
_COUNTRY is the current country code.
_CPU is the CPU type:
86 8086 and 8088 386 i386
186 80186 and 80188 486 i486
200 NEC V20 and V30 586 Pentium
286 80286
_CWD is the current working directory in the format
d:\pathname.
_CWDS has the same value as CWD, except it ends the pathname
with a backslash [\].
_CWP is the current working directory in the format \pathname.
_CWPS has the same value as CWP, except it ends the pathname
with 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).
_DAY is the day of the month (1 to 31).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 104
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
_DISK is the current disk drive, without a colon (for example,
"C").
_DNAME is the name of the file used to store file
descriptions. It can be changed with the DescriptionName
directive in the .INI file (see page 148).
_DOS is the operating system type ("DOS", "OS2", or "NT").
4DOS always returns "DOS", 4OS2 always returns "OS2", and
4DOS/NT always returns "NT". This may be useful if you have
batch files running under more than one operating system.
_DOSVER is the current operating system version (for example,
"6.0"). When running 4DOS in an OS/2 DOS session the version
number will be 10.3 for OS/2 1.3, 20.1 for OS/2 2.1, and so
on.
_DOW is the first three characters of the current day of the
week ("Mon", "Tue", "Wed", etc.).
_DOY is the day of the year (1 to 366).
4DOS _DPMI returns the DPMI version number, or "0" if DPMI isn't
present. (See the Glossary on page 381 for a short description
of DPMI.)
4DOS _DV is "1" if DESQview is loaded or "0" otherwise.
4DOS _ENV is the free space in the environment, in bytes.
_FG is a string containing the first three letters of the
screen foreground color at the current cursor position (for
example, "Whi").
_HLOGFILE returns the name of the current history log file
(or an empty string if LOG /H is OFF).
_HOUR is the current hour (0 - 23).
_KBHIT returns "1" if one or more keystrokes are waiting in
the keyboard buffer, or "0" if the keyboard buffer is empty.
4DOS _KSTACK returns "1" if KSTACK.COM is loaded or "0" otherwise.
_LASTDISK is the last valid drive letter, without a colon.
_LOGFILE returns the name of the current log file (or an
empty string if LOG is OFF).
_MINUTE is the current minute (0 - 59).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 105
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
4DOS, _MONITOR is the monitor type ("mono" or "color").
4OS2
_MONTH is the month of the year (1 to 12).
_MOUSE is "1" if a mouse driver is loaded, and "0" otherwise.
_NDP is the coprocessor type:
0 no coprocessor is installed
87 8087
287 80287
387 80387, 80486DX, or Pentium
4OS2 _PID is the current process ID number.
4OS2, _PIPE returns "1" if the current process is running inside a
4NT pipe or "0" otherwise.
4OS2 _PPID is the process ID number of the parent process.
4OS2 _PTYPE is the current OS/2 process type:
AVIO Character mode, windowed
DT Detached (no screen in use)
FS Character mode, full-screen
PM Presentation Manager
_ROW is the current cursor row (for example, "0" for the top
of the screen).
_ROWS is the current number of screen rows (for example,
"25").
_SECOND is the current second (0 - 59).
_SHELL is the current shell nesting level. The primary shell
is level "0", and each subsequent secondary shell increments
the level by 1.
4OS2 _SID is the session ID number.
4DOS _SWAPPING returns the current swapping state. The return
value is "OFF" if swapping has been disabled with the SWAPPING
command, "EMS" if expanded memory is being used, "XMS" if
extended memory is being used, or "Disk" if 4DOS is using disk
swapping. The return value is "None" if swapping has been
disabled with the 4DOS.INI Swapping directive or if 4DOS
failed to initiate memory or disk swapping during
initialization.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 106
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
_SYSERR is the error code of the last operating system error.
You will need a technical or programmer's manual to understand
these error values.
_TIME contains the current system time in the format hh:mm:ss.
The separator character may vary depending upon your country
information.
_TRANSIENT is "1" if the current shell is transient (started
with a /C, see your Introduction and Installation Guide for
details), or "0" otherwise.
4DOS, _VIDEO is the video card type ("mono", "cga", "ega", or
4OS2 "vga").
_WIN is the current Microsoft Windows mode. This variable
will always be zero except when 4DOS is running under
Microsoft Windows:
0 Windows is not running
1 Windows 2
2 Windows 3 in 386 enhanced mode
3 Windows 3 in real or standard mode
4NT _WINDIR returns the name of the Windows NT directory.
4NT _WINSYSDIR returns the name of the Windows NT system
directory.
_WINTITLE returns the title of the current window. This
variable is valid in 4OS2 and 4DOS/NT, and in 4DOS when it is
running in a DOS session under OS/2. If you are using 4DOS
running under DOS or DOS plus Windows, the return value is an
empty string.
4NT _WINVER returns the current Windows NT version number.
_YEAR is the current year (1980 to 2099).
For FAT drives under DOS, OS/2, and Windows NT 3.1 the _CWD,
_CWDS, _CWP, _CWPS, and _DISK variables will return their
result in upper or lower case depending on the value of the
SETDOS /U switch (see page 326) or the UpperCase directive in
the .INI file (see page 141). On HPFS and NTFS drives, and on
FAT drives under Windows NT 3.5 and above,these variables will
return names as they are stored on the disk, and no case
shifting will be performed (see page 17 for more details).
You can use these variables in a wide variety of ways
depending on your needs. Here are just a few examples. Some
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 107
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
of these examples rely on the IF command (page 251) or the IFF
command (page 257) to test the value of a variable and perform
different actions based on that value.
In a 4DOS or 4OS2 batch file, set the color based on the video
card type:
iff "%_video"=="mono" then
color bright white on black
else
color bright white on blue
endiff
Call another batch file if 4DOS is running under DESQview:
if "%_dv" == "1" call dvstart
Store the current date and time in a file, then save the
output of a DIR command in the same file:
echo Directory as of %_date %_time > dirsave
dir >> dirsave
Set up a prompt for the primary shell which displays the time
and current directory, and a different one for secondary
shells which includes the shell level rather than the time
(see PROMPT on page 295 for details about setting the prompt).
Also set different background colors for the two shells,
without changing the foreground color. You might use a
sequence like this in your 4START file (see page 85):
iff %_shell==0 then
prompt $t $p$g
color %_fg on blue
else
prompt [$z] $p$g
color %_fg on cyan
endiff
## Variable Functions
Variable functions are like internal variables, but they take
one or more arguments (which can be environment variables or
even other variable functions) and they return a value.
Like all environment variables, these variable functions must
be preceded by a percent sign in normal use (%@EVAL, %@LEN,
etc.). All variable functions must have square brackets
enclosing their argument(s). The argument(s) to a variable
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 108
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
function cannot exceed 255 characters in length for all
arguments taken as a group.
The variable functions are useful in aliases and batch files
to check on available system resources, manipulate strings and
numbers, and work with filenames.
Some variable functions, like @DISKFREE, are shown with
"b|k|m" as one of their arguments. Those functions return a
number of bytes, kilobytes, or megabytes based on the "b|k|m"
argument:
b return the number of bytes
K return the number of kilobytes (bytes / 1,024)
k return the number of thousands of bytes (bytes /
1,000)
M return the number of megabytes (bytes /
1,048,576)
m return the number of millions of bytes (bytes /
1,000,000)
You can include commas in the results from a "b|k|m" function
by appending a "c" to the argument. For example, to add
commas to a "b" or number of bytes result, enter "bc" as the
argument.
! In variable functions which take a drive letter as an
argument, like @DISKFREE or @READY, the drive letter must be
followed by a colon. The function will not work properly if
you use the drive letter without the colon.
! The @FILEREAD, @FILEWRITE, @FILESEEK, and @FILECLOSE functions
allow you to access files based on their file handle. These
functions should only be used with file handles returned by
@FILEOPEN! If you use them with any other file handle you may
damage other files opened by the command processor (or, in a
secondary shell, the program which started the command
processor), or hang your system.
The functions are listed below. The first list is by
category, to assist you in locating the function you want
quickly. The second list includes all the functions in
alphabetical order, and defines the arguments and return value
for each one.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 109
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
Variable Function Categories
System status:
@DOSMEM @EMS @EXTENDED @MASTER
@READSCR @XMS
Drives and devices:
@CDROM @DEVICE @DISKFREE @DISKTOTAL
@DISKUSED @FSTYPE @LABEL @LPT
@READY @REMOTE @REMOVABLE
Files:
@ATTRIB @DESCRIPT @EXETYPE @FILEAGE
@FILECLOSE @FILEDATE @FILEOPEN @FILEREAD
@FILES @FILESEEK @FILESEEKL @FILESIZE
@FILETIME @FILEWRITE @FILEWRITEB @FINDCLOSE
@FINDFIRST @FINDNEXT @LINE @LINES
@SEARCH @TRUENAME @UNIQUE
File names:
@EXT @FILENAME @FULL @NAME
@PATH
Strings and characters:
@ASCII @CHAR @FORMAT @INDEX
@INSTR @LEN @LOWER @REPEAT
@SUBSTR @TRIM @UPPER @WORD
@WORDS
Numbers and arithmetic:
@COMMA @DEC @EVAL @INC
@INT @NUMERIC @RANDOM
Dates and times:
@DATE @MAKEAGE @MAKEDATE @MAKETIME
@TIME
Utility:
@ALIAS @EXEC @IF @REXX
@SELECT @TIMER
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 110
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
Variable Function Details
@ALIAS[name]: Returns the contents of the specified alias as
a string, or a null string if the alias doesn't exist. When
manipulating strings returned by @ALIAS you may need to
disable certain special characters with the SETDOS /X command
(see page 327). Otherwise, command separators, redirection
characters, and other similar "punctuation" in the alias may
be interpreted as part of the current command, rather than
part of a simple text string.
4NT @ALTNAME[filename]: Returns the alternate (8.3 FAT-format)
name for the specified file. Under Windows NT 3.1 this
function returns a valid name on HPFS and NTFS drives only.
Under Windows NT 3.5 and above it works on all drives.
@ASCII[c]: Returns the numeric value of the specified ASCII
character as a string. For example %@ASCII[A] returns 65.
You can put an escape character [<Ctrl-X>] before the actual
character to process. This allows quotes and other special
characters as the argument (e.g., %@ASCII[<Ctrl-X>`]).
@ATTRIB[filename[,nrhsda]]: Returns a "1" if the specified
file has the matching attribute(s); otherwise returns a "0".
The attributes are:
N Normal (no attributes set) S System
R Read-only D Directory
H Hidden A Archive
The attributes (other than N) can be combined (for example
%@ATTRIB[MYFILE,HS]). ATTRIB will only return a 1 if all of
the attributes match.
If you do not specify any attributes, @ATTRIB will return the
attributes of the specified file in the format RHSAD, rather
than a "0" or "1". Attributes which are not set will be
replaced with an underscore. For example. if SECURE.DAT has
the read-only, hidden, and archive attributes set,
%@ATTRIB[SECURE.DAT] would return "RH_A_" (without the
quotes).
@CDROM[d:]: Returns "1" if the drive is a CD-ROM or "0"
otherwise.
@CHAR[n]: Returns the character corresponding to an ASCII
numeric value. For example %@CHAR[65] returns A.
@COMMA[n]: Inserts commas, or the "thousands separator"
character for your country ID, into a numeric string.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 111
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
@DATE[mm-dd-yy]: Returns the number of days since January 1,
1980 for the specified date. DATE uses the date format and
separators mandated by your country code (for example dd.mm.yy
in Germany, or yy-mm-dd in Japan).
@DEC[%var]: Returns the same value as @EVAL[%var - 1]. That
is, it retrieves and decrements the value of a variable. The
variable itself is not changed; to do so, use a command like
this:
set var=%@dec[%var]
@DESCRIPT[filename]: Returns the file description for the
specified filename (see the DESCRIBE command on page 201).
@DEVICE[name]: Returns "1" if the specified name is a
character device (such as a printer or serial port), or "0" if
not.
@DISKFREE[d:,b|k|m]: Returns the amount of free disk space on
the specified drive.
@DISKTOTAL[d:,b|k|m]: Returns the total disk space on the
specified drive.
@DISKUSED[d:,b|k|m]: Returns the amount of disk space in use
by files and directories on the specified drive.
@DOSMEM[b|k|m]: In 4DOS, returns the amount of free base
memory. In 4OS2, returns the size of the largest free memory
block (either in physical or virtual memory). In 4DOS/NT,
returns the amount of free physical memory.
4DOS @EMS[b|k|m]: Returns the amount of free EMS memory.
@EVAL[expression]: Evaluates an arithmetic expression. @EVAL
supports addition (+), subtraction (-), multiplication (*),
division (/), integer division (\, returns the integer part of
the quotient), modulo (%%), and integer exponentiation (**).
The expression can contain environment variables and other
variable functions. @EVAL also supports parentheses, commas,
and decimals. Parentheses can be nested. @EVAL will strip
leading and trailing zeros from the result. When evaluating
expressions, **, *, /, \, and %% take precedence over + and -.
For example, 3 + 4 * 2 will be interpreted as 3 + 8, not as 7
* 2. To change this order of evaluation, use parentheses to
specify the order you want.
The maximum precision is 16 digits to the left of the decimal
point and 8 digits to the right of the decimal point. You can
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 112
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
alter the default precision to the right of the decimal point
with the EvalMax and EvalMin .INI file directives (see page
138) and with the SETDOS /F command (see page 322).
You can alter the precision for a single evaluation with the
construct @EVAL[expression=x.y]. The x value specifies the
minimum decimal precision (i.e., the minimum number of decimal
places displayed); the y value sets the maximum decimal
precision. If x is greater than y, it is ignored. You can
specify either or both arguments, for example:
@eval[3/7=.4] returns 0.4286
@eval[3/7=2] returns 0.42857143
@eval[3/6=2.4] returns 0.50
Also see @DEC and @INC.
@EXEC[command]: Execute the command. The command can be an
alias, internal command, external command, .BTM file, or .BAT
file. @EXEC is primarily intended for running a program from
within the PROMPT. It is a "back-door" entry into command
processing and should be used with extreme caution. Incorrect
or recursive use of @EXEC may cause stack overflows or hang
your system.
4OS2 @EXETYPE[filename]: Returns the application type as a string:
DOS DOS .COM, .EXE, or .BAT file (OS/2 2.x only)
AVIO OS/2 Character mode, windowed
FS OS/2 Character mode, full-screen
PM OS/2 Presentation Manager
WIN Windows 3 (OS/2 2.x only)
UNKNOWN Any other file
@EXT[filename]: Returns the extension from a file name,
without a leading period.
4DOS @EXTENDED[b|k|m]: Returns the amount of extended memory.
@FILEAGE[filename]: Returns the date and time of the file as
a single numeric value. The number can be used to compare the
relative ages of two or more files.
@FILECLOSE[n]: Closes the file whose handle is "n." You
cannot close handles 0, 1 or 2. Returns "0" if the file
closed OK or "-1" if an error occurs. Be sure to read the
cautionary note about file functions on page 109.
@FILEDATE[filename]: Returns the date a file was last
modified, in the default country format (mm-dd-yy for the US).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 113
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
@FILENAME[filename]: Returns the name and extension of a
file, without a path.
@FILEOPEN[filename, read | write | append]: Opens the file in
the specified mode and returns the file handle as an integer.
Returns "-1" if the file cannot be opened. Be sure to read
the cautionary note about file functions on page 109.
@FILEREAD[n[,length]]: Reads data from the file whose handle
is "n." Returns "**EOF**" if you attempt to read past the end
of the file. If "length" is not specified @FILEREAD will read
until the next CR or LF (end of line) character. If "length"
is specified, @FILEREAD will read "length" bytes regardless of
any end of line characters. Be sure to read the cautionary
note about file functions on page 109.
@FILES[filename [,-nrhsda]]: Returns the number of files that
match the filename specification, which may contain wildcards
and include lists. Returns an empty string if no files match.
The filename must refer to a single directory; to check
several directories, use @FILES once for each directory, and
add the results together with @EVAL. The second argument, if
included, defines the attributes of the files that will be
included in the search. The attributes are:
N Normal (no attributes set) S System
R Read-only D Directory
H Hidden A Archive
The attributes (other than N) can be combined (for example
%@FILES[MYFILE,HS]). @FILES will only find a file if all of
the attributes match. You can prefix an attribute with "-" to
mean "everything except files with this attribute."
@FILESEEK[n,offset,start]: Moves the file pointer "offset"
bytes in the file whose handle is "n". Returns the new
position of the pointer, in bytes from the start of the file.
Set "start" to 0 to seek relative to the beginning of the
file, 1 to seek relative to the current file pointer, or 2 to
seek relative to the end of the file. The offset value may be
negative (seek backward), positive (seek forward), or zero
(return current position, but do not change it). Be sure to
read the cautionary note about file functions on page 109.
@FILESEEKL[n,line]: Moves the file pointer to the specified
line in the file whose handle is "n". Returns the new position
of the pointer, in bytes from the start of the file. Be sure
to read the cautionary note about file functions on page 109.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 114
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
@FILESIZE[filename,b|k|m]: Returns the size of a file, or
"-1" if the file does not exist. If the filename includes
wildcards or an include list, returns the combined size of all
matching files.
@FILETIME[filename]: Returns the time a file was last
modified, in hh:mm format.
@FILEWRITE[n,text]: Writes a line to the file whose handle is
"n". Returns the number of bytes written, or "-1" if an error
occurred. Be sure to read the cautionary note about file
functions on page 109.
@FILEWRITEB[n,length,string]: Writes the specified number of
bytes from the string to the file whose handle is "n".
Returns the number of bytes written, or "-1" if an error
occurred. Be sure to read the cautionary note about file
functions on page 109.
4NT FINDCLOSE[filename]: Signals the end of a @FINDFIRST /
@FINDNEXT sequence. You must use this function to release the
directory search handle used for @FINDFIRST / @FINDNEXT.
@FINDFIRST[filename [,-nrhsda]]: Returns the name of the
first file that matches the filename, which may contain
wildcards and "include lists". The second argument, if
included, defines the attributes of the files that will be
included in the search. Returns an empty string if no files
match. The attributes are:
N Normal (no attributes set) S System
R Read-only D Directory
H Hidden A Archive
The attributes (other than N) can be combined (for example
%@FINDFIRST[MYFILE,HS]). @FINDFIRST will only find a file if
all of the attributes match. You can prefix an attribute with
"-" to mean "everything except files with this attribute."
4NT After @FINDFIRST or the last @FINDNEXT, you must use
@FINDCLOSE to avoid running out of directory search handles.
@FINDNEXT[[filename [,-nrhsda]]]: Returns the name of the
next file that matches the filename passed to @FINDFIRST.
@FINDNEXT should only be used after a successful call to
@FINDFIRST. The first argument is included for compatibility
with previous versions, but is ignored; it can be omitted if
the second argument is not used (e.g. %@FINDNEXT[]). The
second argument, if included, defines the attributes of the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 115
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
files that will be included in the search (see @FINDFIRST for
details). Returns an empty string when no more files match.
4NT After the last @FINDNEXT, you must use @FINDCLOSE to avoid
running out of directory search handles.
@FORMAT[[-][x][.y],string]: Reformats a string, truncating it
or padding it with spaces as necessary. If you use the minus
[-], the string is left-justified; otherwise, it is right-
justified. The x value is the minimum number of characters in
the result. The y value is the maximum number of characters
in the result. You can combine the options as necessary. For
example:
%@format[12,JPSoftware] returns " JPSoftware"
%@format[.3,JPSoftware] returns "JPS"
4OS2, @FSTYPE[d:]: Returns the file system type for the specified
drive. Under
4NT 4OS2, @FSTYPE will return "FAT" for a DOS-compatible drive
with a file allocation table, "HPFS" for a drive that uses
OS/2's high performance file system, or "CDFS" for a CD-ROM
drive. It may return other values if additional file systems
have been installed with the IFS= directive in CONFIG.SYS.
4DOS/NT will normally return "FAT", "HPFS", "CDFS", or "NTFS"
for a drive that uses the Windows NT file system.
@FULL[filename]: Returns the fully qualified path name of a
file.
@IF[condition,true,false]: Evaluates the condition and
returns a string based on the result. The condition can
include any of the tests allowed in the IF command (see page
251). If the condition is true, @IF returns the first result
string; if it is false, @IF returns the second string. For
example, %IF[2==2,Correct!,Oops!] returns "Correct!"
@INC[%var]: Returns the same value as %@EVAL[%var + 1]. That
is, it retrieves and increments the value of a variable. The
variable itself is not changed; to do so, use a command like
this:
set var=%@inc[%var]
@INDEX[string1,string2]: Returns the position of string2
within string1, or "-1" if string2 is not found. The first
position in string1 is numbered 0.
@INSTR[start, length, string]: The same as @SUBSTR (see page
119). However, the string is at the end of the @INSTR
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 116
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
argument list, so that commas in the string will not be
confused with commas separating the arguments.
@INT[n]: Returns the integer part of the number n.
@LABEL[d:]: Returns the volume label of the specified disk
drive.
@LEN[string]: Returns the length of a string.
@LINE[filename,n]: Returns line "n" from the specified file.
The first line in the file is numbered 0. "**EOF**" is
returned for all line numbers beyond the end of the file. If
you need to scan through the lines of a file in sequence, the
@FILEREAD function (above) and the "@filename" construct
available in the FOR command (page 237) are much faster than
calling the @LINE function repeatedly. @LINE will retrieve
input from standard input if you specify CON as the filename.
If you are redirecting input to @LINE using this feature, you
must use command grouping (see page 71) or the redirection
will not work properly. For example:
(echo %@line[con,0]) < myfile.dat
@LINES[filename]: Returns the line number of the last line in
the file, or "-1" if the file is empty. The first line in the
file is numbered 0, so (for example) @LINES will return 0 for
a file containing one line.
@LOWER[string]: Returns the string converted to lower case.
4DOS @LPT[n]: Returns a "1" if the specified printer is ready;
otherwise, returns "0". n=1 checks the printer connected to
LPT1, n=2 checks LPT2, and n=3 checks LPT3.
@MAKEAGE[date[,time]]: Returns the date and time (if
included) as a single value in the same format as @FILEAGE.
@MAKEAGE can be used to compare the time stamp of a file with
a specific date and time, for example:
if %@fileage[myfile] lt %@makeage[1/1/85] echo OLD!
@MAKEDATE[n]: Returns a date (formatted according to the
current country settings). "n" is the number of days since
1/1/80. This is the inverse of @DATE.
@MAKETIME[n]: Returns a time (formatted according to the
current country settings). "n" is the number of seconds since
midnight. This is the inverse of @TIME.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 117
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
4DOS @MASTER[varname]: Returns the value of a variable from the
master environment.
@NAME[filename]: Returns the base name of a file, without the
path or extension.
@NUMERIC[string]: Returns "1" if the argument is composed
entirely of digits (0 to 9), signs (+ or -), and the thousands
and decimals separators. Otherwise, returns "0".
@PATH[filename]: Returns the path from a file name, including
the drive letter and a trailing backslash but not including
the base name or extension.
@RANDOM[min, max]: Returns a random value between min and
max, inclusive. Min, max, and the returned value are all
integers.
@READSCR[row,col,length]: Returns the text displayed on the
screen at the specified location. The upper left corner of
the screen is location 0,0.
@READY[d:]: Returns "1" if the specified drive is ready;
otherwise returns "0".
@REMOTE[d:]: Returns "1" if the specified drive is a remote
(network) drive; otherwise returns "0".
@REMOVABLE[d:]: Returns "1" if the specified drive is
removable (i.e., a floppy disk or removable hard disk);
otherwise returns "0".
@REPEAT[c,n]: Returns the character "c" repeated "n" times.
4OS2 @REXX[expr]: Calls the REXX interpreter to execute the
4NT expression. Returns the result string from REXX; if the REXX
expression does not return a string, @REXX returns the REXX
numeric result code.
@SEARCH[filename]: Searches for the filename using the PATH
environment variable, appending an extension if one isn't
specified. See page 20 for details on the default extensions
used when searching the PATH, and the order in which the
search proceeds. Returns the fully-expanded name of the file
including drive, path, base name, and extension, or an empty
string if a matching file is not found. If wildcards are used
in the filename, @SEARCH will search for the first file that
matches the wildcard specification, and return the drive and
path for that file plus the wildcard filename (e.g.,
E:\UTIL\*.COM).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 118
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
@SELECT[filename,top,left,bottom,right,title]: Pops up a
selection window with the lines from the specified file.
Returns the text of the line the scrollbar is on if you press
Enter, or an empty string if you press Esc. @SELECT can be
used to display menus or other selection lists from a batch
file. To select from lines passed through input redirection
or a pipe, use CON as the filename. You can move through the
selection window with standard navigation keystrokes. To
change the navigation keys, see page 146.
@SUBSTR[string,start,length]: Returns a substring, starting
at the position "start" and continuing for "length"
characters. If the length is omitted, it will default to the
remainder of the string. If the length is negative, the start
is relative to the right side of the string. The first
character in the string is numbered 0; if the length is
negative, the last character is numbered 0. For example,
%@SUBSTR[%_TIME,0,2] gets the current time and extracts the
hour. If the string includes commas, it must be quoted with
double quotes ["] or back-quotes [`]. The quotes do count in
calculating the position of the substring. @INSTR (page 116)
performs the same function, and allows commas in the string
without quoting.
@TIME[hh:mm:ss]: Returns the number of seconds since midnight
for the specified time. The time must be in 24-hour format;
"am" and "pm" cannot be used.
@TIMER[n]: Returns the current split time for a stopwatch
started with the TIMER command (see page 344). The value of n
specifies the timer to read and can be 1, 2, or 3.
@TRIM[string]: Returns the string with the leading and
trailing white space (space and tab characters) removed.
4DOS @TRUENAME[filename]: Returns the true, fully-expanded name
for a file. TRUENAME will "see through" a JOIN or SUBST, and
requires DOS 3.0 or above. Wildcards may not be used in the
filename. @TRUENAME can handle simple drive substitutions
such as those created by JOIN, SUBST, or most network drive
mappings. However it may not be able to correctly determine
the true name if you use "nested" JOIN or SUBST commands, or a
network which does not report true names properly.
@UNIQUE[d:\path]: Creates a zero-length file with a unique
name in the specified directory, and returns the full name and
path. If no path is specified, the file will be created in
the current directory. The file name will be FAT-compatible
(8 character name and 3-character extension) regardless of
whether the file is created on a FAT, HPFS, or NTFS drive.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 119
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
This function allows you to create a temporary file without
overwriting an existing file.
@UPPER[string]: Returns the string converted to upper case.
@WORD[["xxx",]n,string]: Returns the "nth" word in a string.
The first word is numbered 0. If "n" is negative, words are
returned from the end of the string. You can use the first
argument, "xxx" to specify the separators that you wish to
use. If you want to use a double quote as a separator, prefix
it with an escape character (see page 73). If you don't
specify a list of separators, @WORD will consider only spaces,
tabs, and commas as word separators. If the string argument
is enclosed in quotation marks, you must enter a list of
separators. For example:
%@word[2,NOW IS THE TIME] returns "THE"
%@word[-0,NOW IS THE TIME] returns "TIME"
%@word[-2,NOW IS THE TIME] returns "IS"
%@word["=",1,2 + 2=4] returns "4"
@WORDS[["xxx"],string]: Returns the number of words in the
string. The optional list of delimiters follows the same
format as @WORD. If the string argument is enclosed in
quotation marks, you must enter a list of delimiters as well.
4DOS @XMS[b|k|m]: Returns the amount of free XMS memory.
Examples
You can use variable functions in a wide variety of ways
depending on your needs. We've included a few examples below
to give you an idea of what's possible.
To set the prompt to show the amount of free memory (see the
PROMPT command, page 295, for details on including variable
functions in your prompt):
c:\> prompt (%%@dosmem[K]K) $p$g
Set up a simple command-line calculator. The calculator is
used with a command like CALC 3 * (4 + 5):
c:\> alias calc `echo The answer is: %@eval[%&]`
The following batch file uses variable functions to implement
"once a day" execution of a group of commands. It works by
constructing a 6-digit number "yymmdd" from today's date, and
comparing that to a number of the same type stored in the file
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 120
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
C:\ONCEADAY.DAT. If today's date is numerically larger than
the saved date, and the time is after 6:00 AM, then the "once
a day" commands are run, and today's date is saved in the file
as the new date for comparison. Otherwise, no action is
taken. You can make this file simpler using the %@DATE and
%@TIME functions instead of using %@SUBSTR to extract
substrings of the %_DATE and %_TIME variables; we used the
approach shown to demonstrate the use of %@SUBSTR.
rem Temporary variables used to shorten example lines:
rem DD is _date, DY is yymmdd date, TM is _time
set dd=%_date
set
dy=%@substr[%dd,6,2]%@substr[%dd,0,2]%@substr[%dd,3,2]
set lastdate=0
iff exist c:\onceaday.dat then
set lastdate=%@line[onceaday.dat,0]
endiff
iff %dy gt %lastdate then
set tm=%_time
iff "%@substr[%tm,0,2]%@substr[%tm,3,2]" gt "0600" then
rem Commands to be executed once a day go here
echo %dy > c:\onceaday.dat
endiff
endiff
Command Parsing
Whenever you type something at the command line and press the
Enter key, or include a command in a batch file, you have
given a command to 4DOS, 4OS2, or 4DOS/NT, which must figure
out how to execute your command. If you understand the
general process that is used, you will be able to make the
best use of the commands. Understanding these steps can be
especially helpful when working with complex aliases or batch
file commands.
To decide what activity to perform, the command processor goes
through several steps. Before it starts, it writes the entire
command line (which may contain multiple commands) to the
history log file if history logging has been enabled with the
LOG /H command (see page 277). Then, if the line contains
multiple commands, the first command is isolated for
processing.
4DOS, 4OS2, and 4DOS/NT begin by dividing the command into a
command name and a command tail. The command name is the
first word in the command; the tail is everything that follows
the command name. For example, in the command line
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 121
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
dir *.txt /2/p/v
the command name is "dir," and the command tail is " *.txt
/2/p/v."
Next the command processor tries to match the command name
against its list of aliases. If it finds a match between the
command name and one of the aliases you've defined, it
replaces the command name with the contents of the alias.
(This substitution is done internally and is not normally
visible to you). If the alias included parameters (%1, %2,
etc.), the parameter values are filled in from the text on the
command line, and any parameters used in this process are
removed from the command line. The process of replacing a
command name that refers to an alias with the contents of the
alias, and filling in the alias parameters, is called alias
expansion.
This expansion of an alias creates a new command name: the
first word of the alias. This new command name is again
tested against the list of aliases, and if a match is found
the contents of the new alias is expanded just like the first
alias. This process, called nested alias expansion, continues
until the command name no longer refers to an alias.
Once it has finished with the aliases, 4DOS, 4OS2, or 4DOS/NT
next tries to match the command name with its list of internal
commands. If it is unsuccessful, the command processor knows
that it will have to search for a batch file or external
program to execute your command.
The next step is to locate any batch file or alias parameters,
environment variables, internal variables, or variable
functions in the command, and replace each one with its value.
This process is called variable expansion.
The variable expansion process is modified for certain
internal commands, like EXCEPT, IFF, and GLOBAL. These
commands are always followed by another command, so variable
expansion takes place separately for the original command and
the command that follows it.
Once all of the aliases and environment variables have been
expanded, 4DOS, 4OS2, or 4DOS/NT will echo the complete
command to the screen (if command-line echo has been enabled)
and write it to the log file (if command logging has been
turned on).
Before it can actually execute your command, the command
processor must scan the command tail to see if it includes
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 122
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
redirection or piping. If so, the proper internal switches
are set to send output to an alternate device or to a file,
instead of to the screen. In 4OS2 and 4DOS/NT, a second
process is started at this point, if necessary, to receive any
piped output.
Finally, it is time to execute the command. If the command
name matches an internal command, 4DOS, 4OS2, or 4DOS/NT will
perform the activities you have requested. Otherwise, the
command processor searches for an executable (.COM or .EXE)
file, a batch file, or a file with an executable extension
that matches the command name (see the detailed description of
this search on page 20).
Once the internal command or external program has terminated,
the command processor saves the result or exit code that the
command generated, cleans up any redirection that you
specified, and then returns to the original command line to
retrieve the next command. When all of the commands in a
command line are finished, the next line is read from the
current batch file, or if no batch file is active, the prompt
is displayed.
You can disable and re-enable several parts of command parsing
(for example alias expansion, variable expansion, and
redirection) with the SETDOS /X command (see page 327).
Argument Quoting
As it parses the command line, the command processor looks for
command separators (carets [^] in 4DOS, or ampersands [&] in
4OS2 and 4DOS/NT), conditional commands (|| or &&), white
space (spaces, tabs, and commas), percent signs [%] which
indicate variables to be expanded, and redirection and piping
characters (>, <, or |).
Normally, these special characters cannot be passed to a
command as part of an argument. However, you can include any
of the special characters in an argument by enclosing the
entire argument in back-quotes [`] or double quotes ["].
Although both back-quotes and double quotes will let you build
arguments that include special characters, they do not work
the same way.
No alias or variable expansion is performed on an argument
enclosed in back-quotes. Redirection symbols inside the back-
quotes are ignored. The back-quotes are removed from the
command line before the command is executed.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 123
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
No alias expansion is performed on expressions enclosed in
double quotes. Redirection symbols inside double quotes are
ignored. However, variable expansion is performed on
expressions inside double quotes. The double quotes
themselves will be passed to the command as part of the
argument.
For example, suppose you have a batch file CHKNAME.BTM which
expects a name as its first parameter (%1). Normally the name
is a single word. If you need to pass a two-word name with a
space in it to this batch file you could use the command:
c:\> chkname `MY NAME`
Inside the batch file, %1 will have the value MY NAME,
including the space. The back-quotes caused the command
processor to pass the string to the batch file as a single
argument.
For a more complex 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 with
this command:
c:\> set FORVAR=for
Now, if you enter the command
c:\> quotes `Now is the time %forvar` all good
the output from QUOTES.BAT will look like this:
Arg1 = Now is the time %forvar
Arg2 = all
Arg3 = good
But if you enter the command
c:\> quotes "Now is the time %forvar" all good
the output from QUOTES.BAT will look like this:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 124
CHAPTER 4 / ALIASES AND BATCH FILES
-------------------------------------------------------------------
Arg1 = "Now is the time for"
Arg2 = all
Arg3 = good
Notice that in both cases, the quotes keep characters together
and reduce the number of arguments in the line.
The following example has 7 command-line arguments, while the
examples above only have 3:
c:\> quotes Now is the time %forvar all good
When an alias is defined in a batch file or from the command
line, its argument can be enclosed in back-quotes to prevent
the expansion of replaceable parameters, variables, and
multiple commands until the alias is invoked. See ALIAS on
page 161 for details.
You can disable and re-enable back-quotes and double quotes
with the SETDOS /X command (see page 327).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 125
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
CHAPTER 5 / CONFIGURATION
Part of the power of 4DOS, 4OS2, and 4DOS/NT is their flexibility.
You can alter their configuration to match your style of computing.
This chapter explains how to make the command processor work the
way you want.
The configuration of 4DOS, 4OS2, and 4DOS/NT is controlled through
an optional file of initialization information with the extension
.INI. This file is called 4DOS.INI in 4DOS, 4OS2.INI in 4OS2, and
4NT.INI in 4DOS/NT. (For brevity, we refer to all three files as
.INI files throughout this manual.)
You can create, add to, and edit the .INI file with any ASCII text
editor. Each command processor reads its .INI file when it starts,
and configures itself accordingly. The .INI file is not re-read
when you change it. For changes to take effect, you must reboot
your system (under DOS), or restart the session or window in which
your command processor is running (under OS/2 or Windows NT).
Each item that you can include in the .INI file has a default
value. You only need to include entries in the file for settings
that you want to change from their default values. If you are
happy with all of the default values, you don't need an .INI file
at all.
Using the .INI File
Some settings in the .INI file are initialized when you
install 4DOS, 4OS2, or 4DOS/NT, so you may have an .INI file
even if you didn't create one yourself. You should not delete
this file unless you've checked carefully to be sure that you
don't need any of the settings the installation program put
there.
4DOS, 4OS2, and 4DOS/NT primary shells search for the .INI
file in three places:
* If there is an "@d:\path\inifile" option on the SHELL=
line in CONFIG.SYS (for 4DOS) or on the startup
command line (for 4OS2 and 4DOS/NT), the command
processor will use the path and file name specified
there, and will not look elsewhere.
* If there is no .INI file name on the SHELL= line or
startup command line, the search proceeds to the same
directory where the command processor program file
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 126
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
(4DOS.COM, 4OS2.EXE, or 4NT.EXE) is stored. This is
the "normal" location for the .INI file. 4DOS, 4OS2,
and 4DOS/NT determine this directory automatically.
You can also set it yourself by placing a COMSPEC
directory name on the SHELL= line in CONFIG.SYS (for
4DOS), or on the startup command line (for 4OS2 and
4DOS/NT). See your Introduction and Installation
Guide for further details on setting the COMSPEC
directory.
* If the .INI file is not found in the directory where
the program file is stored, a final check is made in
the root directory of the boot drive.
When 4DOS, 4OS2, or 4DOS/NT is loaded as a secondary shell, it
does not search for the .INI file. Instead, it retrieves the
primary shell's .INI file data, processes the [Secondary]
section of the original .INI file if necessary, and then
processes any "@d:\path\inifile" option on the secondary shell
command line (see your Introduction and Installation Guide for
details). You can override this behavior with the NextINIFile
directive (see page 148).
.INI File Directives
Most lines in the .INI file consist of a one-word directive,
an equal sign [=], and a value. For example, in the following
line, the word "Environment" is the directive and "2048" is
the value:
Environment = 2048
Any spaces before or after the equal sign are ignored.
If you have a long string to enter in the .INI file (for
example, for the ColorDir directive), you must enter it all on
one line. Strings cannot be "continued" to a second line.
Each line may be up to 511 characters long in 4DOS, or 1023
characters long in 4OS2 and 4DOS/NT.
The format of the value part of a directive line depends on
the individual directive. It may be a numeric value, a single
character, a choice (like "Yes" or "No"), a color setting, a
key name, a path, a filename, or a text string. The value
begins with the first non-blank character after the equal sign
and ends at the end of the line or the beginning of a comment.
Blank lines are ignored in the .INI file and can be used to
separate groups of directives. You can place comments in the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 127
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
file by beginning a line with a semicolon [;]. You can also
place comments at the end of any line except one containing a
text string value. To do so, enter at least one space or tab
after the value, a semicolon, and your comment, like this:
Environment = 2048 ;set standard environment size
If you try to place a comment at the end of a string value,
the comment will become part of the string and will probably
cause an error.
When the command processor detects an error while processing
the .INI file, it displays an error message and prompts you to
press a key to continue processing the file. This allows you
to note any errors before the startup process continues. The
directive in error will retain its previous or default value.
Only the most catastrophic errors (like a disk read failure)
will terminate processing of the remainder of the .INI file.
If you don't want a pause after each error, use a
"PauseOnError = No" directive at the beginning of the .INI
file.
If you need to test different values for an .INI directive
without repeatedly editing the .INI file, see the INIQuery
directive on page 133.
The .INI file has three sections: the first or global
section, the [Primary] section, and the [Secondary] section.
The global section consists of directives at the beginning of
the file, with no section name before them. These directives
are effective in all shells. In most cases, this is the only
section you will need, particularly for 4OS2 and 4DOS/NT.
The [Primary] and [Secondary] sections include directives that
are used only in primary and secondary shells respectively
(see page 12 for more information on primary and secondary
shells). Each section is identified by the section name in
square brackets on a line by itself. You don't need to set up
these sections unless you want different directives for
primary and secondary shells.
Directives in the [Primary] section are used for the first or
primary shell. The values are passed automatically to all
secondary shells, unless overridden by a directive with the
same name in the [Secondary] section.
Directives in the [Secondary] section are used in secondary
shells only, and override any corresponding primary shell
settings. For example, these lines in the .INI file:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 128
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
[Primary]
ScreenRows = 25
[Secondary]
ScreenRows = 50
mean to assume that you have 25 rows on the screen in the
primary shell and 50 lines in all secondary shells.
Sections that begin with any name other than [Primary] or
[Secondary] are ignored.
The SETDOS command can override several of the .INI file
directives (see page 322). For example, the cursor shape used
by 4DOS, 4OS2, and 4DOS/NT can be adjusted either with the
CursorIns and CursorOver directives or the SETDOS /S command.
The correspondence between SETDOS options and .INI directives
is noted under each directive below, and under each option of
the SETDOS command.
Secondary shells automatically inherit the configuration
settings currently in effect in the previous shell. If values
have been changed by SETDOS since the primary shell started,
the current values will be passed to the secondary shell. If
the previous shell's .INI file had a [Secondary] section, it
will then be read and processed. If not, the previous shell's
settings will remain in effect.
For example, you might set BatchEcho to Yes in the .INI file,
to enable batch file echo. If you then use SETDOS /V0 to turn
off batch file echoing in the primary shell, then any
secondary shells will inherit the SETDOS setting, rather than
the original value from the .INI file; i.e., batch files in
the secondary shell will default to no echo.
If you want to force secondary shells to start with a specific
value for a particular directive, regardless of any changes
made with SETDOS in a previous shell, repeat the directive in
the [Secondary] section of the .INI file.
4DOS If you start a secondary shell from a task switching program
like Windows, DESQview, or Back & Forth, you can specify an
alternate location and name for 4DOS.INI by passing the
"@d:\path\inifile" option to 4DOS as a command-line parameter
(see your 4DOS Introduction and Installation Guide for
details). In this case, the configuration settings in the
alternate 4DOS.INI file will supersede any settings inherited
from the previous shell. Any values which are not explicitly
set in the alternate file will retain the value they had in
the previous shell.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 129
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
The first section below lists the different types of
directives. Subsequent sections list all the individual
directives, divided by function and then alphabetically by
directive name. At the end we have included a few examples of
how to use the .INI file directives (see page 151).
Types of Directives
There are 8 types of directives in the .INI file. The
different types of directives are shown in the lists below as
follows:
* Name = nnnn (1234): This directive takes a numeric
value which replaces the "nnnn." The default value is
shown in parentheses.
* Name = c (X): This directive accepts a single
character as its value. The default character is
shown in parentheses. You must type in the actual
character; you cannot use a key name.
* Name = CHOICE1 | Choice2 | ... : This directive takes
a choice value. The possible choices are listed,
separated by vertical bars. The default value is
shown in all upper case letters in the directive
description, but in your file any of the choices can
be entered in upper case or lower case. For example,
if the choices were shown as "YES | No" then "YES" is
the default.
* Name = Color: This directive takes a color
specification. See page 26 for the format of color
names.
* Name = Key (Default): This directive takes a key
specification. See page 31 for the format of key
names.
* Name = Path: This directive takes a path
specification, but not a filename. The value should
include both a drive and path (e.g., C:\4DOS) to avoid
any possible ambiguities. A trailing backslash [\] at
the end of the path name is acceptable but not
required. Any default path is described in the text.
* Name = File: This directive takes a filename. We
recommend that you use a full filename including the
drive letter and path to avoid any possible
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 130
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
ambiguities. Any default filename is described in the
text.
* Name = String: This directive takes a string in the
format shown. The text describes the default value
and any additional requirements for formatting the
string correctly. No comments are allowed.
4DOS, 4OS2, and 4DOS/NT each contain a fixed-length area for
storing strings entered in the .INI file, including file
names, paths, and other strings. This area is large and is
unlikely to overflow; if it does, you will receive an error
message. If this occurs, reduce the complexity of your .INI
file or contact our technical support department for
assistance.
Each directive is listed below with its name, type, and
default value. In some cases, no default is shown because the
default value is different for different products; in these
cases, the default is described in the text.
Initialization Directives
The directives in this section control how your command
processor starts and where it looks for its files.
4StartPath = Path: Sets the drive and directory where
the 4START and 4EXIT batch files (if any) are located.
4DOS Alias = nnnn (1024): Sets the amount of memory in bytes
allocated for the alias list. The allowable range of
values is 256 to 32767 bytes. This directive is not
needed in 4OS2 or 4DOS/NT because both adjust the size of
the alias list dynamically. If you use a global alias
list (see page 169), the Alias value is ignored in all
shells except the shell which first establishes the
global list.
4DOS AutoExecPath = Path | File: Sets the path used to find
AUTOEXEC.BAT if 4DOS is started as a primary shell with
the /P option in CONFIG.SYS (see your Introduction and
Installation Guide). If you include only a path, 4DOS
will look for AUTOEXEC.BAT in the specified directory.
If you include a complete file name, 4DOS will look for
the specified file, and will not look for AUTOEXEC.BAT.
The default is the file AUTOEXEC.BAT in the root
directory of the boot drive.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 131
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
Using AutoExecPath with a complete file name lets you
store multiple startup files in a single directory. You
may find this useful under DOS if you have multiple boot
software and use different startup files under different
configurations, or under OS/2 if you have several DOS
sessions with different startup files. If you are
running under OS/2, using AutoExecPath is equivalent to
setting DOS_AUTOEXEC on a session's DOS settings notebook
page (see the OS/2 documentation and your Introduction
and Installation Guide for details on DOS settings).
4DOS AutoExecParms = String: Sets the parameter or parameters
to be passed to AUTOEXEC.BAT, or the file specified with
the AutoExecPath directive, above, when 4DOS is started
as a primary shell with the /P option in CONFIG.SYS (see
your Introduction and Installation Guide). The
parameters will be available in your AUTOEXEC.BAT file as
%1, %2, etc.
DirHistory = nnnn (256): Sets the amount of memory
allocated to the directory history in bytes. The
allowable range of values is 128 to 2048 bytes. If you
use a global directory history list (see page 45), the
DirHistory value is ignored in all shells except the
shell which first establishes the global list.
4DOS Environment = nnnn (512): Sets the amount of memory
allocated to the environment in bytes. The allowable
range of values is 256 to 32767 bytes. This directive is
not needed in 4OS2 or 4DOS/NT because both adjust the
size of the environment dynamically.
4DOS EnvFree = nnnn (128): Sets the minimum amount of memory
in bytes that will be available in the environment for
secondary shells. 4DOS will enlarge the environment for
each secondary shell, if necessary, so that there is at
least this much free environment space when the shell
starts. The allowable range of values is 128 to 32767
bytes.
4OS2 HelpBook = String: Sets the names of the "books" to be
loaded when 4OS2 help is invoked with the HELP command or
the F1 key. The default is 4OS2+CMDREF which loads the
4OS2 help and the OS/2 command reference. See the 4OS2
Introduction and Installation Guide for details about
this directive.
4DOS HelpOptions = String: Sets default options for the 4DOS
help system. For the available options, see your 4DOS
Introduction and Installation Guide.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 132
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
4DOS HelpPath = Path: Sets the path used to find 4HELP.EXE
when F1 is pressed or the HELP command is used. If this
directive is not used, 4DOS will search the current
directory and each of the directories in the PATH.
History = nnnn (1024): Sets the amount of memory
allocated to the command history list in bytes. The
allowable range of values is 256 to 8192 bytes. If you
use a global history list (see page 39), the History
value is ignored in all shells except the shell which
first establishes the global list.
INIQuery = Yes | NO: If set to Yes, a prompt will be
displayed before execution of each subsequent line in the
current .INI file. This allows you to modify certain
directives when you start the command processor in order
to test different configurations. INIQuery can be reset
to No at any point in the file. Normally INIQuery = Yes
is only used during testing of other .INI file
directives.
The prompt generated by INIQuery = Yes is:
[contents of the line] (Y/N/Q/R/E) ?
At this prompt, you may enter:
Y = Yes: Process this line and go on to the next.
N = No: Skip this line and go on to the next.
Q = Quit: Skip this line and all subsequent lines.
R = Rest: Execute this and all subsequent lines.
E = Edit: Prompt for a new value for this entry.
If you choose E for Edit, you can enter a new value for
the directive, but not a new directive name.
For example, if you have found a compatibility problem
you think may be related to 4DOS's swapping or upper
memory block usage, you might change your 4DOS.INI file
so a part of it read as follows:
INIQuery = Yes
Swapping = XMS, EMS, C:\
UMBLoad = Yes
UMBEnvironment = Yes
INIQuery = No
You could then choose to process, ignore, or edit the
Swapping, UMBLoad, or UMBEnvironment directive each time
4DOS started. This would allow you to test several
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 133
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
possible combinations to see if you could resolve the
compatibility problem.
LocalAliases = Yes | No: The default value is Yes in
4DOS and No in 4OS2 and 4DOS/NT. No forces all copies of
the command processor to share the same alias list. Yes
keeps the lists for each shell separate. See page 169
for more details on local and global alias lists.
LocalDirHistory = Yes | No: The default value is Yes in
4DOS and No in 4OS2 and 4DOS/NT. No forces all copies of
the command processor to share the same directory
history. Yes keeps the directory histories for each
shell separate. See page 45 for more details on local
and global directory histories.
LocalHistory = Yes | No: The default value is Yes in
4DOS and No in 4OS2 and 4DOS/NT. No forces all copies of
the command processor to share the same history list.
Yes keeps the lists for each shell separate. See page 39
for more details on local and global history lists.
PauseOnError = YES | No: Yes forces a pause with the
message "Error in filename, press any key to continue
processing" after displaying any error message related to
a specific line in the .INI file. No continues
processing with no pause after an error message is
displayed.
4DOS Swapping = swap type [, swap type] ...: Sets the type of
swapping 4DOS should use. 4DOS runs in two parts, a
resident portion that is always in memory and a transient
portion that is "swapped" to EMS memory, XMS memory, a
RAM disk, or your hard disk while application programs
are running. The swap area for the transient portion
normally requires about 128K bytes of memory or disk
space for the primary shell, and 28 - 32K bytes for each
secondary shell.
The swap type can be EMS to swap to EMS expanded memory,
XMS to swap to XMS extended memory, d:\path to swap to
the specified drive and path, or None for no swapping.
If you use d:\path, 4DOS will create the file
4DOSSWAP.nnn in the specified directory. The file name
changes if UniqueSwapName is set to Yes (see page 151).
If you use None, the transient portion of 4DOS will
remain in memory at all times; this will reduce memory
available for application programs by about 128K.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 134
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
You can specify multiple swap types and 4DOS will try
them in the order listed. Swap type "None" is always
appended to your list of possible swap types as a "last
resort," even if you don't include it explicitly. The
default Swapping specification is EMS, XMS, x:\, None,
where x is the boot drive. In most cases you will find
that the default setting works without modification.
Before changing the Swapping specification, see your 4DOS
Introduction and Installation Guide for more detail on
swapping types and the way 4DOS uses memory.
4DOS UMBAlias = Yes | NO | 1 | 2 ... | 8: Yes attempts to
load global alias list storage into a UMB (Upper Memory
Block). If you use a specific region number (1 through
8), 4DOS will attempt to reserve room for the global
alias list in that UMB region.
Region numbers can be used under MS-DOS / PC-DOS 5.0 and
above, and under OS/2's DOS support. To use them, you
must enable DOS UMB management with the DOS=UMB or
DOS=HIGH,UMB directive in CONFIG.SYS. See your 4DOS
Introduction and Installation Guide for complete details
on UMBs and UMB regions, and the hardware and software
required to support them.
If you use an invalid region number, or if region numbers
have not been enabled on your system, 4DOS will load the
global alias list into the first available region. If no
upper memory is available, space for the global alias
list will be reserved in low memory.
UMBAlias applies to global aliases only, and is only used
in the first shell which establishes the global alias
area (see page 169 for more information on local and
global alias lists). If you specify LocalAliases = Yes,
or if the previous shell already created a global alias
area, any UMBAlias setting is ignored.
4DOS UMBDirHistory= Yes | NO | 1 | 2 ... | 8: Yes attempts to
load global directory history list storage into a UMB
(Upper Memory Block). If you use a specific region
number (1 through 8), 4DOS will attempt to reserve room
for the global directory history list in that UMB region.
See page 45 for more information on local and global
directory history lists. See UMBAlias (above) for
information on the use of UMBs and region numbers. Like
UMBAlias, UMBDirHistory will be ignored if a global
directory history list is not used.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 135
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
4DOS UMBEnvironment = Yes | NO | 1 | 2 ... | 8: Yes attempts
to load the master environment into a UMB (Upper Memory
Block). This reduces 4DOS's base memory requirements but
may cause problems with some programs that try to access
the master environment directly. See UMBAlias (above)
for information on the use of UMBs and region numbers.
4DOS UMBHistory = Yes | NO | 1 | 2 ... | 8: Yes attempts to
load global history list storage into a UMB (Upper Memory
Block). If you use a specific region number (1 through
8), 4DOS will attempt to reserve room for the global
history list in that UMB region. See page 39 for more
information on local and global history lists. See
UMBAlias (above) for information on the use of UMBs and
region numbers. Like UMBAlias, UMBHistory will be
ignored if a global history list is not used.
4DOS UMBLoad = Yes | NO | 1 | 2 ... | 8: Yes attempts to load
the resident portion of 4DOS into a UMB (Upper Memory
Block). This reduces the size of the resident portion in
base memory from about 3K bytes to 256 bytes. See
UMBAlias (above) for information on the use of UMBs and
region numbers.
4OS2, WindowState = STANDARD | Maximize | Minimize: Sets the
4NT initial state of the 4OS2 or 4DOS/NT window. Standard
puts the window in the default position on the OS/2 or
Windows NT desktop, and is the default setting. Maximize
maximizes the window; Minimize minimizes it. If you use
Maximize or Minimize, you may see the 4OS2 or 4DOS/NT
window appear briefly in the Standard position as it is
created by the operating system, then switch to the new
state.
4OS2, WindowX = nnnn, WindowY = nnnn, WindowWidth = nnnn,
4NT WindowHeight = nnnn: These 4 directives set the initial
size and position of the 4OS2 or 4DOS/NT window. The
measurements are in pixels or pels. Under 4OS2, WindowX
and WindowY refer to the position of the bottom left
corner of the window relative to the bottom left corner
of the screen. Under 4DOS/NT, WindowX and WindowY refer
to the position of the top left corner of the window
relative to the top left corner of the screen.
Configuration Directives
These directives control the way that 4DOS, 4OS2, and 4DOS/NT
operate. Some can be changed with the SETDOS command while
the command processor is running. Any corresponding SETDOS
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 136
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
command is listed in the description of each directive;
information on SETDOS begins on page 322.
AmPm = Yes | NO | Auto: Yes displays times in 12-hour
format with a trailing "a" for AM or "p" for PM. The
default of No forces a display in 24-hour time format.
Auto formats the time according to the country code set
for your system. AmPm controls the time displays used by
DIR and SELECT, in LOG files, and the output of the
TIMER, DATE, and TIME commands. It has no effect on
%_TIME, %@MAKETIME, the $t and $T options of PROMPT, or
date and time ranges.
4DOS ANSI = AUTO | Yes | No: Tells 4DOS whether an ANSI
driver is installed and should be used for the CLS and
COLOR commands. 4DOS normally determines this itself,
but if you are using a non-standard ANSI driver or your
loading sequence is unusual, you may need to explicitly
inform 4DOS. Also see SETDOS /A. This directive is not
available in 4OS2 (because 4OS2 assumes that ANSI support
is always enabled), or 4DOS/NT (because Windows NT does
not offer ANSI support).
BatchEcho = YES | No: Sets the default batch ECHO mode.
Yes enables echoing of all batch file commands unless
ECHO is explicitly set off in the batch file. No
disables batch file echoing unless ECHO is explicitly set
on. Also see SETDOS /V.
BeepFreq = nnnn (440): Sets the default BEEP command
frequency in Hz. This is also the frequency for "error"
beeps (for example, if you press an illegal key). To
disable all error beeps set this or BeepLength to 0. If
you do, the BEEP command will still be operable, but will
not produce sound unless you explicitly specify the
frequency and duration.
BeepLength = nnnn (2): Sets the default BEEP length in
system clock ticks (approximately 1/18 of a second per
tick). BeepLength is also the default length for "error"
beeps (for example, if you press an illegal key).
CommandSep = c: This is the character used to separate
multiple commands on the same line. The default is the
caret [^] in 4DOS, and the ampersand [&] in 4OS2 and
4DOS/NT. You cannot use any of the redirection
characters (| > < ) or any of the whitespace characters
(space, tab, comma, or equal sign). Also see SETDOS /C,
the %+ internal variable on page 74, and page 102 for
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 137
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
information on using compatible command separators for
two or more products.
CursorIns = nnnn (100): This is the shape of the cursor
for insert mode during command-line editing and all
commands which accept line input (DESCRIBE, ESET, etc.).
The size is a percentage of the total character cell
size, between 0% and 100%. Because of the way video
BIOSes and drivers map the cursor shape, you may not get
a smooth progression in cursor shapes as CursorIns and
CursorOver change. If CursorIns or CursorOver is set to
-1, the command processor will not attempt to modify the
cursor shape at all; you can use this feature to give
another program full control of the cursor shape. Also
see SETDOS /S.
CursorOver = nnnn (15): This is the shape of the cursor
for overtype mode during command-line editing and all
commands which accept line input. The size is a
percentage of the total character cell size, between 0%
and 100%. Also see SETDOS /S.
DescriptionMax = nnnn (40): Controls the description
length limit for DESCRIBE (see page 201). The allowable
range is 20 to 512 characters.
Descriptions = YES | No: Turns description handling on
or off during the file processing commands COPY, DEL,
MOVE, and REN. If set to No, the command processor will
not update the description file when files are moved,
copied, deleted or renamed. Also see SETDOS /D.
EditMode = Insert | OVERSTRIKE: This directive lets you
start the command-line editor in either insert or
overstrike mode. Also see SETDOS /M.
EscapeChar = c : Sets the character used to suppress the
normal meaning of the following character. The default
is Ctrl-X in 4DOS, and a caret [^] in 4OS2 and 4DOS/NT.
See page 73 for a description of the escape character and
special escape sequences. You cannot use any of the
redirection characters (|, >, or < ) or the whitespace
characters (space, tab, comma, or equal sign) as the
escape character. Also see SETDOS /E, the %= internal
variable on page 102, and page 74 for information on
using compatible escape characters for two or more
products.
EvalMax = nnnn (8): Controls the maximum number of
digits after the decimal point in values returned by
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 138
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
@EVAL (see page 112). This setting can be overridden
with the construct @EVAL[expression=n.n]. The allowable
range is 0 to 8. Also see SETDOS /F.
EvalMin = nnnn (0): Controls the minimum number of
digits after the decimal point in values returned by
@EVAL (see page 112). The allowable range is 0 to 8.
EvalMin will be ignored if it is larger than EvalMax.
This setting can be overridden with the construct
@EVAL[expression=n.n]. Also see SETDOS /F.
HistCopy = Yes | NO: Controls what happens when you re-
execute a line from the command history. If this option
is set to Yes, the line is appended to the end of the
history list. By default, or if this option is set to
No, no copy of the command is made. The original copy of
the command is always retained at its original position
in the list, regardless of the setting of HistCopy.
HistLogName = File: Sets the history log file name
and/or path. If only a path is given, the default log
file name (4DOSHLOG, 4OS2HLOG, etc.) will be used. Using
HistLogName does not turn history logging on; you must
use a LOG /H ON command to do so.
HistMin = nnnn (0): Sets the minimum command-line size
to save in the command history list. Any command line
whose length is less than this value will not be saved.
Legal values range from 0, which saves everything, to the
maximum command-line length plus 1 (i.e., 256 in 4DOS, or
1024 in 4OS2 and 4DOS/NT), which disables all command
history saves.
HistWinColors = Color: Sets the default colors for the
command-line and directory history windows. If this
directive is not used the colors will be reversed from
the current colors on the screen.
HistWinHeight = nn (12): Sets the height of the command-
line and directory history windows in lines, including
the border. Legal values range from 5 to the height of
your screen. Any value which would cause the bottom of
the window to be off the screen will be adjusted so that
the entire window remains on the screen.
HistWinLeft = nn (40): Sets the horizontal position of
the left side of the command-line and directory history
windows. Legal values range from 0 (the left edge of the
screen) to the number of columns on your screen minus 10.
Any value which would cause the right side of a minimum-
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 139
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
width window to be off the screen will be adjusted so
that the entire window remains on the screen.
HistWinTop = nn (1): Sets the vertical position of the
top of the command-line and directory history windows.
Legal values range from 0 (the top of the screen) to the
number of rows on your screen minus 5. Any value which
would cause the bottom of a minimum-height window to be
off the screen will be adjusted so that the entire window
remains on the screen.
HistWinWidth = nn (36): Sets the width of the command-
line and directory history windows in characters,
including the border. Legal values range from 10 to the
width of your screen. Any value which would cause the
right side of the window to be off the screen will be
adjusted so that the entire window remains on the screen.
4DOS, LineInput = Yes | NO: This directive controls how 4DOS
4OS2 and 4OS2 get their input from the command line. Yes
forces 4DOS and 4OS2 to perform line-by-line input, just
as COMMAND.COM and CMD.EXE do, instead of character-by-
character input. This will disable command-line editing,
history recall, the directory history window, and
filename completion, and will reduce the 4OS2 input
length limit from 1023 characters to 255 characters. It
is normally used only for rare memory-resident programs
(TSRs) or applications which do not work properly unless
the command processor uses line input. If you have a
particular program that requires line input, you can use
SETDOS /L to temporarily change modes. See APPNOTES.DOC
(for 4DOS) or README.DOC (for 4OS2) for information on
programs which require this option.
LogName = File: Sets the log file name and/or path. If
only a path is given, the default log file name (4DOSLOG,
4OS2LOG, etc.) will be used. Using LogName does not turn
logging on; you must use a LOG ON command to do so.
NoClobber = Yes | NO: If set to Yes, will prevent
standard output redirection (see page 52) from
overwriting an existing file, and will require that the
output file already exist for append redirection. Also
see SETDOS /N.
ParameterChar= c: Sets the character used after a
percent sign to specify all or all remaining command-line
arguments in a batch file or alias (e.g., %& or %n&; see
pages 82 and 168). The default is the ampersand [&] for
4DOS and the dollar sign [$] for 4OS2 and 4DOS/NT. Also
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 140
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
see SETDOS /P. See page 74 for information on using
compatible parameter characters for two or more
products..
Printer = devicename: Sets the output device that the
LIST command will print to. By default, LPT1 is used.
The device can be PRN, LPT1 to 3, COM1 to 4, NUL (which
will disable printed output) or any other installed
character device.
4DOS ScreenColumns = nnnn: Sets the number of columns used by
the video display. Normally the screen size is
determined automatically, but if you have a non-standard
display you may need to set it explicitly. Systems which
need to set OutputBIOS to Yes (see page 150) may also
need to use this directive.
ScreenRows = nnnn: Sets the number of screen rows used
by the video display. Normally the screen size is
determined automatically, but if you have a non-standard
display you may need to set it explicitly. This value
does not affect screen scrolling, which is controlled by
your operating system, or (under DOS) your video BIOS or
ANSI driver. ScreenRows is used only by the LIST and
SELECT commands, the paged output options of other
commands (e.g., TYPE /P), and error checking in the
screen output commands. Also see SETDOS /R.
UpperCase = Yes | NO: Yes specifies that file and
directory names should be displayed in the traditional
upper-case by internal commands like COPY and DIR. No
allows the normal 4DOS, 4OS2, and 4DOS/NT lower-case
style. This directive does not affect the display of
filenames on HPFS and NTFS drives, or on FAT drives under
Windows NT 3.5 and above; see page 17 for more details.
Also see SETDOS /U.
Color Directives
These directives control the colors that 4DOS, 4OS2, and
4DOS/NT use for their displays. Screen border colors can only
be set in StdColors. "BORder" color specifications included
in other directives will be ignored. For complete details on
color names see page 26.
4DOS, BrightBG = Yes | No. If set to Yes, 4DOS and 4OS2 will
4OS2 enable bright background colors. If set to No, bright
backgrounds will be disabled but blinking foreground
characters will be enabled. If BrightBG is not used,
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 141
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
4DOS and 4OS2 will not adjust the bright background /
blinking foreground switch at all. Most color video
boards default to a blinking foreground with bright
background colors disabled. See also SETDOS /B.
Using BrightBG requires careful attention to interactions
of display type, mode, and color. For a detailed
explanation, see page 28.
ColorDir = ext1 ext2 ...:colora;ext3 ext4 ... :colorb;
...: Sets the directory colors used by DIR and SELECT.
The format is the same as that used for the COLORDIR
environment variable. See page 30 for a detailed
explanation of color-coded directories.
InputColors = Color: Sets the colors used for command-
line input. This setting is useful for making your input
stand out from the normal output. InputColors will not
work properly under 4DOS unless you have an ANSI driver
loaded (see page 25 for more information on ANSI).
ListColors = Color: Sets the colors used by the LIST
command. If this directive is not used, LIST will use
the current default colors set by the CLS or COLOR
command or by the StdColors directive, below.
ListStatBarColors = Color: Sets the colors used on the
LIST status bar. If this directive is not used, LIST
will set the status bar to the reverse of the screen
color (the screen color is controlled by ListColors,
above).
SelectColors = Color: Sets the color used by the SELECT
command. If this directive is not used, SELECT will use
the current default colors set by the CLS or COLOR
command or by the StdColors directive, below.
SelectStatBarColors = Color: Sets the color used on the
SELECT status bar. If this directive is not used, SELECT
will set the status bar to the reverse of the screen
color (the screen color is controlled by SelectColors,
above).
StdColors = Color: Sets the standard colors to be used
when CLS is used without a color specification, and for
LIST and SELECT if ListColors and SelectColors are not
used. Using this directive is similar to placing a COLOR
command in AUTOEXEC.BAT. StdColors takes effect the
first time CLS, LIST, or SELECT is used after 4DOS, 4OS2,
or 4DOS/NT starts, but will not affect the color of error
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 142
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
or other messages displayed during the loading and
initialization process. Under 4DOS, if ANSI.SYS or a
compatible driver is not loaded, the colors will not be
"sticky" - you may lose them when you run an application.
## Key Mapping Directives
The directives in this group allow you to change the keys used
for command-line editing and other internal functions. They
take effect only inside 4DOS, 4OS2, or 4DOS/NT, and do not
affect other programs or the help system.
The description of each directive below explains the function
of the corresponding key. Using the directive allows you to
assign a different or additional key to perform the function
described. For example, to use function key F3 to invoke the
HELP facility (normally invoked with F1):
Help = F3
Any directive can be used multiple times to assign multiple
keys to the same function. For example:
ListFind = F ;F does a find in LIST
ListFind = F5 ;F5 also does a find in LIST
Use some care when you reassign keystrokes. If you assign a
default key to a different function, it will no longer be
available for its original use. For example, if you assign F1
to the AddFile directive (a part of filename completion), the
F1 key will no longer invoke the help system, so you will
probably want to assign a different key to Help.
Please read the information on key names beginning on page 31
before using the key mapping directives.
Key assignments are processed before looking for keystroke
aliases. For example, if you assign Shift-F1 to HELP and also
assign Shift-F1 to a key alias, the key alias will be ignored.
Assigning a new keystroke for a function does not deassign the
default keystroke for the same function. If you want to
deassign one of the default keys, use the NormalKey directive
described below or the corresponding directive for keys in the
other key groups (NormalEditKey, NormalHWinKey, or
NormalListKey).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 143
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
General Input Keys
This first set of Key Mapping Directives applies to all
input. These directives are in effect whenever 4DOS,
4OS2, or 4DOS/NT requests input from the keyboard,
including during command-line editing and the DESCRIBE,
ESET, INPUT, LIST, and SELECT commands. See page 35 for
more information about command-line editing.
Backspace = Key (Bksp): Deletes the character to the
left of the cursor.
BeginLine = Key (Home): Moves the cursor to the
beginning of the line.
Del = Key (Del): Deletes the character at the cursor.
DelToBeginning = Key (Ctrl-Home): Deletes from the
cursor to the start of the line.
DelToEnd = Key (Ctrl-End): Deletes from the cursor to
the end of the line.
DelWordLeft = Key (Ctrl-L): Deletes the word to the
left of the cursor.
DelWordRight = Key (Ctrl-R, Ctrl-Bksp): Deletes the
word to the right of the cursor. See ClearKeyMap on page
148 if you need to remove the default mapping of Ctrl-
Bksp to this function.
Down = Key (Down): Scrolls the display down one line in
LIST; moves the cursor down one line in SELECT and in the
command-line history, directory history, or %@SELECT
window. (Scrolling down through the command history at
the prompt is controlled by NextHistory on page 145, not
by this directive.)
EndLine = Key (End): Moves the cursor to the end of the
line.
EraseLine = Key (Esc): Deletes the entire line.
ExecLine = Key (Enter): Executes or accepts a line.
Ins = Key (Ins): Toggles insert / overstrike mode during
line editing.
Left = Key (Left): Moves the cursor left one character;
scrolls the display left 8 columns in LIST; scrolls the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 144
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
display left 4 columns in the command-line, directory
history, or %@SELECT window.
NormalKey = Key: Deassigns a general input key in order
to disable the usual meaning of the key within 4DOS,
4OS2, or 4DOS/NT and/or make it available for keystroke
aliases. This will make the keystroke operate as a
"normal" key with no special function. For example:
NormalKey = Ctrl-End
will disable Ctrl-End, which is the standard "delete to
end of line" key. Ctrl-End could then be assigned to a
keystroke alias. Another key could be assigned the
"delete to end of line" function with the DelToEnd
directive (above).
Right = Key (Right): Moves the cursor right one
character; scrolls the display right 8 columns in LIST;
scrolls the display right 4 columns in the command-line
history, directory history, or %@SELECT window.
Up = Key (Up): Scrolls the display up one line in LIST;
moves the cursor up one line in SELECT and in the
command-line history, directory history, or %@SELECT
window. (Scrolling up through the command history at the
prompt is controlled by PrevHistory on page 145, not by
this directive.)
WordLeft = Key (Ctrl-Left): Moves the cursor left one
word; scrolls the display left 40 columns in LIST.
WordRight = Key (Ctrl-Right): Moves the cursor right
one word; scrolls the display right 40 columns in LIST.
Command-Line Editing Keys
The following directives apply only to command-line
editing. They are only effective at the 4DOS, 4OS2, or
4DOS/NT prompt.
AddFile = Key (F10): Keeps the current filename
completion entry and inserts the next matching name.
CommandEscape = Key (Alt-255): Allows direct entry of a
keystroke that would normally be interpreted as an editor
command.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 145
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
DelHistory = Key (Ctrl-D): Deletes the displayed
history list entry and displays the previous entry.
EndHistory = Key (Ctrl-E): Displays the last entry in
the history list.
Help = Key (F1): Invokes the HELP facility.
NextFile = Key (F9, Tab): Gets the next matching
filename. See ClearKeyMap on page 148 if you need to
remove the default mapping of Tab to this function.
NextHistory = Key (Down): Recalls the next command from
the command history.
NormalEditKey = Key: Deassigns a command-line editing
key in order to disable the usual meaning of the key
while editing a command line, and/or make it available
for keystroke aliases. For details see the NormalKey
directive on page 145.
PopFile = Key (F7, Ctrl-Tab): Opens the filename
completion window. You may not be able to use Ctrl-Tab,
because not all systems recognize it as a keystroke. See
ClearKeyMap on page 148 if you need to remove the default
mapping of Ctrl-Tab to this function.
PrevFile = Key (F8, Shift-Tab): Gets the previous
matching filename. See ClearKeyMap on page 148 if you
need to remove the default mapping of Shift-Tab to this
function.
PrevHistory = Key (Up): Recalls the previous command
from the command history.
SaveHistory = Key (Ctrl-K): Saves the command line in
the command history list without executing it.
History and @SELECT Window Keys
The following directives apply only to the command
history window, the directory history window, and
%@SELECT windows.
DirWinOpen = Key (Ctrl-PgUp): Opens the directory
history window while at the command line.
HistWinBegin = Key (Ctrl-PgUp): Moves to the first line
of the history when in the history window.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 146
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
HistWinDel = Key (Ctrl-D): Deletes a line from within
the history window.
HistWinEdit = Key (Ctrl-Enter): Moves a line from the
history window to the prompt for editing.
HistWinEnd = Key (Ctrl-PgDn): Moves to the last line of
the history when in the history window.
HistWinExec = Key (Enter): Executes the selected line in
the history window.
HistWinOpen = Key (PgUp): Brings up the history window
while at the command line.
NormalHWinKey = Key: Deassigns a history window key in
order to disable the usual meaning of the key within the
history window. For details see the NormalKey directive
on page 145.
LIST Keys
The keys in the last group of Key Mapping Directives are
effective only inside the LIST command.
ListFind = Key (F): Prompts and searches for a string.
ListHex = Key (X): Toggles hexadecimal display mode.
ListHighBit = Key (H): Toggles LIST's "strip high bit"
option, which can aid in displaying files from certain
word processors.
ListInfo = Key (I): Displays information about the
current file.
ListNext = Key (N): Finds the next matching string.
ListPrint = Key (P): Prints the file on LPT1.
ListWrap = Key (W): Toggles LIST's wrap option on and
off. The wrap option wraps text at the right margin.
NormalListKey = Key: Deassigns a LIST key in order to
disable the usual meaning of the key within LIST. For
details see the NormalKey directive on page 145.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 147
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
## Advanced Directives
These directives are generally used for unusual circumstances,
or for diagnosing problems. Most often they are not needed in
normal use.
Advanced Directives For 4DOS, 4OS2, and 4DOS/NT
The directives in this section work in 4DOS, 4OS2, and
4DOS/NT.
ClearKeyMap: Clears all current key mappings.
ClearKeyMap is a special directive which has no value or
"=" after it. Use ClearKeyMap to make one of the keys in
the default map (Tab, Shift-Tab, Ctrl-Tab, or Ctrl-Bksp)
available for a keystroke alias, or in the [Secondary]
section of the .INI file to clear key mappings inherited
from the primary shell. ClearKeyMap should appear before
any key mapping directives. If you want to clear some
but not all of the default mappings, use ClearKeyMap,
then recreate the mappings you want to retain (e.g., with
"NextFile=Tab", etc.).
DescriptionName = File: Sets the file name in which to
store file descriptions. The default file name is
DESCRIPT.ION. Use this directive with caution because
changing the name from the default will make it difficult
to transfer file descriptions to another system.
NextINIFile = File. The full path and name of the file
must be specified. All subsequent shells will read the
specified .INI file, and ignore any [Secondary] section
in the original .INI file. Under 4DOS, if you have a
diskless or floppy-based workstation, NextINIFile will
allow you to shift 4DOS.INI to a network drive for
secondary shells, and avoid all access to the original
boot drive.
Advanced Directives For 4DOS Only
4DOS The following advanced directives apply to 4DOS only, and
will not work in 4OS2 or 4DOS/NT.
CritFail = Yes | NO: This is the same as /F on the
SHELL= line in CONFIG.SYS. It intercepts all DOS
critical errors and returns a Fail to each. We do not
recommend this on most systems, because you will not have
a chance to react to a critical error and correct the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 148
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
problem that caused it. It is intended for use on
bulletin boards or other systems where unattended
operation is required without user prompts.
DiskReset = Yes | NO: Enables or disables disk resets
after COPY, DEL/ERASE, DESCRIBE, MOVE, and REN/RENAME,
before DIR, and when starting 4DOS. Set to Yes if you
have problems with disk change detection on non-standard
or cached floppy disk drives, or with network software
which doesn't always properly flush data to the disk.
Such problems are very rare, so normally No is the best
choice. Setting DiskReset to Yes may increase the time
required to start a secondary shell, and may reduce the
performance of DIR, COPY, MOVE, and RENAME, when using a
"staged-write" disk cache such as Microsoft's SmartDrive.
See APPNOTES.DOC for details on how specific cache
software is affected by the DiskReset setting.
DVCleanup = YES | No. Controls the cleanup of 4DOS
resources (the shell number and any disk swap file) when
you close a 4DOS window from the DESQview menu. See
APPNOTES.DOC for more details.
FullINT2E = YES | No: Enables full support for the
COMMAND.COM "back door" (interrupt 2E) which some
programs use to execute commands. Effective only in a
primary shell loaded via the SHELL= command in
CONFIG.SYS. See Appendix B of the 4DOS Introduction and
Installation Guide for details on using INT 2E. Also,
see APPNOTES.DOC for information on programs known to
require this option. If this directive is set to No, INT
2E will return immediately to the calling program without
taking any action. Setting FullINT2E to No reduces the
size of the primary shell by about 100 bytes.
Inherit = YES | No: .INI file data, aliases, and the
history list are normally passed to secondary shells
automatically. No disables this feature.
MessageServer = YES | No: For compatibility with
COMMAND.COM in MS-DOS 4.x and above, 4DOS includes a
"message server" that retrieves error message text for
DOS external commands like DISKCOPY and FORMAT. The
message server increases the size of the resident portion
of 4DOS by about 200 bytes. No disables the message
server and saves this space, but will cause more cryptic
error messages such as "Parse error 3" or "Extended error
7" from some DOS external commands. The message server
is automatically enabled by 4DOS in the primary 4DOS
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 149
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
shell loaded from CONFIG.SYS when running under MS-DOS
4.x or above, and disabled elsewhere.
NetwareNames = Yes | NO. Set to Yes to include strings
in the resident portion of 4DOS which Novell Netware
searches for when it loads. NetwareNames should be Yes
for Netware systems to avoid problems with destroyed
environment variables during LOGIN. Setting NetwareNames
to Yes increases 4DOS's low DOS memory usage by 112
bytes.
OutputBIOS = Yes | NO: Determines whether 4DOS uses the
BIOS for all screen displays. If set to No, 4DOS will
use direct screen writes for color-coded directories and
the DRAWBOX, DRAWHLINE, DRAWVLINE, LIST, SELECT, SCRPUT,
and VSCRPUT commands. If set to Yes, 4DOS will perform
these commands using BIOS calls. This directive is only
needed for compatibility with unusual display adapters,
such as those used on Japanese systems running DOS/V.
Setting OutputBIOS to Yes may substantially reduce the
speed of the affected commands.
SDFlush = Yes | NO: Determines whether 4DOS instructs
Microsoft SMARTDRV (and other SMARTDRV-compatible disk
caching programs) to flush any "write-behind" buffers to
the disk before the 4DOS prompt is displayed. Setting
SDFlush to Yes may decrease performance, but will ensure
that SMARTDRV is instructed to write all modified data to
disk before the prompt is displayed. Also, SDFlush does
not take into account any changes in the design or
behavior of SMARTDRV after the release of 4DOS, or your
SMARTDRV startup options. Therefore setting SDFlush to
Yes does not guarantee that write-behind data will be
written to disk before the prompt is displayed, only that
SMARTDRV will be instructed to do so.
StackSize = nnnn (4096): Set the 4DOS internal stack
size. The allowable range of values is 4096 to 8192.
If you use complex combinations of "prefix" commands like
DO, EXCEPT, FOR, GLOBAL, IF, IFF, and SELECT on the same
command line, and especially if you use these commands in
multiple nested batch files or GOSUBs, you may encounter
a "4DOS internal stack overflow" error. If you do, you
should use this directive to increase the amount of stack
space available.
For virtually all users, the default stack size will be
sufficient. If you increase the stack size, you will
increase the size of 4DOS's transient portion in memory,
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 150
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
and the size of the 4DOS swap area, by the amount of the
stack size increase.
You will not normally encounter a stack size problem with
4OS2 or 4DOS/NT, because both can increase the size of
the internal stack dynamically. This is not feasible
under DOS.
SwapReopen = Yes | NO: Set to Yes to enable reopening of
the 4DOS swap file if it is closed by another program.
This is required when swapping 4DOS to Novell Netware
drives or when using other applications which close
4DOS's swap file. In all other circumstances, it is only
useful for diagnostic purposes. Setting SwapReopen to
Yes also disables the reduced swapping size normally used
in 4DOS secondary shells.
UniqueSwapName = Yes | No: Set to Yes to change the disk
swap file name from 4DOSSWAP.nnn to a unique name
generated by 4DOS, with an extension of "4SW" (e.g.,
A1CD6B11.4SW). This prevents conflicts between swap
files in different shells; it is only necessary when you
are using disk swapping with a COMMAND.COM primary shell
or in an OS/2 2.x DOS session. The default is Yes in
OS/2 DOS sessions and No elsewhere. UniqueSwapName only
works in DOS 3.0 and above, and in OS/2 DOS sessions, and
applies only to disk swapping.
Examples
The following examples will give you an idea of the types of
things that can be done with the .INI file. The comments on
each directive explain what it does.
First, a very simple 4DOS example that just sets up swapping
and environment size, leaving everything else at its default
value:
Swapping = ems, c:\ ;try EMS, then C: root
Environment = 1024 ;set environment size
Here's another 4DOS example, for a system which supports Upper
Memory blocks (UMBs). Several settings take advantage of
UMBs, and others modify the 4DOS configuration to match the
user's preferences. Note that the comment for the Swapping
directive is on separate lines before the directive itself, as
no comments are allowed in string directives:
Environment = 3072 ;expand environment to 3K
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 151
CHAPTER 5 / CONFIGURATION
-------------------------------------------------------------------
Alias = 6144 ;expand aliases to 6K
LocalHistory = No ;use a global history
;for swapping try XMS, then RAM disk H:, then
;hard disk C:
Swapping = xms, h:\, c:\
UMBLoad = Yes ;res. part of 4DOS in UMB
UMBEnvironment = Yes ;master environment in UMB
UMBHistory = Yes ;global history in UMB
BatchEcho = No ;default is ECHO OFF
EditMode = Insert ;editor in insert mode
CursorOver = 100 ;overstrike cursor 100%
CursorIns = 10 ;insert cursor 10%
This example for 4OS2 configures certain special characters to
match 4DOS, and changes other default settings to suit the
user's preferences. All of these settings except HelpBook
would also work in 4DOS or 4DOS/NT. You must enter the actual
escape character, not the string "<Ctrl-X>", in the EscapeChar
directive:
PauseOnError = No ;don't stop on INI errors
CommandSep = ^ ;4DOS command separator
EscapeChar = <Ctrl-X> ;4DOS escape character
ParameterChar = & ;4DOS parameter character
BatchEcho = No ;default to ECHO OFF
HelpBook = 4OS2
History = 2048 ;expand history to 2K bytes
BeepFreq = 880 ;make beep higher pitch
EditMode = Insert ;insert mode for cmd edit
CursorOver = 100 ;overstrike cursor 100%
CursorIns = 10 ;insert cursor 10%
ListFind = F5 ;F5 does a find in LIST
ListNext = F6 ;and F6 does a find next
StdColors = bri cya on blu ;default colors
ListColors = bri whi on blu ;colors for LIST
SelectColors = bri whi on blu ;same colors for SELECT
colordir = DIRS:bri yel;com exe bat btm cmd:bri whi
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 152
CHAPTER 6 / COMMAND REFERENCE GUIDE
-------------------------------------------------------------------
CHAPTER 6 / COMMAND REFERENCE GUIDE
The following pages are a complete guide and reference to the 4DOS,
4OS2, and 4DOS/NT commands that are available from the command
line, in aliases, and in batch files. All of these commands are
internal commands, which means that the command processor performs
the activity you have requested without running another program.
(See page 19 for more information on internal and external
commands.)
We offer over 80 internal commands, many more than any version of
COMMAND.COM or CMD.EXE. These neither replace nor interfere with
external commands like BACKUP, CHKDSK, DISKCOPY, or XCOPY. You can
continue to use those utilities like you always have. Also, each
of our command processors has been designed to be compatible with
virtually all traditional internal commands, and to enhance most of
those commands with additional options and capabilities. Once you
have installed your new command processor, you can continue using
the commands that you already know and get the same results.
We have made no attempt to document external DOS, OS/2, and Windows
NT commands in this reference, partly because they are explained in
your operating system manual, and partly because external commands,
and the options available with each command, vary widely from one
operating system to another and from one version to another. The
4DOS HELP system does include information about standard DOS
external commands, and the 4OS2 HELP system can be configured to
display information about OS/2 external commands (see the
Introduction and Installation Guide for each product for further
details).
Most 4DOS, 4OS2, and 4DOS/NT commands are either enhanced
traditional commands or are entirely new (a few are the same as
traditional commands). If you are comfortable using traditional
commands, you can switch to your new command processor without
making any changes in your habits. But you will be missing a lot
of the power of these enhancements and new commands unless you take
a few minutes to see what's available here. Make sure you don't
skip a section of this reference just because you already know how
to use a traditional command with the same name.
If you come across terms or concepts in this chapter that you are
unsure about, please refer to Chapter 1 / General Concepts, the
Glossary on page 381, or the Index.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 153
CHAPTER 6 / COMMAND REFERENCE GUIDE
-------------------------------------------------------------------
Command Categories
The best way to learn the commands is to use them and
experiment with them. We urge you to browse through this
chapter occasionally and look for commands that might help
simplify your computing life. The following lists categorize
the available commands by topic and will help you find the
ones that you need. Commands listed below with an asterisk
[*] are not available in all command processors; see the list
at the end for details.
System configuration:
BREAK * CHCP * CLS COLOR
CTTY * DATE FREE HISTORY
KEYS * KEYBD LH/LOADHIGH* LOG
MEMORY PROMPT REBOOT SETDOS
SWAPPING * TIME VER VERIFY
VOL
File and directory management:
ATTRIB COPY DEL/ERASE DESCRIBE
LIST MOVE REN/RENAME SELECT
TRUENAME * TYPE
Subdirectory management:
CD/CHDIR CDD DIR DIRS
MD/MKDIR POPD PUSHD RD/RMDIR
Input and output:
DRAWBOX DRAWHLINE DRAWVLINE ECHO
ECHOS INKEY INPUT KEYSTACK *
MSGBOX * SCREEN SCRPUT TEXT
VSCRPUT
Commands primarily for use in or with batch files and aliases
(some work only in batch files; see the individual commands
for details):
ALIAS BEEP CALL CANCEL
DELAY DO ENDLOCAL FOR
GLOBAL GOSUB GOTO IF
IFF LOADBTM ON PAUSE
QUIT REM RETURN SETLOCAL
SHIFT TEXT UNALIAS
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 154
CHAPTER 6 / COMMAND REFERENCE GUIDE
-------------------------------------------------------------------
Environment and path commands:
DPATH * ESET PATH SET
UNSET
Window management commands:
ACTIVATE * TITLE * WINDOW *
Other commands:
? DETACH * EXCEPT EXIT
FFIND HELP LIST START
TEE TIMER Y
* Some of these commands are not included in one or more of
our command processors. Usually a command is left out of a
product when it is not useful or cannot be implemented in that
environment (for example, the DETACH command is related to
multitasking, and is not available under DOS because DOS does
not offer multitasking). The commands that are specific to
particular products are:
ACTIVATE.....4DOS/NT KEYSTACK......4DOS
BREAK........4DOS, 4DOS/NT LH/LOADHIGH...4DOS
CHCP.........4DOS, 4OS2 MSGBOX........4DOS/NT
CTTY.........4DOS. SWAPPING......4DOS
DETACH.......4OS2, 4DOS/NT TITLE.........4DOS/NT
DPATH........4OS2. TRUENAME......4DOS
KEYS.........4OS2, 4DOS/NT WINDOW........4OS2, 4DOS/NT
How to Use the Command Descriptions
Each of the internal commands is described in detail on the
following pages. The descriptions are arranged
alphabetically, and each includes examples that will help you
learn to use the commands.
Each description begins with the name of the command on the
left side of the page. If the command is only available in
some of our products, those products are listed next to the
command name, and in the page header. Commands marked "New"
on the right side of the page are unique to 4DOS, 4OS2, or
4DOS/NT. Those marked "Enhanced" are similar to traditional
commands but add new features and options. The commands
marked "Compatible" follow the syntax and features of the
traditional command with the same name.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 155
CHAPTER 6 / COMMAND REFERENCE GUIDE
-------------------------------------------------------------------
The name is followed by a sentence or two that briefly
describes the command's purpose or major function. That
sentence should help you determine quickly whether you have
found the command you are seeking.
The next part of each description shows the command's format
or syntax. The format line uses certain conventions to
describe how the command should be entered and to create
reference points for the text describing the command:
Words in UPPER CASE must be spelled exactly as they are
shown (although you can type them in either upper or
lower case, or a combination). If a word is shown partly
in upper case (for example BLInk), only the upper case
portion is required, the rest is optional.
Words shown in italics (for example source or filename)
are meant to be replaced by other words or values. Each
of these words is explained directly beneath the format
line and discussed in more detail in the text description
of the command. When the word stands for a file name,
you can use a simple name like MYFILE.TXT, or include a
drive letter and/or a full path, like
C:\MYDIR\MYFILE.TXT.
Items followed by an ellipsis (three periods [...]) may
be repeated. For example, filename ... means you may
enter one or more file names at this point in the
command.
Text shown in [square brackets] is optional. Text
outside of square brackets must be entered literally (if
it is capitalized) or replaced by other words or values
(if it is in italics).
Vertical bars [|] represent a choice; you can pick one
option or another but not both. For example, the
following format shows that the command may be followed
by the word ON or the word OFF, but not both:
COMMAND [ ON | OFF ]
A slash followed by a letter, like [/X], is an "option"
or "switch" which controls the effect of a command. Many
commands have several switches, and you are usually free
to use none, one, or several to make a command behave as
you wish. If you use a single switch, you must precede
it with a slash. If you use several switches, in most
cases you can put them together with one slash or use
separate slashes. For example, if you wanted to use
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 156
CHAPTER 6 / COMMAND REFERENCE GUIDE
-------------------------------------------------------------------
switches X, Y, and Z for a command, you could type them
three different ways:
command /x /y /z
command /x/y/z
command /xyz
A few switches, particularly in the DIR, SELECT, and
START commands, use two or more characters. If you need
to follow a multi-letter switch with another switch, the
second switch must have its own slash to avoid ambiguity.
Included in the format section is an explanation of each
replaceable argument and a one or two word explanation of each
switch. Many descriptions also list related commands to help
you find the exact command you want.
For file handling commands, a section called "Selection"
appears immediately after the format section. This section
lists the file-handling features that the command supports.
The list may include mention of extended wildcards (see page
59); multiple file names (page 66); include lists (page 67);
and date, time, and size ranges (see page 62).
Next, you'll find a description of the command's usage. This
description normally starts with the basic functions of a
command and gradually adds more details. We've also included
many examples to help you see the command in action. In the
examples, characters in bold type represent input from the
user. Characters in normal type represent prompts or
responses from the command processor, or lines in a batch
file.
The last part of each description is a detailed explanation of
the options or switches available for each command, in
alphabetical order. Occasionally, we've included more
examples in this section to demonstrate how a switch is used
or how multiple switches interact.
Most of the commands and their switches have the same use in
4DOS, 4OS2, and 4DOS/NT. When a command, feature, or switch
applies to a single product, we mention it specifically in the
text. When an entire paragraph applies to a specific product,
we use marginal text to identify that product. When an entire
command is only available in one or two products, the products
are listed next to the command name, and in the page headings.
4DOS marks information that applies only to 4DOS.
4OS2 marks information that applies only to 4OS2.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 157
CHAPTER 6 / COMMAND REFERENCE GUIDE
-------------------------------------------------------------------
4NT marks information that applies only to 4DOS/NT.
Occasionally, a command or switch will be marked with two of
these marginal notations when it applies to two different
products.
An exclamation point [!] to the left of a paragraph means that
paragraph contains a caution or warning you should observe
when using the feature it discusses.
In the Usage and Options sections you may see the symbol ##.
This indicates a more in-depth discussion or an advanced topic
which you can skip if you are new to the command; come back to
this topic later for more details, or if you're having trouble
with the command. In most cases the remainder of the section
after such a symbol is devoted to similar information.
The ## doesn't mean that only advanced users will need the
information - you may find it useful even if you're relatively
new to computers or to our products. But it does mean that
you can skip the marked section and still understand and use
the basic features of the command. If a ## appears before the
"Usage" heading, it indicates that the entire command is
generally used only in unusual situations or by more advanced
users.
When you see a ## in the list of options, remember that the
options are listed alphabetically, so there may be more basic
options discussed later in the list, after a more complex or
advanced option marked with ##. Don't stop reading the option
list the first time you see the mark.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 158
?
-------------------------------------------------------------------
? (New)
Purpose: Display a list of internal commands or prompt for a
command.
Format: ? ["prompt text" command]
Usage: ? by itself displays a list of internal commands. For
help with these commands, see the HELP command.
When you use the ? command by itselt, you will see a
display like this (the partial list below is for 4DOS;
you will see a slightly different list for 4OS2 or
4DOS/NT):
c:\> ?
? ALIAS ATTRIB BEEP
BREAK CALL CANCEL CD
CDD CHCP CHDIR CLS
COLOR COPY CTTY DATE
.....
.....
TIMER TRUENAME TYPE UNALIAS
UNSET VER VERIFY VOL
VSCRPUT Y
If you have disabled a command with SETDOS /I, it will
not appear in the list.
If you add prompt text and a command, ? will display
the prompt followed by "(Y/N)?" and wait for the
user's response. If the user presses "Y" or "y", the
command will be executed. If the user presses "N" or
"n", the command will be ignored.
For example, the following command might be used in a
batch file:
? "Load the network" call netstart.btm
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 159
[4DOS/NT] ACTIVATE
-------------------------------------------------------------------
ACTIVATE [4DOS/NT] (New)
Purpose: Activate a window, set its state, or change its title.
Format: ACTIVATE "window" [MAX | MIN | RESTORE | CLOSE |
"title" ]
window: Current title of window to work with.
title: New title for window.
See also: START, TITLE, and WINDOW.
Usage: Both the current name of the window and the new name,
if any, must be enclosed in double quotes. The quotes
will not appear as part of the title bar text.
If no options are used, the window named in the
command will become the active window and be able to
receive keystrokes and mouse commands.
The MAX option expands the window to its maximum size,
the MIN option reduces the window to an icon, and the
RESTORE option returns the window to its default size
and location on the desktop. The CLOSE option closes
the window and ends the session running in the window.
This example renames and maximizes the window called
"4DOS/NT":
[c:\] activate "4DOS/NT" max "4DOS/NT is Great!"
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 160
ALIAS
-------------------------------------------------------------------
ALIAS (New)
Purpose: Create new command names that execute one or more
commands or redefine default options for existing
commands; assign commands to keystrokes; load or
display the list of defined alias names.
Format: ALIAS [/P /R file...] [name[=][value]]
file: One or more files to read for alias
definitions.
name: Name for an alias, or for the key to execute
the alias.
value: Text to be substituted for the alias name.
/P(ause) /R(ead file)
See also: UNALIAS, and Aliases on page 77.
Usage: The ALIAS command lets you create new command names or
redefine internal commands. It also lets you assign
one or more commands to a single keystroke. An alias
is often used to execute a complex series of commands
with a few keystrokes or to create "in memory batch
files" that run much faster than disk-based batch
files.
For example, if you would rather type D instead of DIR
/W, you would use the command:
c:\> alias d = dir /w
Now when you type a single d as a command, it will be
translated into a DIR /W command.
If you define aliases for commonly used application
programs, you can often remove the directories they're
stored in from the PATH. For example, if you use
Quattro Pro and had the C:\QPRO directory in your
path, you could define the following alias:
c:\> alias qpro = c:\qpro\q.exe
With this alias defined, you can probably remove
C:\QPRO from your path. Quattro Pro will now load
much faster than it would if the command processor had
to search the PATH for it. In addition, the PATH can
be shorter, which will speed up searches for other
programs.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 161
ALIAS
-------------------------------------------------------------------
If you apply this technique for each application
program, you can often reduce your PATH to just two or
three directories containing utility programs, and
significantly reduce the time it takes to load most
software on your system. Before removing a directory
from the PATH, you will need to define aliases for all
the executable programs you commonly use which are
stored in that directory.
Aliases are stored in memory, and are not saved
automatically when you turn off your computer or end
your current session. See page 167 for information on
saving and reloading your aliases.
Multiple Commands and Special Characters in Aliases
An alias can represent more than one command. For
example:
c:\> alias letters = `cd \letters ^ text`
creates a new command called LETTERS. The command
first uses CD to change to a subdirectory called
\LETTERS and then runs a program called TEXT. The
caret [^] is the 4DOS command separator and indicates
that the two commands are distinct and should be
executed sequentially. (The 4OS2 and 4DOS/NT command
separator is normally an ampersand [&].)
Aliases make extensive use of the command separator
(see page 47), and the parameter character (see page
140), and may also use the escape character (see page
73). These characters differ between 4DOS and 4OS2 or
4DOS/NT. In the text and examples below, we use the
4DOS characters. The difference is also explained the
first time each character is used. Be sure to insert
the correct characters for the command processor you
are using. If you want to use the same aliases under
different command processors, see page 74.
When you type alias commands at the command line or in
a batch file, you must use back-quotes [`] around the
definition if it contains multiple commands,
parameters (discussed below), environment variables,
redirection, or piping. The back-quotes prevent
premature expansion of these arguments. You may use
back-quotes around other definitions, but they are not
required. (You do not need back-quotes when your
aliases are loaded from an ALIAS /R file; see below
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 162
ALIAS
-------------------------------------------------------------------
for details.) The examples above and below include
back-quotes only when they are required.
Nested Aliases
Aliases may invoke internal commands, external
commands, or other aliases. (However, an alias may
not invoke itself, except in special cases where an IF
or IFF command is used to prevent an infinite loop.)
The two aliases below demonstrate alias nesting (one
alias invoking another). The first line defines an
alias which runs a program called WP.EXE that is in
the E:\WP60\ subdirectory. The second alias changes
directories with the PUSHD command, runs the WP alias,
and then returns to the original directory with the
POPD command:
c:\> alias wp = e:\wp60\wp.exe
c:\> alias w = `pushd c:\wp ^ wp ^ popd`
The second alias above could have included the full
path and name of the WP.EXE program instead of calling
the WP alias. However, writing two aliases makes the
second one easier to read and understand, and makes
the first alias available for independent use. If you
rename the WP.EXE program or move it to a new
directory, only the first alias needs to be changed.
Temporarily Disabling Aliases
If you put an asterisk [*] immediately before a
command in the value of an alias definition (the part
after the equal sign), it tells the command processor
not to attempt to interpret that command as another
(nested) alias. An asterisk used this way must be
preceded by a space or the command separator and
followed immediately by an internal or external
command name. The asterisk is used to signal that the
following word is the name of an internal or external
command instead of an alias which may have the same
name. It also allows two popular uses of aliases.
First, by using an asterisk, you can redefine the
default options for any internal command. For
example, suppose that you always want to use the DIR
command with the /2 (two column) and /P (pause at the
end of each page) options. The following line will do
just that:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 163
ALIAS
-------------------------------------------------------------------
c:\> alias dir = *dir /2/p
If you didn't include the asterisk, the second DIR on
the line would be the name of the alias itself, and
the command processor would repeatedly re-invoke the
DIR alias, rather than running the DIR command. This
would cause an "Alias loop" or "Command line too long"
error. The asterisk forces interpretation of the
second DIR as a command, not an alias.
Second, an asterisk also helps you keep the names of
internal commands from conflicting with the names of
external programs. For example, suppose you have a
program called LIST.COM. Normally, the internal LIST
command will run anytime you type LIST. But two
simple aliases will give you access to both the
LIST.COM program and the LIST command:
c:\> alias list = c:\util\list.com
c:\> alias display = *list
The first line above defines LIST as an alias for the
LIST.COM program. If you stopped there, the external
program would run every time you typed LIST and you
would not have easy access to the internal LIST
command. The second line renames the internal LIST
command as DISPLAY. The asterisk is needed in the
second command to indicate that the following word
means the internal command LIST, not the LIST alias
which runs your external program.
Another way to understand the asterisk is to remember
that a command is always checked for an alias first,
then for an internal or external command, or a batch
file (see page 121). The asterisk at the beginning of
a command name simply skips over the usual check for
aliases when processing that command, and allows the
command processor to go straight to checking for an
internal command, external command, or batch file.
You can also use an asterisk before a command that you
enter at the command line or in a batch file. If you
do, that command won't be interpreted as an alias.
This can be useful when you want to be sure you are
running the true, original command and not an alias
with the same name, or temporarily defeat the purpose
of an alias which changes the meaning or behavior of a
command. For example, above we defined an alias for
DIR which made directories display in 2-column paged
mode by default. If you wanted to see a directory
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 164
ALIAS
-------------------------------------------------------------------
display in the normal single-column, non-paged mode,
you could enter the command *DIR and the alias would
be ignored during that one command.
Partial Alias Names
You can also use an asterisk in the name of an alias.
When you do, the characters following the asterisk are
optional when you invoke the alias command. (Use of
an asterisk in the alias name is unrelated to the use
of an asterisk in the alias value discussed above.)
For example, with this alias:
c:\> alias wher*eis = dir /sp
the new command, WHEREIS, can be invoked as WHER,
WHERE, WHEREI, or WHEREIS. Now if you type:
c:\> where myfile.txt
The WHEREIS alias will be expanded to the command:
dir /sp myfile.txt
Keystroke Aliases
If you want to assign an alias to a keystroke, use the
keyname on the left side of the equal sign, preceded
by an at sign [@]. For example, to assign the command
DIR /W to the F5 key, type
c:\> alias @F5 = dir /w
See page 31 for a complete listing of key names and a
description of the key name format.
When you define keystroke aliases, the assignments
will only be in effect at the command line, not inside
application programs. Be careful not to assign
aliases to keys that are already used at the command
line (like F1 for Help). The command-line meanings
take precedence and the keystroke alias will never be
invoked. If you want to use one of the command-line
keys for an alias instead of its normal meaning, you
must first disable its regular use with the NormalKey
or NormalEditKey directive in your .INI file. See
page 143 for instructions.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 165
ALIAS
-------------------------------------------------------------------
If you define a keystroke alias with a single at sign
as shown above, then, when you press the F5 key, the
value of the alias (DIR /W above) will be placed on
the command line for you. You can type additional
parameters if you wish and then press Enter to execute
the command. With this particular alias, you can
define the files that you want to display after
pressing F5 and before pressing Enter to execute the
command.
If you want the keystroke alias to take action
automatically without waiting for you to edit the
command line or press Enter, you can begin the
definition with two at signs [@@]. The command
processor will execute the alias "silently," without
displaying its text on the command line. For example,
this command will assign an alias to the F6 key that
uses the CDD command to take you back to the previous
default directory:
c:\> alias @@f6 = cdd -
## A second method can also be used to make a keystroke
alias execute immediately: you can include a carriage
return character as the last character in the alias
definition. When the command processor finds the
carriage return, it executes the alias just as if you
had pressed the Enter key. Unlike the "@@" method
(above), this method will display the contents of the
alias on the screen. If you use this method, do not
define the alias with a double at sign as well. If
you do, the alias will not work properly.
To include the carriage return character, add an
escape character followed by an "r" to the end of the
alias (see page 73 for more information about the
escape character). For example, you could write the
above alias as:
c:\> alias @f6 = `cdd -<Ctrl-X>r`
(If you define your alias at the command line without
using back-quotes, you must use two escape characters
before the "r". In 4DOS, the default escape character
is <Ctrl-X>; in 4OS2 and 4DOS/NT, the default escape
character is a caret [^].)
## You can also define a keystroke alias by using "@" or
"@@" plus a scan code for one of the permissible keys
(see Appendix B on page 371 for a list of scan codes).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 166
ALIAS
-------------------------------------------------------------------
In most cases it will be easier to use key names.
Scan codes should only be used with unusual keyboards
where a key name is not available for the key you are
using.
Displaying Aliases
If you want to see a list of all current ALIAS
commands, type:
c:\> alias
You can also view the definition of a single alias.
If you want to see the definition of the alias LIST,
you can type:
c:\> alias list
Saving and Reloading Your Aliases
You can save your aliases to a file called ALIAS.LST
this way:
c:\> alias > alias.lst
You can then reload all the alias definitions in the
file the next time you boot up with the command:
c:\> alias /r alias.lst
This is much faster than defining each alias
individually in a batch file. If you keep your alias
definitions in a separate file which you load when
your system starts, you can edit them with a text
editor, reload the edited file with ALIAS /R, and know
that the same alias list will be loaded the next time
you boot your computer.
When you define aliases in a file that will be read
with the ALIAS /R command, you do not need back-quotes
around the value, even if back-quotes would normally
be required when defining the same alias at the
command line or in a batch file.
To remove an alias, use the UNALIAS command.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 167
ALIAS
-------------------------------------------------------------------
Alias Parameters
## Aliases can use command-line arguments or parameters
like those in batch files. The command-line arguments
are numbered from %0 to %127. %0 contains the alias
name. It is up to the alias to determine the meaning
of the other parameters. You can use quotation marks
to pass spaces, tabs, commas, and other special
characters in an alias parameter; see page 123 for
details.
Parameters that are referred to in an alias, but which
are missing on the command line, appear as empty
strings inside the alias. For example, if you put two
parameters on the command line, any reference in the
alias to %3 or any higher-numbered parameter will be
interpreted as an empty string.
The parameter %n& has a special meaning. 4DOS
interprets it to mean "the entire command line, from
argument n to the end." If n is not specified, it has
a default value of 1, so %& means "the entire command
line after the alias name." 4OS2 and 4DOS/NT normally
use a dollar sign [$] instead of an ampersand [&] to
indicate the remainder of the command tail (for
example, use %$ to refer to all parameters under 4OS2
or 4DOS/NT). The special parameter %# contains the
number of command-line arguments.
For example, the following alias will change
directories, perform a command, and return to the
original directory:
c:\> alias in `pushd %1 ^ %2& ^ popd`
When this alias is invoked as:
c:\> in c:\comm mycomm /xmodem /2400
the first parameter, %1, has the value c:\comm. %2 is
mycomm, %3 is /xmodem, and %4 is /2400. The command
line expands into these three separate commands:
pushd c:\comm
mycomm /xmodem /2400
popd
## This next example uses the IFF command to redefine the
defaults for SET. It should be entered on one line:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 168
ALIAS
-------------------------------------------------------------------
c:\> alias set = `iff %# == 0 then ^ *set /p
^ else ^ *set %& ^ endiff`
This modifies the SET command so that if SET is
entered with no arguments, it is replaced by SET /P
(pause after displaying each page), but if SET is
followed by an argument, it behaves normally. Note
the use of asterisks (*set) to prevent alias loops.
## If an alias uses parameters, command-line arguments
will be deleted up to and including the highest
referenced argument. For example, if an alias refers
only to %1 and %4, then the first and fourth arguments
will be used, the second and third arguments will be
discarded, and any additional arguments beyond the
fourth will be appended to the expanded command (after
the value portion of the alias). If an alias uses no
parameters, all of the command-line arguments will be
appended to the expanded command.
## Aliases also have full access to all variables in the
environment, internal variables, and variable
functions. For example, you can create a simple
command-line calculator this way (enter this on one
line):
c:\> alias calc = `echo The answer is:
%@eval[%&]`
Now, if you enter:
c:\> calc 5 * 6
the alias will display:
The answer is: 30
## Local and Global Aliases
The aliases can be stored in either a "local" or
"global" list.
With a local alias list, any changes made to the
aliases will only affect the current copy of the
command processor. They will not be visible in other
shells or other sessions. A local alias list is the
default under 4DOS.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 169
ALIAS
-------------------------------------------------------------------
With a global alias list, all copies of the command
processor will share the same alias list, and any
changes made to the aliases in one copy will affect
all other copies. A global alias list is the default
for 4OS2 and 4DOS/NT.
You can control the type of alias list with the
LocalAliases directive in the .INI file (see page
134), and with the /L and /LA options of the START
command (see page 331).
There is no fixed rule for determining whether to use
a local or global alias list. Depending on your work
style, you may find it most convenient to use one
type, or a mixture of types in different sessions or
shells. We recommend that you start with the default
approach for your command processor, then modify it if
you find a situation where the default is not
convenient.
Whenever you start a secondary shell (see page 12)
which uses a local alias list, it inherits a copy of
the aliases from the previous shell. However, any
changes to the alias made in the secondary shell will
affect only that shell. If you want changes made in a
secondary shell to affect the previous shell, use a
global alias list in both shells.
4DOS If you select a global alias list for 4DOS running
under DOS, you can share the aliases among all copies
of 4DOS. However, if you run 4DOS under OS/2, global
lists will apply within each DOS session, but will not
allow you to share aliases between different DOS
sessions.
4OS2, ## Retaining Global Aliases with SHRALIAS
4NT
If you select a global alias list for 4OS2 or 4DOS/NT,
you can share the aliases among all copies of the
command processor running in any session. When you
close all 4OS2 or 4DOS/NT sessions, the memory for the
global alias list is released, and a new, empty alias
list is created the next time you start 4OS2 or
4DOS/NT.
If you want the alias list to be retained in memory
even when no command processor session is running, you
need to load the SHRALIAS program, which performs this
service for both the global alias list and the global
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 170
ALIAS
-------------------------------------------------------------------
history list. SHRALIAS is supplied with your copy of
4OS2 or 4DOS/NT.
To load SHRALIAS, simply run the SHRALIAS.EXE program,
which is normally installed in the same directory as
your command processor. You may find it convenient to
load SHRALIAS from your 4START file (see page 85), or,
under OS/2, from your STARTUP.CMD (see your 4OS2
Introduction and Installation Guide for details on
STARTUP.CMD).
If you try to load SHRALIAS when there is no 4OS2 or
4DOS/NT session running with a global alias or history
list enabled, then SHRALIAS will not be able to find
the lists. In this case it will display an error
message and exit. If you load SHRALIAS more than
once, the second copy will detect the original copy,
display an error message, and exit. The original copy
will remain loaded.
SHRALIAS runs as a "detached" process, which means it
does not have a screen display or accept keyboard
input. It is shut down automatically when the
operating system shuts down. To unload SHRALIAS
manually, run SHRALIAS.EXE with the parameter /U.
## The UNKNOWN_CMD Alias
If you create an alias with the name UNKNOWN_CMD, it
will be executed any time the command processor would
normally issue an "Unknown command" error message.
This allows you to define your own handler for unknown
commands. When the UNKNOWN_CMD alias is executed, the
command line which generated the error is passed to
the alias for possible processing.
! Use caution when you create the UNKNOWN_CMD alias. If
it contains an unknown command, it will be called
repeatedly and the command processor will lock up in
an infinite loop.
Options: /P(ause): This option is only effective when ALIAS is
used to display existing definitions. It pauses the
display after each page and waits for a keystroke
before continuing (see page 50).
/R(ead file): This option loads an alias list from a
file. The format of the file is the same as that of
the ALIAS display:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 171
ALIAS
-------------------------------------------------------------------
name=value
where name is the name of the alias and value is its
value. You can use an equal sign [=] or space to
separate the name and value. Back-quotes are not
required around the value. You can add comments to
the file by starting each comment line with a colon
[:]. You can load multiple files with one ALIAS /R
command by placing the names on the command line,
separated by spaces:
c:\> alias /r alias1.lst alias2.lst
Each definition in an ALIAS /R file can be up to 511
characters long in 4DOS, or 2047 characters in 4OS2
and 4DOS/NT. The definitions can span multiple lines
in the file if each line, except the last, is
terminated with an escape character (see page 73).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 172
ATTRIB
-------------------------------------------------------------------
ATTRIB (Enhanced)
Purpose: Change or view file and subdirectory attributes.
Format: ATTRIB [/A[[:][-]rhsda] /D /P /Q /S] [+|-[AHRS]] files
...
files: A file, directory, or list of files or
directories on which to operate.
/A(ttribute select) /Q(uiet)
/D(irectories) /S(ubdirectories)
/P(ause)
Attribute flags:
A+ Set the archive attribute
A- Clear the archive attribute
H+ Set the hidden attribute
H- Clear the hidden attribute
R+ Set the read-only attribute
R- Clear the read-only attribute
S+ Set the system attribute
S- Clear the system attribute
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: Every file and subdirectory has 4 attributes that can
be turned on (set) or turned off (cleared): Archive,
Hidden, Read-only, and System. For details on the
meaning of each attribute, see page 18.
The ATTRIB command lets you set or clear attributes
for any file, group of files, or subdirectory. You
can view file attributes by entering ATTRIB without
specifying new attributes (i.e., without the [+|-
[AHRS]] part of the format), or with the DIR /T
command.
For example, you can set the read-only and hidden
attributes for the file MEMO:
c:\> attrib +rh memo
Attribute options apply to the file(s) that follow the
options on the ATTRIB command line. The example below
shows how to set different attributes on different
files with a single command. It sets the archive
attribute for all .TXT files, then sets the system
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 173
ATTRIB
-------------------------------------------------------------------
attribute and clears the archive attribute for
TEST.COM:
c:\> attrib +a *.txt +s -a test.com
## Your operating system also supports "D" (subdirectory)
and "V" (volume label) attributes. These attributes
cannot be altered with ATTRIB; they are designed to be
controlled only by the operating system itself.
Options: ## /A(ttribute select): Select only those files that have
the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will select
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., ATTRIB /A
...), ATTRIB will select all files and subdirectories
including hidden and system files. If attributes are
combined, all the specified attributes must match for
a file to be selected. For example, /A:RHS will
select only those files with all three attributes set.
See page 18 for more information on file attributes.
/D(irectories): If you use the /D option, ATTRIB will
modify the attributes of subdirectories in addition to
files (yes, you can have a hidden subdirectory):
c:\> attrib /d +h c:\mydir
In addition, the /D option will keep ATTRIB from
appending "\*.*" to the end of a directory name and
modifying the attributes of all the files in the
subdirectory.
If you use a directory name instead of a file name,
and omit /D, ATTRIB will append "\*.*" to the end of
the name and act on all files in that directory,
rather than acting on the directory itself.
/P(ause): Wait for a key to be pressed after each
screen page before continuing the display. Your
options at the prompt are explained in detail on page
50.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 174
ATTRIB
-------------------------------------------------------------------
/Q(uiet): This option turns off ATTRIB's normal
screen output. It is most useful in batch files.
/S(ubdirectories): If you use the /S option, the
ATTRIB command will be applied to all matching files
in the current or named directory and all of its
subdirectories.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 175
BEEP
-------------------------------------------------------------------
BEEP (New)
Purpose: Beep the speaker or play simple music.
Format: BEEP [frequency duration ...]
frequency: The beep frequency in Hertz (cycles per
second).
duration: The beep length in 1/18th second intervals.
Usage: BEEP generates a sound through your computer's
speaker. It is normally used in batch files to signal
that an operation has been completed, or that the
computer needs attention.
Because BEEP allows you to specify the frequency and
duration of the sound, you can also use it to play
simple music or to create different kinds of signals
for the user.
You can include as many frequency and duration pairs
as you wish. No sound will be generated for
frequencies less than 20 Hz, allowing you to insert
short delays. The default value for frequency is 440
Hz; the default value for duration is 2.
This batch file fragment runs a program called DEMO,
then plays a few notes and waits for you to press a
key:
demo ^ beep 440 4 600 2 1040 6
pause Finished with the demo - hit a key...
The following table gives the frequency values for a
five octave range (middle C is 262 Hz):
C 131 262 523 1046 2093
C#/Db 139 277 554 1108 2217
D 147 294 587 1174 2349
D#/Eb 156 311 622 1244 2489
E 165 330 659 1318 2637
F 175 349 698 1397 2794
F#/Gb 185 370 740 1480 2960
G 196 392 784 1568 3136
G#/Ab 208 415 831 1662 3322
A 220 440 880 1760 3520
A#/Bb 233 466 932 1864 3729
B 248 494 988 1976 3951
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 176
[4DOS, 4DOS/NT] BREAK
-------------------------------------------------------------------
BREAK [4DOS, 4DOS/NT] (Compatible)
Purpose: Display, enable, or disable Ctrl-C and Ctrl-Break
checking.
Format: BREAK [ON | OFF]
Usage: The Ctrl-C and Ctrl-Break keys are used by many
programs (including 4DOS) as a signal to interrupt the
current operation. BREAK controls how often DOS
checks to see if you've entered one of these
keystrokes.
4NT Ctrl-C and Ctrl-Break checking cannot actually be
enabled or disabled under Windows NT. 4DOS/NT
supports BREAK as a "do-nothing" command, for
compatibility with CMD.EXE. This avoids errors in
batch files which use the BREAK command. The
additional discussion below applies only to 4DOS, not
to 4DOS/NT.
Normally, BREAK is turned off, and DOS only checks for
Ctrl-C and Ctrl-Break keystrokes during DOS input or
output operations involving the screen, keyboard,
serial port, and printer. However, many programs
don't use DOS for these operations, and it can be
difficult to interrupt them.
When BREAK is turned on, DOS checks for Ctrl-C and
Ctrl-Break every time a program calls DOS. Since most
programs use DOS to access files and perform other
functions, turning BREAK on makes it much more likely
that a Ctrl-C or Ctrl-Break will be noticed. If you
turn BREAK on, programs will run slightly slower than
normal (the difference is not usually noticeable).
Turning BREAK on or off only affects when DOS detects
Ctrl-C and Ctrl-Break and notifies the program you're
running. Any program can choose to ignore these
signals. Also, any external program can change the
BREAK setting on its own.
Type BREAK plus ON or OFF to set the BREAK status, or
BREAK by itself to display the current BREAK status.
For example:
c:\> break on
c:\> break
BREAK is ON
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 177
[4DOS, 4DOS/NT] BREAK
-------------------------------------------------------------------
BREAK is off by default. You can change the default
by adding a BREAK=ON command to your CONFIG.SYS file.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 178
CALL
-------------------------------------------------------------------
CALL (Compatible)
Purpose: Execute one batch file from within another.
Format: CALL file
file: The batch file to execute.
See also CANCEL and QUIT.
Usage: CALL allows batch files to call other batch files
(batch file nesting). The calling batch file is
suspended while the called (second) batch file runs.
When the second batch file finishes, the original
batch file resumes execution at the next command. If
you execute a batch file from inside another batch
file without using CALL, the first batch file is
terminated before the second one starts.
The following batch file fragment compares an input
line to "wp" and calls another batch file if it
matches:
input Enter your choice: %%option
if "%option" == "wp" call wp.bat
4DOS, 4OS2, and 4DOS/NT support batch file nesting up
to ten levels deep.
The current ECHO state is inherited by a called batch
file.
## A called batch file will return to the calling file
after processing the last line in the called file, or
when a QUIT command is executed. A called batch file
should always return in this way, or terminate all
batch files with CANCEL. Restarting (or CALLing) the
original batch file from within a called file will
prevent the command processor from detecting that
you've left the second file, and it may cause an
infinite loop or a stack overflow.
## CALL returns an exit code which matches the batch file
return code. You can test this exit code with the %_?
or %? environment variable (see page 102), and use it
with conditional commands (&& and ||; see page 71).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 179
CANCEL
-------------------------------------------------------------------
CANCEL (New)
Purpose: Terminate batch file processing.
Format: CANCEL [value]
value: The exit code from 0 to 255 to return to the
command processor.
See also: CALL and QUIT.
Usage: The CANCEL command ends all batch file processing,
regardless of the batch file nesting level. Use QUIT
to end a nested batch file and return to the previous
batch file.
You can CANCEL at any point in a batch file. If
CANCEL is used from within an alias it will end
execution of both the alias and any batch file(s)
which are running at the time.
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
## If you specify a value, CANCEL will set the ERRORLEVEL
or exit code to that value (see the IF command, and
the %? variable on page 102).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 180
CD / CHDIR
-------------------------------------------------------------------
CD / CHDIR (Enhanced)
Purpose: Display or change the current directory.
Format: CD [ path | - ]
or
CHDIR [ path | - ]
path: The directory to change to, including an
optional drive name.
See also: CDD, MD, PUSHD, RD, and Directory Changes
on page 44.
Usage: CD and CHDIR are synonyms. You can use either one.
CD lets you navigate through the DOS subdirectory
structure by changing the current working directory.
If you enter CD and a directory name, the named
directory becomes the new current directory. For
example, to change to the subdirectory
C:\FINANCE\MYFILES:
c:\> cd \finance\myfiles
c:\finance\myfiles>
Every disk drive on the system has its own current
directory. Specifying both a drive and a directory in
the CD command will change the current directory on
the specified drive, but will not change the default
drive. For example, to change the default directory
on drive A:
c:\> cd a:\utility
c:\>
Notice that this command does not change to drive A:.
Use the CDD command to change the current drive and
directory at the same time.
You can change to the parent directory with CD ..; you
can also go up one additional directory level with
each additional [.]. For example, CD .... will go up
three levels in the directory tree (see page 59 for
additional details). You can move to a sibling
directory - one that branches from the same parent
directory as the current subdirectory - with a command
like CD ..\newdir.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 181
CD / CHDIR
-------------------------------------------------------------------
If you enter CD with no argument or with only a disk
drive name, it will display the current directory on
the default or named drive.
CD saves the current directory before changing to a
new directory. You can switch back to the previous
directory by entering CD -. (There must be a space
between the CD command and the hyphen.) You can
switch back and forth between two directories by
repeatedly entering CD -. The saved directory is the
same for both the CD and CDD commands. Drive changes
and automatic directory changes (see page 47) also
modify the saved directory, so you can use CD - to
return to a directory that you exited with an
automatic directory change.
Directory changes made with CD are recorded for
display in the directory history window (see page 45).
## CD never changes the default drive. If you change
directories on one drive, switch to another drive, and
then enter CD -, the directory will be restored on the
first drive but the current drive will not be changed.
## If CD can't change to the specified directory, it will
look for the CDPATH environment variable. See page 44
for details about using CDPATH.
The operating system limits the permissible length of
the full subdirectory name. See page 15 for more
information on directory names.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 182
CDD
-------------------------------------------------------------------
CDD (New)
Purpose: Change the current disk drive and directory.
Format: CDD path
path: The name of the directory (or drive and
directory) to change to.
See also: CD, MD, PUSHD, RD, and Directory Changes on
page 44.
Usage: CDD is similar to the CD command, except that it also
changes the default disk drive if one is specified.
CDD will change to the directory and drive you name.
To change from the root directory on drive A to the
subdirectory C:\WP:
a:\> cdd c:\wp
c:\wp>
You can change to the parent directory with CDD ..;
you can also go up one additional directory level with
each additional [.]. For example, CDD .... will go up
three levels in the directory tree.
CDD saves the current drive and directory before
changing to a new directory. You can switch back to
the previous drive and directory by entering CDD -.
(There must be a space between the CDD command and the
hyphen.) You can switch back and forth between two
drives and directories by repeatedly entering CDD -.
The saved directory is the same for both the CD and
CDD commands. Drive changes and automatic directory
changes (see page 47) also modify the saved directory,
so you can use CDD - to return to a directory that you
exited with a drive change or an automatic directory
change.
Directory changes made with CDD are recorded for
display in the directory history window (see page 45).
## If CDD can't change to the specified directory, it
will look for the CDPATH environment variable. See
page 44 for details about using CDPATH.
The operating system limits the permissible length of
the full subdirectory name. See page 15 for more
information on directory names.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 183
[4DOS, 4OS2] CHCP
-------------------------------------------------------------------
CHCP [4DOS, 4OS2] (Compatible)
Purpose: Display or change the current system code page.
Format: CHCP [n]
n: A system code page number.
## Usage: Code page switching allows you to select different
character sets for language support. To use code page
switching, you must have an EGA or VGA display and be
running under MS-DOS or PC-DOS 3.3 or above, or OS/2.
CHCP is not available in 4DOS/NT.
If you enter CHCP without a number, the current code
page is displayed.
c:\> chcp
Active code page: 437
If you enter CHCP plus a code page number, the system
code page is changed. For example, to set the code
page to multilingual:
c:\> chcp 850
4DOS Before using CHCP under DOS, you must first load the
device drivers (in CONFIG.SYS), make sure the
information file (COUNTRY.SYS) is available, load
national language support (using the NLSFUNC command),
and prepare the specified code page for the devices
(using the MODE command with the CODEPAGE PREPARE
option).
CHCP accepts one of the prepared system code pages.
An error message is displayed if a code page is
selected that has not been prepared for the system.
See your DOS or OS/2 documentation for more
information on CHCP.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 184
CLS
-------------------------------------------------------------------
CLS (Enhanced)
Purpose: Clear the video display and move the cursor to the
upper left corner; optionally change the default
display and border colors.
Format: CLS [[BRIght] [BLInk] fg ON [BRIght] bg] [BORder bc]
fg: The new foreground color
bg: The new background color
bc: The new border color
Usage: CLS can be used to clear the screen without changing
colors, or to clear the screen and change the screen
colors simultaneously. These three examples show how
to clear the screen to the default colors, to bright
white letters on a blue background, and to bright
yellow letters on a magenta background with a blue
border:
c:\> cls
c:\> cls bright white on blue
c:\> cls bri yel on mag bor blu
CLS is often used in batch files to clear the screen
before displaying text.
See page 26 for details about colors and color names,
and notes on the use of bright background colors.
4DOS ## Under DOS, if ANSI.SYS or a compatible driver is not
loaded, the colors will not be "sticky" - you may lose
them after you run an application. If 4DOS thinks you
have an ANSI driver loaded, it uses an ANSI clear
screen command. Otherwise, 4DOS will call the BIOS to
clear the screen. You can force 4DOS to recognize the
proper ANSI state with the SETDOS /A option (see page
323) or the ANSI directive in 4DOS.INI (see page 137).
4DOS ## If your display accommodates more than 25 rows by 80
columns and CLS doesn't clear the whole screen, your
ANSI driver probably does not support the large
display size properly.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 185
COLOR
-------------------------------------------------------------------
COLOR (New)
Purpose: Change the default display colors.
Format: COLOR [BRIght] [BLInk] fg ON [BRIght] bg [BORder bc]
fg: The new foreground color
bg: The new background color
bc: The new border color
See also: CLS, and page 26 for details about using
colors.
Usage: COLOR is normally used in batch files before
displaying text. For example, to set screen colors to
bright white on blue, you can use this command:
c:\> color bright white on blue
4DOS If you have an ANSI driver (such as ANSI.SYS)
installed, COLOR will not change anything on the
screen. It will only set the default colors for
subsequent screen displays. If you are not using an
ANSI driver, COLOR will change the display colors of
every character on the screen. However, the colors
will not be "sticky" - you may lose them after you run
an application.
4DOS ## If you see odd characters like "[44;37m" when you try
to set the screen colors, 4DOS probably thinks you
have an ANSI driver loaded when you don't. Use SETDOS
/A2, or ANSI = No in 4DOS.INI, to tell 4DOS you have
no ANSI driver.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 186
COPY
-------------------------------------------------------------------
COPY (Enhanced)
Purpose: Copy data between disks, directories, files, or
physical hardware devices (such as your printer or
serial port).
Format: COPY [/A:[[-]rhsda] /C /H /M /N /P /Q /R /S /T /U /V]
source[+] ... [/A /B] destination [/A /B]
source: A file or list of files or a device to copy
from.
destination: A file, directory, or device to copy to.
/A(SCII) /P(rompt)
/A:(ttribute select) /Q(uiet)
/B(inary) /R(eplace)
/C(hanged) /S(ubdirectories)
/H(idden) /T(otals)
/M(odified) /U(pdate)
/N(othing) /V(erify)
See also: ATTRIB, MOVE, and REN.
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67). Date,
time, or size ranges anywhere on the line apply to all
source files.
Usage: The COPY command accepts all traditional syntax and
options and adds several new features.
The simplest use of COPY is to make a copy of a file,
like this example which makes a copy of a file called
FILE1.ABC:
c:\> copy file1.abc file2.def
You can also copy a file to another drive and/or
directory. The following command copies FILE1 to the
\MYDIR directory on drive E:
c:\> copy file1 e:\mydir
You can copy several files at once by using wildcards:
c:\> copy *.txt e:\mydir
(See page 59 for an explanation of how 4DOS interprets
the wildcard characters [*] and [?].)
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 187
COPY
-------------------------------------------------------------------
You can also list several source files in one command.
The following command copies 3 files from the current
directory to the \MYDIR directory on drive E:
c:\> copy file1 file2 file3 e:\mydir
The way COPY interprets your command line depends on
how many arguments (file, directory, or device names)
are on the line, and whether the arguments are
separated with [+] signs or spaces.
If there is only one argument on the line, COPY
assumes it is the source, and uses the current drive
and directory as the destination. For example, the
following command copies all the .DAT files on drive A
to the current directory on drive C:
c:\> copy a:*.dat
If there are two or more arguments on the line and [+]
signs are not used, then COPY assumes that the last
argument is the destination and copies all source
files to this new location. If the destination is a
drive, directory, or device name then the source files
are copied individually to the new location. If the
destination is a file name, the first source file is
copied to the destination, and any additional source
files are then appended to the new destination file.
For example, the first of these commands copies the
.DAT files from the current directory on drive A
individually to C:\MYDIR (which must already exist as
a directory); the second appends all the .DAT files
together into one large file called C:\DATA (assuming
C:\DATA is not a directory):
c:>\ copy a:*.dat c:\mydir\
c:>\ copy a:*.dat c:\data
When you copy to a directory, if you add a backslash
[\] to the end of the name as shown in the first
example above, COPY will display an error message if
the name does not refer to an existing directory. You
can use this feature to keep COPY from treating a
mistyped destination directory name as a file name and
attempting to append all your source files to a
destination file, when you really meant to copy them
individually to a destination directory.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 188
COPY
-------------------------------------------------------------------
## A plus [+] tells COPY to append two or more files to a
single destination file. If you list several source
files separated with [+] and don't specify a
destination, COPY will use the name of the first
source file as the destination, and append each
subsequent file to the first file. In this case the
destination file will always be created in the current
directory, even if the first source file is in another
directory or on another drive.
For example, the following command will append the
contents of C:\MEMO2 and C:\MEMO3 to C:\MEMO1 and
leave the combined contents in the file named
C:\MEMO1:
c:\> copy memo1+memo2+memo3
To append the same three files but store the result in
BIGMEMO:
c:\> copy memo1+memo2+memo3 bigmemo
To append C:\MEM\MEMO2 and C:\MEM\MEMO3 to
D:\DATA\MEMO1, and leave the result in C:\MEM\MEMO1:
c:\mem> copy d:\data\memo1+memo2+memo3
## You cannot append files to a device (such as a
printer); if you try to do so, COPY will ignore the
[+] signs and copy the files individually. If you
attempt to append several source files to a
destination directory or disk, COPY will append the
files and place the copy in the new location with the
same name as the first source file.
## If your destination has wildcards in it, COPY will
attempt to match them with the source names. For
example, this command copies the .DAT files from drive
A to C:\MYDIR and gives the new copies the extension
.DX:
c:\> copy a:*.dat c:\mydir\*.dx
This feature can give you unexpected results if you
use it with multiple source file names. For example,
suppose that drive A contains XYZ.DAT and XYZ.TXT.
The command
c:\> copy a:\*.dat a:\*.txt c:\mydir\*.dx
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 189
COPY
-------------------------------------------------------------------
will copy A:XYZ.DAT to C:\MYDIR\XYZ.DX. Then it will
copy A:XYZ.TXT to C:\MYDIR\XYZ.DX, overwriting the
first file it copied.
## COPY also understands include lists (see page 67), so
you can specify several different kinds of files in
the same command. This command copies the .TXT, .DOC,
and .BAT files from the E:\MYDIR directory to the root
directory of drive A:
c:\> copy e:\mydir\*.txt;*.doc;*.bat a:\
## You can use date, time, and size ranges to further
define the files that you want to copy (see page 62
for information on ranges). This example copies every
file in the E:\MYDIR directory, which was created or
modified yesterday, and which is also 10,000 bytes or
smaller in size, to the root directory of drive A:
c:\> copy /[d-1] /[s0,10000] e:\mydir\*.* a:\
## COPY maintains the hidden and system attributes of
files, but not the read-only attribute. The
destination file will always have the archive
attribute set.
4DOS ## If you are using 4DOS in an OS/2 DOS session, COPY
will copy OS/2 extended attributes from the source to
the destination, if the file system on the destination
drive supports them.
4NT ## If you COPY files with long filenames from an NTFS
volume to a FAT volume, 4DOS/NT will store the
destination files with their short, FAT-compatible
names when running under Windows NT 3.1 (long names
are used under Windows NT 3.5 and above; see page 18
for additional details). You can view the short names
before executing the COPY with the DIR /X command.
Options: The /A(SCII) and /B(inary) options apply to the
preceding filename and to all subsequent filenames on
the command line until the file name preceding the
next /A or /B, if any. The other options (/A:, /C,
/H, /M, /N, /P, /Q, /R, /S, /T, /U, /V) apply to all
filenames on the command line, no matter where you put
them. For example, either of the following commands
could be used to copy a font file to the printer in
binary mode:
c:\> copy /b myfont.dat prn
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 190
COPY
-------------------------------------------------------------------
c:\> copy myfont.dat /b prn
Some options do not make sense in certain contexts, in
which case COPY will ignore them. For example, you
cannot prompt before replacing an existing file when
the destination is a device such as the printer -
there's no such thing as an "existing file" on the
printer. If you use conflicting output options, like
/Q and /P, COPY will take a "conservative" approach
and give priority to the option which generates more
prompts or more information.
Options used in less common situations have been
marked with ## below. Remember that the options are
in alphabetical order, so more basic options are
interspersed with those marked with ##.
## /A(SCII): If you use /A with a source filename, the
file will be copied up to, but not including, the
first Ctrl-Z (Control-Z or ASCII 26) character in the
file. If you use /A with a destination filename, a
Ctrl-Z will be added to the end of the file (some
application programs use the Ctrl-Z to mark the end of
a file). /A is the default when appending files, or
when the destination is a device like NUL or PRN,
rather than a disk file.
## /A:(ttribute selecte): Select only those files that
have the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will select
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., COPY /A:
...), COPY will select all files and subdirectories
including hidden and system files. If attributes are
combined, all the specified attributes must match for
a file to be selected. For example, /A:RHS will
select only those files with all three attributes set.
See page 18 for more information on file attributes.
You must include the colon with this option to
distinguish it from the /A(SCII) switch, above.
## /B(inary): If you use /B with a source filename, the
entire file is copied; Ctrl-Z characters in the file
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 191
COPY
-------------------------------------------------------------------
do not affect the copy operation. Using /B with a
destination filename prevents addition of a Ctrl-Z to
the end of the destination file. /B is the default
for normal file copies.
/C(hanged files): Copy files only if the destination
file exists and is older than the source (see also
/U). This option is useful for updating the files in
one directory from those in another without copying
any newly created files.
## /H(idden): Copy all matching files including those
with the hidden and/or system attribute set (see page
). 18
/M(odified): Copy only those files with the archive
attribute set (see page 18), i.e., those which have
been modified since the last backup. The archive
attribute will not be cleared after copying; to clear
it use ATTRIB (page 173).
/N(othing): Do everything except actually perform the
copy. This option is useful for testing what the
result of a complex COPY command will be.
/P(rompt): Ask the user to confirm each source file.
Your options at the prompt are explained in detail on
page 50.
/Q(uiet): Don't display filenames or the total number
of files copied. This option is most often used in
batch files. See also /T.
/R(eplace): Prompt the user before overwriting an
existing file. Your options at the prompt are
explained in detail on page 50.
/S(ubdirectories): Copy the subdirectory tree
starting with the files in the source directory plus
each subdirectory below that. The destination must be
a directory; if it doesn't exist, COPY will attempt to
create it. COPY will also attempt to create needed
subdirectories on the tree below the destination,
including empty source directories. If you attempt
to use COPY /S to copy a subdirectory tree into part
of itself, COPY will display an error message and
exit.
/T(otals): Turns off the display of filenames, like
/Q, but does display the total number of files copied.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 192
COPY
-------------------------------------------------------------------
/U(pdate): Copy each source file only if it is newer
than a matching destination file or if a matching
destination file does not exist (see also /C). This
option is useful for keeping one directory matched
with another with a minimum of copying.
## /V(erify): Verify each disk write. This is the same
as executing the VERIFY ON command, but is only active
during the COPY. /V does not read back the file and
compare its contents with what was written; it only
verifies that the data written to disk is physically
readable.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 193
[4DOS] CTTY
-------------------------------------------------------------------
CTTY [4DOS] (Compatible)
Purpose: Change the default console device.
Format: CTTY device
device: The new console device.
## Usage: Normally, 4DOS uses the keyboard as the standard input
device and the display as the standard output device.
Together, the keyboard and display are known as the
console or CON. The CTTY command allows you to
substitute another device that can perform standard
character I/O for the console.
For example to change the console to the first serial
port:
c:\> ctty com1
Change the console back to the standard keyboard and
display (this command must be entered from the current
console, e.g., a terminal attached to COM1, or from a
batch file):
c:\> ctty con
CTTY works only for programs and commands that use
standard DOS input and output functions. This
includes all 4DOS internal commands except DRAWBOX,
DRAWHLINE, DRAWVLINE, LIST, SCREEN, SCRPUT, SELECT,
and VSCRPUT. In addition, if you use color-coded
directories you should disable them with DIR /D when
using CTTY. Otherwise directories will not be
displayed correctly.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 194
DATE
-------------------------------------------------------------------
DATE (Compatible)
Purpose: Display and optionally change the system date.
Format: DATE [mm-dd-yy]
mm: The month (1 - 12).
dd: The day (1 - 31).
yy: The year (80 - 99 = 1980 - 1999, or a 4-digit
year).
See also: TIME.
Usage: If you simply type DATE without any parameters, you
will see the current system date and time, and be
prompted for a new date. Press ENTER if you don't
wish to change the date. If you type a new date, it
will become the current system date, which is included
in the directory entry for each file as it is created
or altered:
c:\> date
Wed Dec 22, 1993 9:30:06
Enter new date (mm-dd-yy):
You can also enter a new system date by typing the
DATE command plus the new date on the command line:
c:\> date 3-16-94
You can use hyphens, slashes, or periods to separate
the month, day, and year entries. A full 4-digit year
can be entered if you wish.
DATE adjusts the format it expects depending on your
country settings. When entering the date, use the
correct format for the country setting currently in
effect on your system.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 195
DEL / ERASE
-------------------------------------------------------------------
DEL / ERASE (Enhanced)
Purpose: Erase one file, a group of files, or entire
subdirectories.
Format: DEL [/A[[:][-]rhsda] /F /N /P /Q /S /T /X /Y /Z]
file...
or
ERASE [/A[[:][-]rhsda] /F /N /P /Q /S /T /X /Y /Z]
file...
file: The file, subdirectory, or list of files or
subdirectories to erase.
/A(ttribute select) /S(ubdirectories)
/F(orce delete) /T(otal)
/N(othing) /X (remove empty
subdirectories)
/P(rompt) /Y(es to all prompts)
/Q(uiet) /Z(ap hidden and read-only
files)
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: DEL and ERASE are synonyms, you can use either one.
Use the DEL and ERASE commands with caution; the files
and subdirectories that you erase may be impossible to
recover without specialized utilities and a lot of
work.
To erase a single file, simply enter the file name:
c:\> del letters.txt
You can also erase multiple files in a single command.
For example, to erase all the files in the current
directory with a .BAK or .PRN extension:
c:\> del *.bak *.prn
If you enter a subdirectory name, or a filename
composed only of wildcards (* and/or ?), DEL asks for
confirmation (Y or N) unless you specified the /Y
option. If you respond with a Y, DEL will delete all
the files in that subdirectory (hidden, system, and
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 196
DEL / ERASE
-------------------------------------------------------------------
read-only files are only deleted if you use the /Z
option).
DEL displays the amount of disk space recovered,
unless the /Q option is used (see below). It does so
by comparing the amount of free disk space before and
after the DEL command is executed. This amount may be
incorrect if you are using a deletion tracking system
which stores deleted files in a hidden directory, or
if, under a multitasking system, another program
performs a file operation while the DEL command is
executing.
Remember that DEL removes file descriptions along with
files. Most deletion tracking systems will not be
able to save or recover a file's description, even if
they can save or recover the data in a file.
## DEL returns a non-zero exit code if no files are
deleted, or if another error occurs. You can test
this exit code with the %_? environment variable (see
page 102), and use it with conditional commands (&&
and ||; see page 71).
Options: ## /A(ttribute select): Delete only those files that have
the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will delete
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., DEL /A ...),
DEL will delete all files and subdirectories including
hidden and system files. If attributes are combined,
all the specified attributes must match for a file to
be selected for deletion. For example, /A:RHS will
select only those files with all three attributes set.
See page 18 for more information on file attributes.
## /F(orce delete): This option is only for use in the
32-bit version of 4OS2, and in 4DOS when running in an
OS/2 2.1 or later DOS session. It forces deletion of
the file without saving it to the DELDIR directory (if
DELDIR is not in use, /F has no effect).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 197
DEL / ERASE
-------------------------------------------------------------------
/N(othing): Do everything except actually delete the
file(s). This is useful for testing what the result
of a DEL would be.
/P(rompt): Prompt the user to confirm each erasure.
Your options at the prompt are explained in detail on
page 50.
/Q(uiet): Don't display filenames as they are
deleted, or the number of files deleted or bytes
freed. When running 4DOS under DOS, DEL will run
fastest if you specify the /Q option and the filename
doesn't use the extended 4DOS wildcards. When running
4OS2, 4DOS/NT, or 4DOS under OS/2, /Q will have little
or no effect on DEL's speed. See also /T.
! /S(ubdirectories): Delete the specified files in this
directory and all of its subdirectories. This is like
a GLOBAL DEL, and can be used to delete all the files
in a subdirectory tree or even a whole disk. It
should be used with caution!
/T(otal): Don't display filenames as they are
deleted, but display the total number of files deleted
plus the amount of free disk space recovered. Unlike
/Q, the /T option will not speed up deletions under
DOS.
## /X (remove empty subdirectories): Remove empty
subdirectories after deleting (only useful when used
with /S).
! ## /Y(es): The reverse of /P - it assumes a Y response
to everything, including deleting an entire
subdirectory tree. 4DOS, 4OS2, and 4DOS/NT normally
prompt before deleting files when the name consists
only of wildcards or a subdirectory name (see above);
/Y overrides this protection, and should be used with
extreme caution!
! ## /Z(ap): Delete read-only, hidden, and system files as
well as normal files. Files with the read-only,
hidden, or system attribute set are normally protected
from deletion; /Z overrides this protection, and
should be used with caution. Because EXCEPT works by
hiding files, /Z will override an EXCEPT command.
For example, to delete the entire subdirectory tree
starting with C:\UTIL, including hidden and read-only
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 198
DEL / ERASE
-------------------------------------------------------------------
files, without prompting (use this command with
CAUTION!):
c:\> del /sxyz c:\util\
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 199
DELAY
-------------------------------------------------------------------
DELAY (New)
Purpose: Pause for a specified length of time.
Format: DELAY [seconds]
seconds: The number of seconds to delay.
Usage: DELAY is useful in batch file loops while waiting for
something to occur. To wait for 10 seconds:
delay 10
A simple loop could make a tone with the BEEP command
to get the operator's attention and then DELAY for a
few seconds while waiting for the user to respond.
## For delays shorter than one second, use the BEEP
command with an inaudible frequency (below 20 Hz).
You can cancel a delay by pressing Ctrl-C or Ctrl-
. Break
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 200
DESCRIBE
-------------------------------------------------------------------
DESCRIBE (New)
Purpose: Create, modify, or delete file and subdirectory
descriptions.
Format: DESCRIBE [/A[[:][-]rhsda]] file ["description"] ...
file: The file or files to operate on.
"description": The description to attach to the file.
/A(ttribute select)
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: DESCRIBE adds descriptions to files and
subdirectories. The descriptions are displayed by DIR
in single-column mode and by SELECT. Descriptions let
you identify your files in much more meaningful ways
than you can in an eight-character filename.
You enter a description on the command line by typing
the DESCRIBE command, the filename, and the
description in quotation marks, like this:
c:\> describe memo.txt "Memo to Bob about party"
If you don't put a description on the command line,
DESCRIBE will prompt you for it:
c:\> describe memo.txt
Describe "memo.txt" : Memo to Bob about party
If you use wildcards or multiple filenames with the
DESCRIBE command and don't include the description
text, you will be prompted to enter a description for
each file. If you do include the description on the
command line, all matching files will be given the
same description.
Each description can be up to 40 characters long. You
can change this limit with the DescriptionMax
directive in 4DOS.INI (see page 138). DESCRIBE can
edit descriptions longer than DescriptionMax (up to a
limit of 200 characters), but will not allow you to
lengthen the existing text.
The descriptions are stored in each directory in a
hidden file called DESCRIPT.ION. Use the ATTRIB
command to remove the hidden attribute from this file
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 201
DESCRIBE
-------------------------------------------------------------------
if you need to copy or delete it. DESCRIPT.ION is
always created as a hidden file, but will not be re-
hidden by 4DOS, 4OS2, or 4DOS/NT if you remove the
hidden attribute. You can change the description file
name with the DescriptionName directive in the .INI
file (page 148), and retrieve it with the %_DNAME
internal variable (page 105).
The description file is modified appropriately
whenever you perform an internal command which affects
it (such as COPY, MOVE, DEL, or RENAME), but not if
you use an external program (such as XCOPY or a visual
shell).
4OS2, ! On HPFS and NTFS drives, you will not see file
4NT descriptions in a normal DIR display, because DIR must
leave space for the long filenames used on these
drives. To view the descriptions, use DIR /Z to
display the directory in FAT format. See the DIR
command for more details.
Options: ## /A(ttribute select): Select only those files that have
the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will select
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., DESCRIBE /A
...), DESCRIBE will select all files and
subdirectories including hidden and system files. If
attributes are combined, all the specified attributes
must match for a file to be selected. For example,
/A:RHS will select only those files with all three
attributes set. See page 18 for more information on
file attributes.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 202
[4OS2, 4DOS/NT] DETACH
-------------------------------------------------------------------
DETACH [4OS2, 4DOS/NT] (Compatible)
Purpose: Start an OS/2 or Windows NT program in detached mode.
Format: DETACH command
command: The name of a command to execute, including
an optional drive and path specification. The name
must be enclosed in quotation marks if it contains any
spaces.
See also: START.
Usage: When you start a program with DETACH, that program
cannot use the keyboard, mouse, or video display. It
is "detached" from the normal means of user input and
output. However, you can redirect the program's
standard I/O to other devices if necessary, using
redirection symbols (see page 52).
The command can be an internal command, external
command, alias, or batch file. 4OS2 or 4DOS/NT will
detach a copy of itself to execute the command.
For example, the following command will detach a copy
of the command processor to run the batch file
XYZ.BTM:
[c:\] detach xyz.btm
Once the program has started, 4OS2 or 4DOS/NT returns
to the prompt immediately. It does not wait for a
detached program to finish.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 203
DIR
-------------------------------------------------------------------
DIR (Enhanced)
Purpose: Display information about files and subdirectories.
Format: DIR [/1 /2 /4 /A[[:][-]rhsda] /B /C[HP] /D /E /F /H
/I"text" /J /K /L /M /N /O[[:][-]acdeginrsu] /P
/R /S /T[:acw] /U /V /W /X /Z] [file...]
file: The file, directory, or list of files or
directories to display.
/1 (one column) /L(ower case)
/2 (two columns) /M (suppress footer)
/4 (four columns) /N(ormal) or (New format)
/A(ttribute select) /O(rder)
/B(are) /P(ause)
/C[HP] (Compression) /R (disable wRap)
/D(isable color coding) /S(ubdirectories)
/E (upper case) /T (aTtribute) or (Time)
/F(ull path) /U (sUmmary information)
/H(ide dots) /V(ertical sort)
/I (match descriptions) /W(ide)
/J(ustify names) /X (display short names)
/K (suppress header) /Z (use FAT format)
See also: ATTRIB, DESCRIBE, SELECT, and SETDOS.
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: DIR can be used to display information about files
from one or more of your disk directories, in a wide
range of formats. Depending on the options chosen,
you can display the file name, attributes, and size;
the time and date of the last change to the file; the
file description; and the file's compression ratio.
You can also display information in 1, 2, 4, or 5
columns, sort the files several different ways, use
color to distinguish file types, and pause after each
full screen.
The various DIR displays are controlled through
options or switches. The best way to learn how to use
the many options available with the DIR command is to
experiment. You will soon know which options you want
to use regularly. You can select those options
permanently by using the ALIAS command.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 204
DIR
-------------------------------------------------------------------
You may want to mix several options. For example, to
display all the files in the current directory, in 2
columns, sorted vertically (down one column then down
the next), and with a pause at the end of each page:
c:\> dir /2/p/v
To set up this format as the default, using an alias:
c:\> alias dir=*dir /2/p/v
This example displays all the files on all directories
of drive C, including hidden and system files, pausing
after each page:
c:\> dir /s/a/p c:\
DIR allows wildcard characters (* and ?) in the
filename. If you don't specify a filename, DIR
defaults to *.* (display all non-hidden files and
subdirectories in the current directory). To display
all of the .WKS files in the current directory:
c:\> dir *.wks
With the /I option, DIR can select files to display
based on their descriptions. DIR will display a file
if its description matches the text after the /I
switch. The search is not case sensitive. You can
use wildcards and extended wildcards as part of the
text. For example, to display any file described as a
"Test File" you can use this command:
c:\> dir /i"test file"
If you want to display files that include the words
"test file" anywhere in their descriptions, use
extended wild cards like this:
c:\> dir /i"*test file*"
If you link two or more filenames together with
spaces, DIR will display all of the files that match
the first name and then all of the files that match
the second name. You may use a different drive and
path for each filename. This example lists all of the
.WKS and then all of the .WK1 files in the current
directory:
c:\> dir *.wks *.wk1
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 205
DIR
-------------------------------------------------------------------
If you use an include list (see page 67) to link
multiple filenames, DIR will display the matching
filenames in a single listing. Only the first
filename in an include list can have a path; the other
files must be in the same path. This example displays
the same files as the previous example, but the .WKS
and .WK1 files are intermixed:
c:\> dir *.wks;*.wk1
The default case for filename displays varies
depending on which command processor you are using, as
follows ("as stored" means filenames will be displayed
exactly as they are stored on the disk, whether in
upper, lower, or mixed case):
4DOS Lower case on all drives.
4OS2 Lower case on FAT drives, "as stored"
on HPFS drives.
4DOS/NT Windows NT 3.1: Lower case on FAT
drives, "as stored" on HPFS and NTFS
drives. Windows NT 3.5 and above:
"As stored" on all drives (see page
18 for more information)
You can override these defaults and force filenames to
display in upper case with /E, or in lower case with
/L.
You can display the file and subdirectory names in
color by setting the COLORDIR environment variable or
using the ColorDir directive in your .INI file. See
page 30 for details.
## If you are using color-coded directories and attempt
to redirect the output of DIR to a character device,
such as a serial port or the printer, non-color-coded
file names will be displayed on the device but color-
coded names may still be displayed on the screen.
This will not occur if the output of DIR is redirected
to a disk file. To prevent this problem, use the /D
switch to disable color coding when redirecting the
output of DIR to a character device.
When displaying file descriptions, DIR will wrap long
lines to fit on the screen. DIR displays a maximum of
40 characters of text in each line of a description,
unless your screen width allows a wider display. If
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 206
DIR
-------------------------------------------------------------------
you disable description wrapping with the /R switch,
the description is truncated at the right edge of the
screen, and a right arrow is added at the end of the
line to alert you to the existence of additional
description text.
If you attempt to redirect the output of DIR to a
character device, such as a serial port or the
printer, long descriptions will be wrapped at the
screen width in the redirected output. If this is not
what you want, use /R to disable wrapping.
4NT ## DIR's default output format is different under Windows
NT 3.5 and above, where long filenames can be used on
on FAT drives (see page 18 for additional
information). In this case DIR defaults to HPFS /
NTFS-style output, normally selected with /N; you can
switch back to standard FAT-style output with /Z. DIR
also retains the case in which filenames are stored in
Windows NT 3.5 and above, unless you use /E or /L (see
page 18 for an explanation).
You can override the new default output format with an
alias if you wish. For example, to use FAT-style
output on all drives, define an alias like this:
alias dir=*dir /z
To use FAT-style output on FAT drives only you may
want to try the following alias or a variation on it.
The alias extracts the drive letter from the first
argument to DIR (or uses the current drive if there is
no argument), then changes the display format based on
whether that argument specifies a FAT or non-FAT
drive:
alias dir=`set _drv=%_disk: & if %# != 0 set
_drv=%@fstype[%@substr[%@full[%1],0,2]] & iff
"%_drv" == "FAT" then & *dir /z %$ & else & *dir
%$ & endiff & unset /q _drv`
4DOS ## If you are using a disk compression program, you can
use the /C switch to view the amount of compression
achieved for each file. When you do, the compression
ratio is displayed instead of the file's description.
You can also sort the display by compression ratios
with the /O:c switch. Details for both switches are
in the Options section, below. See APPNOTES.DOC for a
list of compression systems supported by the 4DOS DIR
command.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 207
DIR
-------------------------------------------------------------------
## When sorting file names and extensions, 4DOS, 4OS2,
and 4DOS/NT normally assume that sequences of digits
should be sorted numerically (for example, the file
DRAW2 would come before DRAW03 because 2 is
numerically smaller than 03), rather than strictly
alphabetically (where DRAW2 would come second because
"2" is after "0" in alphanumeric order). You can
defeat this behavior and force a strict alphabetic
sort with the /O:a option.
## If you have selected a specific country code for your
system, DIR will display the date in the format for
that country. The default date format is U.S. (mm-dd-
yy). The separator character in the file time will
also be affected by the country code.
4DOS ## DIR can handle directories of any size, limited only
by available memory. Under 4DOS, each filename
requires 32 bytes of free base memory plus the size of
the description (if any). For example, a system with
just 128K of free memory can display up to 4,000 files
per directory. Memory requirements for DIR are
generally not a concern under 4OS2 and 4DOS/NT,
because of the virtual memory available under these
operating systems.
## Options on the command line apply only to the
filenames which follow the option, and options at the
end of the line apply to the preceding filename only.
This allows you to specify different options for
different groups of files, yet retains compatibility
with the traditional DIR command when a single
filename is specified.
Options: /1: Single column display - display the filename,
size, date, time, and description. This is the
default. If /T is used the attributes are displayed
instead of the description; if /C or /O:c is used the
compression ratio is displayed instead of the
description.
/2: Two column display - display the filename, size,
date, and time. If you use /2 (or /4) on an HPFS or
NTFS drive under 4OS2 or 4DOS/NT, DIR will only
display the file names. Also, the number of columns
may be reduced to one for names too long to fit on
half the screen. Due to these restrictions, /2 is
normally most useful on HPFS and NTFS drives when used
with /Z to force the display to FAT format.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 208
DIR
-------------------------------------------------------------------
/4: Four column display - display the filename and
size, in K (kilobytes) or M (megabytes). The note
under /2 above regarding HPFS and NTFS drives applies
to /4 as well.
## /A(ttribute select): Display only those files that
have the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will display
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., DIR /A ...),
DIR will display all files and subdirectories
including hidden and system files. If attributes are
combined, all the specified attributes must match for
a file to be included in the listing. For example,
/A:RHS will display only those files with all three
attributes set. See page 18 for more information on
file attributes.
## /B(are): Suppress the header and summary lines, and
display file or subdirectory names only, in a single
column. This option is most useful when you want to
redirect a list of names to a file or another program.
If you use /B with /S, DIR will show the full path of
each file instead of simply its name and extension.
4DOS /C(ompression): Display per-file and total
compression ratio on compressed drives. The
compression ratio is displayed instead of the file
description or attributes. The ratio is left blank
for directories and files with a length of 0 bytes,
and for files on non-compressed drives. /C only works
in single-column mode; it is ignored if /2, /4, or /W
is used. See APPNOTES.DOC for a list of supported
compression systems.
The numerator of the displayed compression ratio is
the amount of space which would be allocated to the
file if the compression utility were not in use, based
on the compressed drive's cluster size (usually 8K
bytes). The denominator is the space actually
allocated for the compressed file. For example, if a
file is allocated 6,144 bytes when compressed, and
would require 8,192 bytes if uncompressed, the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 209
DIR
-------------------------------------------------------------------
displayed compression ratio would be 8,192 / 6,144, or
1.3 to 1.
Using /CH displays compression ratios like /C, but
bases the calculation on the host drive's cluster
size. This gives a more accurate picture of the space
saved through compression than is given by /C. This
option will occasionally display compression ratios
slightly less than 1.0 to 1.0 for files which have
actually expanded when stored on the compressed drive.
If /CP is used instead of /C, the compression is
displayed as a percentage (e.g., 33%) instead of a
ratio (e.g., 3 to 1). If /CHP is used instead of /CH,
the host compression is displayed as a percentage.
The /CHP option must be entered as shown; you can not
use /CPH.
## /D(isable color coding): Temporarily disable
directory color coding. May be required when color-
coded directories are used and DIR output is
redirected to a character device like the printer
(e.g., PRN or LPT1) or serial port (e.g., COM1 or
COM2). /D is not required when DIR output is
redirected to a file.
/E: Display filenames in the traditional upper case;
also see SETDOS /U (page 326) and the UpperCase
directive in 4DOS.INI (page 141).
## /F(ull path): Display each filename with its drive
letter and path in a single column, without other
information.
/H(ide dots): Suppress the display of the "." and
".." directories.
/I: Display filenames by matching text in their
descriptions. The text can include wild cards and
extended wildcards. The search text must be enclosed
in quotation marks. /I may be used to select files
even if descriptions are not displayed (for example,
if /2 is used). However, /I will be ignored if /C or
/O:c is used.
/J(ustify names): Justify (align) filename extensions
and display them in the traditional format.
## /K: Suppress the header (disk and directory name)
display.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 210
DIR
-------------------------------------------------------------------
/L(ower case): Display file and directory names in
lower case; also see SETDOS /U (page 326) and the
UpperCase directive in 4DOS.INI (page 141).
## /M: Suppress the footer (file and byte count totals)
display.
4DOS /N: Reset the DIR options to the default values.
This is useful when you want to display some files in
one format, and then change back to the defaults for
another set of files.
4OS2, /N: Use the HPFS or NTFS display format, even if the
files are
4NT stored on a FAT file system volume. (This is the
default for all drives under Windows NT 3.5 and
above). See also /Z.
/O(rder): Set the sorting order. You may use any
combination of the following sorting options; if
multiple options are used, the listing will be sorted
with the first sort option as the primary key, the
next as the secondary key, and so on:
- Reverse the sort order for the next option
a Sort names and extensions in standard ASCII
order, rather than sorting numerically when
digits are included in the name or
extension.
c Sort by compression ratio (the least
compressed file in the list will be
displayed first). For single-column
directory displays, the compression ratios
will be used as the basis of the sort and
will also be displayed. For wider displays
(/2, /4, and /W), the compression ratios
will be used to determine the order but will
not be displayed. If /O:c is used with /CH
or /CHP, the sort will be based on the host-
drive compression ratios.
d Sort by date and time (oldest first); for
HPFS and NTFS drives also see /T.
e Sort by extension.
g Group subdirectories first, then files.
i Sort by the file description (ignored if /C
or /O:c is also used).
n Sort by filename (this is the default).
r Reverse the sort order for all options.
s Sort by size.
u Unsorted.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 211
DIR
-------------------------------------------------------------------
/P(ause): Wait for a key to be pressed after each
screen page before continuing the display. Your
options at the prompt are explained in detail on page
. 50
/R (disable wRap): Forces long descriptions to be
displayed on a single line, rather than wrapped onto
two or more lines. Use /R when output is redirected
to a character device, such as a serial port or the
printer; or when you want descriptions truncated,
rather than wrapped, in the on-screen display.
/S(ubdirectories): Display file information from the
current directory and all of its subdirectories. DIR
will only display headers and summaries for those
directories which contain files that match the
filename(s) and attributes (if /A is used) that you
specify on the command line.
## /T (aTtribute display): Display the filenames and
attributes. /T is ignored if /C or /O:c is also used.
The attributes are displayed in the format RHSA,
where:
R Read-only S System
H Hidden A Archive
4OS2, If you wish to add another option after /T, you must
start the next
4NT option with a forward slash. If you don't, the
command processor will interpret the /T as the /T:acw
time display switch (see below) and the following
character as a valid or invalid time selector. For
example:
[c:\] dir /tz incorrect, will display error
[c:\] dir /t/z correct
4OS2, /T:acw (Time display): Specify which of the date and
time fields on
4NT an NTFS or HPFS drive should be displayed and used for
sorting:
a last access time
c creation time
w last write time (default)
/U (sUmmary information): Only display the number of
files, the total file size, and the total amount of
disk space used.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 212
DIR
-------------------------------------------------------------------
/V(ertical sort): Display the filenames sorted
vertically rather than horizontally (use with the /2,
/4 or /W options).
/W(ide): Display filenames only, horizontally across
the screen (5 columns on an 80-character wide
display).
4NT /X: Display both the short (8-character name plus 3-
character extension) and the long name of files on an
NTFS drive.
4OS2, /Z: Display an HPFS or NTFS directory, or any
4NT directory under Windows NT 3.5 and above, in FAT
format. Long names will be truncated to 12
characters. If the name is longer than 12 characters,
it will be followed by a right arrow to show that one
or more characters have been truncated.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 213
DIRS
-------------------------------------------------------------------
DIRS (New)
Purpose: Display the current directory stack.
Format: DIRS
See also: PUSHD and POPD.
Usage: The PUSHD command adds the current default drive and
directory to the directory stack, a list that 4DOS,
4OS2, and 4DOS/NT maintain in memory. The POPD
command removes the top entry of the directory stack
and makes that drive and directory the new default.
The DIRS command displays the contents of the
directory stack, with the most recent entries on top
(i.e., the next POPD will retrieve the first entry
that DIRS displays).
For example, to 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:\
The directory stack holds 255 characters, enough for
10 to 20 typical drive and directory entries.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 214
DO
-------------------------------------------------------------------
DO (New)
Purpose: Create loops in batch files.
Format: DO [n | FOREVER]
or
DO varname = start TO end [BY n]
or
DO [WHILE | UNTIL] condition
...
[ITERATE]
[LEAVE]
...
ENDDO
n, start, end: An integer between 0 and 2,147,483,647
inclusive, or an internal variable or variable
function that evaluates to such a value.
varname: The environment variable that will hold the
loop counter.
condition: A test to determine if the loop should be
executed.
Usage: DO can only be used in batch files.
DO can be used to create 3 different kinds of loops.
The first, introduced by DO n, is a counted loop. The
batch file lines between DO and ENDDO are repeated n
times. You can also specify "forever" for n if you
wish to create an endless loop. For example:
do 5
beep
enddo
The second type of loop is similar to a "for loop" in
programming languages like BASIC. DO creates an
environment variable, varname, and sets it equal to
the value start (if varname already exists in the
environment, it will be overwritten). DO then begins
the loop process by comparing the value of varname
with the value of end. If varname is less than or
equal to end, DO executes the batch file lines up to
the ENDDO. Next, DO adds 1 to the value of varname,
or adds the value n if BY n is specified, and repeats
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 215
DO
-------------------------------------------------------------------
the compare and execute process until varname is
greater than end. This example displays the even
numbers from 2 through 20:
do i = 2 to 20 by 2
echo %i
enddo
DO can also count down, rather than up. If n is
negative, varname will decrease by n with each loop,
and the loop will stop when varname is less than end.
For example, to display the even numbers from 2
through 20 in reverse order, replace the first line of
the example above with:
do i = 20 to 2 by -2
The third type of loop is called a "while loop" or
"until loop." DO evaluates the condition, which can
be any of the tests supported by the IF command (see
page 251), and executes the lines between DO and ENDDO
as long as the condition is true. The loop ends when
the condition becomes false.
WHILE tests the condition at the start of the loop;
UNTIL tests it at the end. If you use WHILE, the loop
may never be executed (if the condition is false at
the start of the loop); if you use UNTIL, the loop
will always be executed at least once.
Two special commands, ITERATE and LEAVE, can only be
used inside a DO / ENDDO loop. ITERATE ignores the
remaining lines inside the loop and returns to the
beginning of loop for another iteration (unless DO
determines that the loop is finished). LEAVE exits
from the current DO loop and continues with the line
following ENDDO. Both ITERATE and LEAVE are most
often used in an IF or IFF command (see pages 251 and
257):
do while "%var" != "%val1"
...
if "%var" == "%val2" leave
enddo
You can nest DO loops up to 15 levels deep.
! ## You can exit from all DO / ENDDO loops by using GOTO
to a line past the last ENDDO. However, be sure to
read the cautionary notes about GOTO and DO under the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 216
DO
-------------------------------------------------------------------
GOTO command (page 246) before using a GOTO inside any
DO loop.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 217
[4OS2] DPATH
-------------------------------------------------------------------
DPATH [4OS2] (Compatible)
Purpose: Specify the subdirectories which applications will
search to find files that are not in the current
directory.
Format: DPATH [directory[;directory...]]
directory: The full name of a directory to include in
the DPATH (data path) setting.
See also: PATH, SET, and ESET.
Usage: When most OS/2 and Windows NT applications try to open
a data file, they look for the file in the current
directory first. If they fail to find the file there,
they search each of the directories in the DPATH
setting in the order that they are included. Internal
commands like TYPE do not search the DPATH directories
for files.
For example, the following DPATH command directs
applications to look for files in this order: the
current directory, the INIT directory on C, and the
CONFIG directory on D:
[c:\] dpath c:\init;d:\config
The listing of directories to be searched can be set
or viewed with DPATH. The list is stored as an
environment string with the variable name DPATH, and
can also be set or viewed with the SET command and
edited with the ESET command.
Directory names in the DPATH must be separated with
semicolons [;]. 4OS2 and 4DOS/NT will not shift
directory names in the DPATH to upper case as they do
with those in the PATH setting. If you want the names
in the DPATH to be in upper case you must enter them
that way.
If you enter DPATH with no parameters, 4OS2 and 4DOS
/NT display the current DPATH search list.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 218
DRAWBOX
-------------------------------------------------------------------
DRAWBOX (New)
Purpose: Draw a box on the screen.
Format: DRAWBOX ulrow ulcol lrrow lrcol style [BRIght] [BLInk]
fg ON [BRIght] bg [FILl [BRIght] bgfill] [ZOOm]
[SHAdow]
ulrow: Row for upper left corner
ulcol: Column for upper left corner
lrrow: Row for lower right corner
lrcol: Column for lower right corner
style: Box drawing style:
0 No lines (box is drawn with blanks)
1 Single line
2 Double line
3 Single on top and bottom, double on sides
4 Double 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)
See also: DRAWHLINE and DRAWVLINE.
Usage: DRAWBOX is useful for creating attractive screen
displays in batch files.
For example, to draw a box around the entire screen
with bright white lines on a blue background:
drawbox 0 0 24 79 1 bri whi on blu fill blu
See page 26 for details about colors and color names,
and notes on the use of bright background colors.
If you use ZOOM, the box appears to grow in steps to
its final size. The speed of the zoom operation
depends on the speed of your video system.
If you use SHADOW, a drop shadow is created by
changing the characters in the row under the box and
the 2 columns to the right of the box to normal
intensity text with a black background (this will make
characters displayed in black disappear entirely).
The row and column values are zero-based, so on a
standard 25 line by 80 column display, valid rows are
0 - 24 and valid columns are 0 - 79.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 219
DRAWBOX
-------------------------------------------------------------------
DRAWBOX checks for valid row and column values, and
displays a "Usage" error message if any values are out
of range.
Unlike DRAWHLINE and DRAWVLINE, DRAWBOX does not
automatically connect boxes to existing lines on the
screen with the proper connector characters. If you
want to draw lines inside a box and have the proper
connectors drawn automatically, draw the box first,
then use DRAWHLINE and DRAWVLINE to draw the lines.
DRAWBOX uses the standard line and box drawing
characters in the U.S. English extended ASCII
character set. If your system is configured for a
different country or language, the box may not appear
on your screen as you expect.
4DOS ## DRAWBOX normally writes text directly to the screen.
If you have an unusual display adapter which does not
support direct video output, see the OutputBIOS
directive on page 150.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 220
DRAWHLINE
-------------------------------------------------------------------
DRAWHLINE (New)
Purpose: Draw a horizontal line on the screen.
Format: DRAWHLINE row column len style [BRIght] [BLInk]
fg ON [BRIght] bg
row: Starting row
column: Starting column
len: Length of line
style: Line drawing style:
1 Single line
2 Double line
fg: Foreground character color
bg: Background character color
See also: DRAWBOX and DRAWVLINE.
Usage: DRAWHLINE is useful for creating attractive screen
displays in batch files. It detects other lines and
boxes on the display, and creates the appropriate
connector characters when possible (not all types of
lines can be connected with the available characters).
For example, the following command draws a double line
along the top row of the display with green characters
on a blue background:
drawhline 0 0 80 2 green on blue
The row and column values are zero-based, so on a
standard 25 line by 80 column display, valid rows are
0 - 24 and valid columns are 0 - 79. DRAWHLINE checks
for a valid row and column, and displays a "Usage"
error message if either value is out of range.
See page 26 for details about colors and color names,
and notes on the use of bright background colors.
DRAWHLINE uses the standard line and box drawing
characters in the U.S. English extended ASCII
character set. If your system is configured for a
different country or language, the line may not appear
on your screen as you expect.
4DOS ## DRAWHLINE normally writes text directly to the screen.
If you have an unusual display adapter which does not
support direct video output, see the OutputBIOS
directive on page 150.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 221
DRAWVLINE
-------------------------------------------------------------------
DRAWVLINE (New)
Purpose: Draw a vertical line on the screen.
Format: DRAWVLINE row column len style [BRIght][BLInk]
fg ON [BRIght] bg
row: Starting row
column: Starting column
len: Length of line
style: Line drawing style:
1 Single line
2 Double line
fg: Foreground character color
bg: Background character color
See also: DRAWBOX and DRAWHLINE.
Usage: DRAWVLINE is useful for creating attractive screen
displays in batch files. It detects other lines and
boxes on the display, and creates the appropriate
connector characters when possible (not all types of
lines can be connected with the available characters).
For example, to draw a double width line along the
left margin of the display with bright red characters
on a black background:
drawvline 0 0 25 2 bright red on black
The row and column values are zero-based, so on a
standard 25 line by 80 column display, valid rows are
0 - 24 and valid columns are 0 - 79. DRAWVLINE checks
for a valid row and column, and displays a "Usage"
error message if either value is out of range.
See page 26 for details about colors and color names,
and notes on the use of bright background colors.
DRAWVLINE uses the standard line and box drawing
characters in the U.S. English extended ASCII
character set. If your system is configured for a
different country or language, the line may not appear
on your screen as you expect.
4DOS ## DRAWVLINE normally writes text directly to the screen.
If you have an unusual display adapter which does not
support direct video output, see the OutputBIOS
directive on page 150.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 222
ECHO
-------------------------------------------------------------------
ECHO (Enhanced)
Purpose: Display a message, enable or disable batch file or
command-line echoing, or display the echo status.
Format: ECHO [ON | OFF | message]
message: Text to display.
See also: ECHOS, SCREEN, SCRPUT, SETDOS and TEXT.
Usage: 4DOS, 4OS2, and 4DOS/NT have a separate echo
capability for batch files and for the command line.
The command-line ECHO state is independent of the
batch file ECHO state; changing ECHO in a batch file
has no effect on the display at the command prompt,
and vice versa.
To see the current echo state, use the ECHO command
with no arguments. This displays either the batch
file or command-line echo state, depending on where
the ECHO command is performed.
In a batch file, if you turn ECHO on, each line of the
file is displayed before it is executed. If you turn
ECHO off, each line is executed without being
displayed. ECHO can also be used in a batch file to
display a message on the screen. Regardless of the
ECHO state, a batch file line that begins with the [@]
character will not be displayed. To turn off batch
file echoing, without displaying the ECHO command, use
this line:
@echo off
ECHO commands in a batch file will send messages to
the screen while the batch file executes, even if ECHO
is set OFF. For example, this line will display a
message in a batch file:
echo Processing your print files...
If you want to echo a blank line from within a batch
file, enter:
echo.
You cannot use the command separator character ([^] in
4DOS or [&] in 4OS2 and 4DOS/NT) or the redirection
symbols (| > <) in an ECHO message, unless you enclose
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 223
ECHO
-------------------------------------------------------------------
them in quotes (see page 123) or precede them with the
escape character (see page 73).
ECHO defaults to ON in batch files. The current ECHO
state is inherited by called batch files. You can
change the default setting to ECHO OFF with the SETDOS
/V0 command or the BatchEcho directive in the .INI
file (see page 137).
If you turn the command-line ECHO on, each command
will be displayed before it is executed. This will
let you see the command line after expansion of all
aliases and variables. The command-line ECHO is most
useful when you are learning how to use advanced
features. This example will turn command-line echoing
on:
c:\> echo on
ECHO defaults to OFF at the command line.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 224
ECHOS
-------------------------------------------------------------------
ECHOS (New)
Purpose: Display a message without a trailing carriage return
and line feed.
Format: ECHOS message
See also: ECHO, SCREEN, SCRPUT, TEXT, and VSCRPUT.
Usage: ECHOS is useful for text output when you don't want to
add a carriage return / linefeed pair at the end of
the line. For example, you can use ECHOS when you
need to redirect control sequences to your printer;
this example sends the sequence Esc P to the printer
on LPT1:
c:\> echos <Ctrl-X>eP > lpt1:
You cannot use the command separator character ([^] in
4DOS and [&] in 4OS2 and 4DOS/NT) or the redirection
symbols [|><] in an ECHOS message, unless you enclose
them in quotes (see page 123) or precede them with the
escape character (see page 73).
## ECHOS does not translate or modify the message text.
For example, carriage return characters are not
translated to CR/LF pairs. ECHOS sends only the
characters you enter (after escape character and back-
quote processing). The only character you cannot put
into an ECHOS message is the NUL character (ASCII 0).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 225
ENDLOCAL
-------------------------------------------------------------------
ENDLOCAL (New)
Purpose: Restore the saved disk drive, directory, environment,
and alias list.
Format: ENDLOCAL
See also: SETLOCAL.
## Usage: The SETLOCAL command in a batch file saves the current
disk drive, default directory, all environment
variables, and the alias list. ENDLOCAL restores
everything that was saved by the previous SETLOCAL
command.
For example, this batch file fragment saves the drive,
current working directory, and environment variables,
removes all aliases so that any user aliases will not
affect batch file commands, changes the drive and
directory, sets some environment variables, runs the
program TEST1, and then restores the original values:
setlocal
unalias *
cdd d:\test
set path=c:\;c:\dos;c:\util
set lib=d:\lib
test1
endlocal
SETLOCAL and ENDLOCAL can only be used in batch files,
not in aliases or from the command line.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 226
ESET
-------------------------------------------------------------------
ESET (New)
Purpose: Edit environment variables and aliases.
Format: ESET [/A /M] variable name...
variable name: The name of an environment variable or
alias to edit.
/A(lias) /M(aster environment)
See also: ALIAS, UNALIAS, SET, and UNSET.
Usage: ESET allows you to edit environment variables and
aliases using line editing commands (see page 35).
For example, to edit the executable file search path:
c:\> eset path
path=c:\;c:\dos;c:\util
-
To create and then edit an alias:
c:\> alias d = dir /d/j/p
c:\> eset d
d=dir /d/j/p
-
ESET will search for environment variables first and
then aliases. If you have an environment variable and
an alias with the same name, ESET will edit the
environment variable and ignore the alias unless you
use the /A option.
Environment variable and alias names are normally
limited to 80 characters, and their contents to 255
characters in 4DOS, or 1,023 characters in 4OS2 and
4DOS/NT. However, if you use special techniques to
create a longer environment variable, ESET will edit
it provided the variable contains no more than 511
characters of text in 4DOS, or 2,047 characters in
4OS2 and 4DOS/NT.
If you have enabled global aliases (see page 169), any
changes made to an alias with ESET will immediately
affect all other copies of the command processor which
are using the same alias list.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 227
ESET
-------------------------------------------------------------------
Option: ## /A(lias): Edit the named alias even if an environment
variable of the same name exists. If you have an
alias and an environment variable with the same name,
you must use this switch to be able to edit the alias.
4DOS /M(aster environment): Edit an environment variable
in the master environment rather than the local
environment. This option is only useful from a
secondary command shell (for example, when an
application has "shelled to DOS"). /M only works for
environment variables; it cannot be used to edit the
primary shell's aliases.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 228
EXCEPT
-------------------------------------------------------------------
EXCEPT (New)
Purpose: Perform a command on all available files except those
specified.
Format: EXCEPT (file) command
file: The file or files to exclude from the command.
command: The command to execute, including all
appropriate arguments and switches.
See also: ATTRIB.
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67). Date,
time, or size ranges must appear immediately after the
EXCEPT keyword.
Usage: EXCEPT provides a means of executing a command on a
group of files and/or subdirectories, and excluding a
subgroup from the operation. The command can be an
internal command or alias, an external command, or a
batch file.
You may use wildcards to specify the files to exclude
from the command. The first example erases all the
files in the current directory except those beginning
with MEMO, and those whose extension is .WKS. The
second example copies all the files and subdirectories
on drive C to drive D except those in C:\MSC and
C:\DOS, using the COPY command:
c:\> except (memo*.* *.wks) erase *.*
c:\> except (c:\msc c:\dos) copy c:\*.* d:\ /s
## Date, time, and size ranges can be used immediately
after the word EXCEPT to further qualify which files
should be excluded from the command. If the command
is an internal command that supports ranges, an
independent range can also be used in the command
itself.
## ! EXCEPT prevents operations on the specified file(s) by
setting the hidden attribute, performing the command,
and then clearing the hidden attribute. If the
command is aborted in an unusual way, you may need to
use the ATTRIB command to remove the hidden attribute
from the file(s).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 229
EXCEPT
-------------------------------------------------------------------
! ## EXCEPT will not work with programs or commands that
ignore the hidden attribute or which work explicitly
with hidden files, including DEL /Z, and the /H
(process hidden files) switch available in some 4DOS,
4OS2, and 4DOS/NT file processing commands.
## You can use command grouping (see page 71) to execute
multiple commands with a single EXCEPT. For example,
the following command copies all files in the current
directory whose extensions begin with .DA, except the
.DAT files, to the D:\SAVE directory, then changes the
first two characters of the extension of the copied
files to .SA. This example should be entered on one
line:
c:\data> except (*.dat) (copy *.da* d:\save ^
ren *.da* *.sa*)
## If you use filename completion (see page 41) to enter
the filenames inside the parentheses, type a space
after the open parenthesis before entering a partial
filename or pressing Tab. Otherwise, the command-line
editor will treat the open parenthesis as the first
character of the filename to be completed.
4DOS ## ! If you receive a stack overflow error when using
EXCEPT in complex, nested command sequences, see the
notes under the StackSize directive on page 150.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 230
EXIT
-------------------------------------------------------------------
EXIT (Enhanced)
Purpose: Return from the command processor.
Format: EXIT [value]
value: The exit code to return (0 - 255).
Usage: EXIT terminates the current copy of the command
processor. Use it to return to an application when
you have "shelled out" to work at the prompt, or to
end a command-line session under Windows, OS/2, or
Windows NT.
To close the session, or to return to the application
that started the command processor, type:
c:\> exit
## If you specify a value, EXIT will return that value to
the program that started the command processor. For
example:
c:\> exit 255
## The value is a number you can use to inform the
program of some result, such as the success or failure
of a batch file. This feature is most useful for
systems which use batch files to automate their
operation, such as bulletin boards, or custom
application programs like databases that shell to the
command processor to perform certain tasks.
4DOS ## You cannot EXIT from the primary 4DOS shell under DOS.
If EXIT does not seem to have any effect, you are
probably in the primary shell.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 231
FFIND
-------------------------------------------------------------------
FFIND (New)
Purpose: Search for files by name or contents.
Format: FFIND [/A[[:][-]rhsda] /B /C /D[list] /E /K /L /M
/O[[:][-]acdeginrsu] /P /S /[T|X]"xx" /V] file...
list: A list of disk drive letters (without colons).
file: The file, directory, or list of files or
directories to display.
/A(ttribute select) /M (no footers)
/B(are) /O(rder)
/C(ase sensitive) /P(ause)
/D(rive) /S(ubdirectories)
/E (upper case display) /T"xx" (text search string)
/K (no headers) /V(erbose)
/L(ine numbers) /X["xx"] (hex display /
search string)
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: FFIND is a flexible search command that looks for
files based on their names and their contents.
Depending on the options you choose, FFIND can display
filenames, matching text, or a combination of both in
a variety of formats.
If you want to search for files by name, FFIND works
much like the DIR command. For example, to generate a
list of all the .BTM files in the current directory,
you could use the command
c:\> ffind *.btm
The output from this command is a list of full
pathnames, followed by the number of files found.
If you want to limit the output to a list of *.BTM
files which contain the string color, you could use
this command instead:
c:\> ffind /t"color" *.btm
The output from this version of FFIND is a list of
files that contain the string color along with the
first line in each file that contains that string. By
default, FFIND uses a case-insensitve search, so the
command above will include files that contain COLOR,
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 232
FFIND
-------------------------------------------------------------------
Color, color, or any other combination of upper-case
and lower-case letters.
You can use extended wildcards in the search string to
increase the flexibility of FFIND's search. For
example, the following command will find .TXT files
which contain either the string June or July (it will
also find Juny and Jule). The /C option makes the
search case-sensitive:
c:\> ffind /c/t"Ju[nl][ey]" *.txt
At times, you may need to search for data that cannot
be represented by ASCII characters. You can use
FFIND's /X option to represent the search string in
hexadecimal format. With /X, the search must be
represented by pairs of hexadecimal digits separated
by spaces; a search of this type is always case-
sensitive (41 63 65 is the hex code for "Ace"):""
c:\> ffind /x"41 63 65" *.txt
You can use FFIND's other options to further specify
the files for which you are searching and to modify
the way in which the output is displayed.
4DOS ## If you are using a disk compression program, you can
sort the display by compression ratios with the /O:c
switch. See APPNOTES.DOC for a list of supported
compression systems.
Options: /A(ttribute select): Find only those files that have
the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will display
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., FFIND /A
...), FFIND will search all files and subdirectories
including hidden and system files. If attributes are
combined, all the specified attributes must match for
a file to be included in the listing. For example,
/A:RHS will search only those files with all three
attributes set. See page 18 for more information on
file attributes.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 233
FFIND
-------------------------------------------------------------------
/B(are): Display file names only and omit the text
that matches the search. This option is only useful
in combination with /T or /X, which normally force
FFIND to display file names and matching text.
/C(ase sensitive): Perform a case-sensitive search.
This option is only valid with /T, which defaults to a
case-insenitive search. It is not needed with a /X
hexadecimal search, which is always case-sensitive.
/D(rive): Search all files on one or more drives. If
you use /D without a list of drives, FFIND will search
the drives specified in the list of files. If no
drive letters are listed, FFIND will search the
default drive. You can include a list of drives or a
range of drives to search as part of the /D option.
For example, to search drives C:, D:, E:, and G:, you
can use either of these commands:
c:\> ffind /dcdeg ...
c:\> ffind /dc-eg ...
/E: Display filenames in the traditional upper case;
also see SETDOS /U (page 326) and the UpperCase
directive in 4DOS.INI (page 141).
/K (No headers): Suppress the display of the header
or filename for each matching text line.
/L(ine numbers): Include the line number for each
text line displayed.
/M (No footers): Suppress the footer (the number of
files and number of matches) at the end of FFIND's
display.
/O(rder): Set the sort order for the files that FFIND
displays. You may use any combination of the
following sorting options; if multiple options are
used, the listing will be sorted with the first sort
option as the primary key, the next as the secondary
key, and so on:
- Reverse the sort order for the next option
a Sort names and extensions in standard ASCII
order, rather than sorting numerically when
digits are included in the name or
extension.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 234
FFIND
-------------------------------------------------------------------
4DOS c Sort by compression ratio (the least
compressed file in the list will be
displayed first).
d Sort by date and time (oldest first); for
HPFS and NTFS drives also see /T.
e Sort by extension.
g Group subdirectories first, then files.
i Sort by the file description (ignored if /C
or /O:c is also used).
n Sort by filename (this is the default).
r Reverse the sort order for all options.
s Sort by size.
u Unsorted.
/P(ause): Wait for a key to be pressed after each
screen page before continuing the display. Your
options at the prompt are explained in detail on page
. 50
/S(ubdirectories): Display matches from the current
directory and all of its subdirectories.
/T"xx" (Text search): Specify the text search string.
/T must be followed by a text string in double quotes
(e.g., /t"color"). FFIND will perform a case-
insensitive search unless you also use the /C option.
For a hexadecimal search and/or hexadecimal display of
the location where the search string is found, see /X.
You can specify a search string with either /T or /X,
but not both.
/V(erbose): Show every matching line. FFIND's
default behavior is to show only the first matching
line then and then go on to the next file. This
option is only valid with /T or /X.
/X["xx"] (Hexadecimal display / search): Specify
hexadecimal display and an optional hexadecimal search
string.
If /X is followed by one or more pairs of hexadecimal
digits in quotes (e.g., /x"44 63 65"), FFIND will
search for that exact sequence of characters or data
bytes without regard to the meaning of those bytes as
text. If those bytes are found, the offset is
displayed (also in hexadecimal). A search of this
type will always be case-sensitive.
If /X is not followed by a hexadecimal search string
it must be used in conjunction with /T, and will
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 235
FFIND
-------------------------------------------------------------------
change the output format to display hexadecimal
offsets rather than actual text lines when the search
string is found. For example, this command uses /T to
display the first line in each BTM file containing the
word "hello":
c:\>ffind /t"hello" *.btm
---- c:\test.btm
echo hello
1 line in 1 file
If you use the same command with /X, the hexadecimal
offset is displayed instead of the text:
c:\>ffind /t"hello" /x *.btm
---- c:\test.btm
Offset: 1A
1 line in 1 file
You can specify a search string with either /T or /X,
but not both.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 236
FOR
-------------------------------------------------------------------
FOR (Enhanced)
Purpose: Repeat a command for several values of a variable.
Format: FOR [/A[[:][-]rhsda] /D /H] %var IN ([@]set) [DO]
command ...
%var: The variable to be used in the command ("FOR
variable").
set: A set of values for the variable.
command: A command or group of commands to be
executed for each value of the variable.
/A(ttribute select) /H(ide dots)
/D(isable "/")
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67). Date,
time, or size ranges must appear immediately after the
FOR keyword.
Usage: FOR begins by creating a set. It then executes a
command for every member of the set. The command can
be an internal command, an alias, an external command,
or a batch file.
Normally, the set is a list of files specified with
wildcards. For example, if you use this line in a
batch file:
for %x in (*.txt) do list %x
then LIST will be executed once for each file in the
current directory with the extension .TXT. The FOR
variable %x is set equal to each of the file names in
turn, then the LIST command is executed for each file.
(You could do the same thing more easily with a simple
LIST *.TXT. We used FOR here so you could get a feel
for how it operates, using a simple example.)
The set can include multiple files or an include list,
like this:
for %x in (d:\*.txt;*.doc;*.asc) do type %x
If the set includes filenames, the file list can be
further refined by using date, time, and size ranges
(see page 62). The range must be placed immediately
after the word FOR. The range will be ignored if no
wildcards are used inside the parentheses. For
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 237
FOR
-------------------------------------------------------------------
example, this set is made up of all of the *.TXT files
that were created or updated on October 4, 1993:
for /[d10-4-93,+0] %x in (*.txt) do ...
If the command is an internal command that supports
ranges, an independent range can also be used in the
command itself.
The set can also be made up of text instead of file
names. For example, to display the free space on
drives C:, D:, and E:, you could use:
for %drive in (c d e) do free %drive:
When the set is made up of text or several separate
file names (not an include list), the elements must be
separated by spaces, tabs, commas, or the switch
character (normally a slash [/]).
## You can also set the FOR variable equal to each line
in a file by placing an [@] in front of the file name.
If you have a file called DRIVES.TXT that contains a
list of drives on your computer, one drive name per
line (with a ":" after each drive letter), you can
print the free space on each drive this way:
for %d in (@drives.txt) do free %d > prn
## Because the [@] is also a valid filename character,
FOR first checks to see if the file exists with the
[@] in its name (i.e., a file named @DRIVES.TXT). If
so, the filename is treated as a normal argument. If
it doesn't exist, FOR uses the filename (without the
[@]) as the file from which to retrieve text.
## You can use either % or %% in front of the variable
name. Either form will work, whether the FOR command
is typed from the command line or is part of an alias
or batch file (some of the traditional command
processors require a single % if FOR is used at the
command line, but use %% if it is used in a batch
file). The variable name can be up to 80 characters
long. The word DO is optional.
## If you use a single-character FOR variable name, that
name is given priority over any environment variable
which starts with the same letter, in order to
maintain compatibility with the traditional FOR
command. For example, the following command tries to
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 238
FOR
-------------------------------------------------------------------
add a: and b: to the end of the PATH, but will not
work as intended:
c:\> for %p in (a: b:) do path %path;%p
The "%p" in "%path" will be interpreted as the FOR
variable %p followed by the text "ath", which is not
what was intended. To get around this, use a
different letter or a longer name for the FOR
variable, or use square brackets around the variable
name (see page 97).
## The following example uses FOR with 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) do del
%@name[%file].bak
## You can use command grouping (see page 71) to execute
multiple commands for each element in the list. For
example, the following command copies each .WKQ file
in the current directory to the D:\WKSAVE directory,
then changes the extension of each file in the current
directory to .SAV. This should be entered on one
line:
c:\text> for %file in (*.wkq) do (copy %file
d:\wksave\ ^ ren %file *.sav)
(Use an ampersand [&] as the separator character if
you are using 4OS2 or 4DOS/NT.)
## In a batch file you can use GOSUB to execute a
subroutine for every element in the set. Within the
subroutine, the FOR variable can be used just like any
environment variable. This is a convenient way to
execute a complex sequence of commands for every
element in the set without CALLing another batch file.
## One unusual use of FOR is to execute a collection of
batch files or other commands with the same parameter.
For example, you might want to have three batch files
all operate on the same data file. The FOR command
could look like this (enter this on one line):
c:\> for %cmd in (filetest fileform fileprnt)
do %cmd datafile
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 239
FOR
-------------------------------------------------------------------
This line will expand to three separate commands:
filetest datafile
fileform datafile
fileprnt datafile
## The variable that FOR uses (the %CMD in the example
above) is created in the environment and then erased
when the FOR command is done. However, for
compatibility with COMMAND.COM and CMD.EXE, single-
character FOR variables do not overwrite existing
environment variables with the same name. As a
result, when using a multi-character variable name you
must be careful not to use the name of one of your
environment variables as a FOR variable. For example,
a command that begins
c:\> for %path in ...
will write over your current path setting and then
erase the path variable completely.
## FOR statements can be nested. Under 4DOS, the
permissible nesting level depends on the amount of
free space in 4DOS's internal stack.
4DOS ! ## If you receive a stack overflow error when using FOR
in complex, nested command sequences, see the notes
under the StackSize directive on page 150.
Options: ## /A(ttribute select): Process only those files that
have the specified attribute(s). /A will be used only
when processing wildcard file names in the set. It
will be ignored for filenames without wildcards or
other items in the set. Preceding the attribute
character with a hyphen [-] will process files that do
not have that attribute set. The attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed (e.g., FOR /A ...), FOR
will process all files including hidden and system
files. If attributes are combined, all the specified
attributes must match for a file to be included. For
example, /A:RHS will include only those files with all
three attributes set. See page 18 for more
information on file attributes.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 240
FOR
-------------------------------------------------------------------
For example, to process only those files with the
archive attribute set:
for /a:a %f in (*.*) echo %f needs a backup!
4DOS ## /D(isable "/"): Disables the special processing of
the forward slash [/] character in the FOR set.
COMMAND.COM and 4DOS normally treat a forward slash
inside the set as an "escape" character, discard the
slash, and return the character after the slash,
followed by the remainder of the string. This
behavior can be used in batch files to separate a
string into individual characters (although 4DOS
provides a much easier method with the %@INSTR and
%@SUBSTR variable functions).
The /D option must follow the FOR keyword and come
before the variable name. These examples show the
effects of /D:
c:\> for %s in (/abcdef) do echo %s
a
bcdef
c:\> for /d %s in (/abcdef) do echo %s
/abcdef
/H(ide dots): Suppress the assignment of the "." and
".." directories to the var.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 241
FREE
-------------------------------------------------------------------
FREE (New)
Purpose: Display the total disk space, total bytes used, and
total bytes free on the specified (or default)
drive(s).
Format: FREE [drive: ...]
drive: One or more drives to include in the report.
See also: MEMORY.
Usage: FREE provides the same disk information as the
external command CHKDSK, but without the wait, since
it does not check the integrity of the file and
directory structure of the disk.
A colon [:] is required after each drive letter. This
example displays the status of drives A and C:
c:\> free a: c:
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
If you are using DOS 4.0 or later, OS/2, or Windows
NT, the volume serial number will appear after the
drive label or name.
4DOS Some DOS networks with large server disk drives (256
MB or more) may report disk space values that are too
small when FREE is used. If this occurs, it is
because the network software does not report the
proper values to 4DOS.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 242
GLOBAL
-------------------------------------------------------------------
GLOBAL (New)
Purpose: Execute a command in the current directory and its
subdirectories.
Format: GLOBAL [/H /I /P /Q] command
command: The command to execute, including arguments
and switches.
/H(idden directories) /P(rompt)
/I(gnore exit codes) /Q(uiet)
Usage: GLOBAL performs the command first in the current
directory and then in every subdirectory under the
current directory. The command can be an internal
command, an alias, an external command, or a batch
file.
This example copies the files in every directory on
drive A to the directory C:\TEMP:
a:\> global copy *.* c:\temp
If you use the /P option, GLOBAL will prompt for each
subdirectory before performing the command. You can
use this option if you want to perform the command in
most, but not all subdirectories of the current
directory.
## You can use command grouping (see page 71) to execute
multiple commands in each subdirectory. For example,
the following command copies each .TXT file in the
current directory and all of its subdirectories to
drive A. It then changes the extension of each of the
copied files to .SAV:
c:\> global (copy *.txt a: ^ ren *.txt *.sav)
4DOS ## ! If you use GLOBAL in complex, nested command
sequences, see the cautionary note on page 150.
Options: ## /H(idden directories): Forces GLOBAL to look for
hidden directories. If you don't use this switch,
hidden directories are ignored.
## /I(gnore exit codes): If this option is not
specified, GLOBAL will terminate if the command
returns a non-zero exit code. Use /I if you want
command to continue in additional subdirectories even
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 243
GLOBAL
-------------------------------------------------------------------
if it returns an error in a previous subdirectory.
Even if you use /I, GLOBAL will halt execution in
response to Ctrl-C or Ctrl-Break.
/P(rompt): Forces GLOBAL to prompt with each
directory name before it performs the command. Your
options at the prompt are explained in detail on page
50.
/Q(uiet): Do not display the directory names as each
directory is processed.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 244
GOSUB
-------------------------------------------------------------------
GOSUB (New)
Purpose: Execute a subroutine in the current batch file.
Format: GOSUB label
label: The batch file label at the beginning of the
subroutine.
See also: CALL, GOTO and RETURN.
Usage: GOSUB can only be used in batch files.
4DOS, 4OS2, and 4DOS/NT allow subroutines in batch
files. A subroutine must start with a label (a colon
[:] followed by a one-word label name) which appears
on a line by itself. Case differences are ignored
when matching labels. The subroutine must end with a
RETURN statement.
The subroutine is invoked with a GOSUB command from
another part of the batch file. After the RETURN,
processing will continue with the command following
the GOSUB command. For example, the following batch
file fragment calls a subroutine which displays the
directory and returns:
echo Calling a subroutine
gosub subr1
echo Returned from the subroutine
quit
:subr1
dir /a/w
return
If the label doesn't exist, the batch file is
terminated with the error message "Label not found."
GOSUB saves the IFF state, so IFF statements inside a
subroutine won't interfere with IFF statements in the
part of the batch file from which the subroutine was
called.
## Subroutines can be nested. Under 4DOS, the
permissible nesting level depends on the amount of
free space in 4DOS's internal stack; if you receive a
stack overflow error when using GOSUB in complex,
nested command sequences, see the notes under the
StackSize directive on page 150.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 245
GOTO
-------------------------------------------------------------------
GOTO (Compatible)
Purpose: Branch to a specified line inside the current batch
. file
Format: GOTO [/I] label
label: The batch file label to branch to.
/I(FF and DO continue)
See also: GOSUB.
Usage: GOTO can only be used in batch files.
After a GOTO command in a batch file, the next line to
be executed will be the one immediately after the
label. The label must begin with a colon [:] and
appear on a line by itself. The colon is required on
the line where the label is defined, but is not
required in the GOTO command itself. Case differences
are ignored when matching labels.
This batch file fragment checks for the existence of
the file CONFIG.SYS. If the file exists, the batch
file jumps to C_EXISTS and copies all the files from
the current directory to the root directory on A:.
Otherwise, it prints an error message and exits.
if exist config.sys goto C_EXISTS
echo CONFIG.SYS doesn't exist - exiting.
quit
:C_EXISTS
copy *.* a:\
If the label doesn't exist, the batch file is
terminated with the error message "Label not found."
! ## To avoid errors in the processing of nested statements
and loops, GOTO cancels all active IFF statements and
DO /ENDDO loops unless you use /I. This means that a
normal GOTO (without /I) may not branch to any label
that is between an IFF and the corresponding ENDIFF or
between a DO and the corresponding ENDDO.
Options: ## /I(FF and DO continue): Prevents GOTO from canceling
IFF statements and DO loops. Use this option only if
you are absolutely certain that your GOTO command is
branching entirely within any current IFF statement
and any active DO / ENDDO block. Using /I under any
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 246
GOTO
-------------------------------------------------------------------
other conditions will cause an error later in your
batch file.
You cannot branch into another IFF statement, another
DO loop, or a different IFF or DO nesting level,
whether you use the /I option or not. If you do, you
will eventually receive an "unknown command" error (or
execution of the UNKNOWN_CMD alias) on a subsequent
ENDDO, ELSE, ELSEIFF, or ENDIFF statement.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 247
HELP
-------------------------------------------------------------------
HELP (Enhanced, External command)
Purpose: Display help for internal commands. Help for external
commands is also available under DOS, and optionally
under OS/2.
Format: HELP [topic]
topic: A help topic, internal command, or external
command.
Usage: Online help is available for 4DOS, 4OS2, and 4DOS/NT.
The 4OS2 and 4DOS/NT help systems use the operating
system's help facility. 4DOS uses its own help
program.
See page 48 for more details on getting help at the
command line. See the Introduction and Installation
Guide that was supplied with your version of 4DOS,
4OS2, or 4DOS/NT for a more thorough explanation of
the online help available with the program you use.
If you type the command HELP by itself (or press F1
when the command line is empty), the table of contents
is displayed. If you type HELP plus a topic name,
that topic is displayed. For example,
help copy
displays information about the COPY command and its
options.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 248
HISTORY
-------------------------------------------------------------------
HISTORY (New)
Purpose: Display, add to, clear, or read the history list.
Format: HISTORY [/A command /F /P /R filename]
/A(dd) /P(ause)
/F(ree) /R(ead)
See also: LOG.
Usage: 4DOS, 4OS2, and 4DOS/NT keep a list of the commands
you have entered on the command line. See page 36 for
information on command recall, which allows you to use
the history list to repeat or edit commands you have
typed.
The HISTORY command lets you view and manipulate the
command history list directly. If no parameters are
entered, HISTORY will display the current command
history list:
c:\> history
With the options explained below, you can clear the
list, add new commands to the list without executing
them, save the list in a file, or read a new list from
a file.
The number of commands saved in the history list
depends on the length of each command line. The
history list size can be specified at startup from 256
to 8192 characters (see page 133). The default size
is 1024 characters.
Your history list can be stored either locally (a
separate history list for each copy of the command
processor) or globally (all copies of the command
processor share the same list). For full details see
the discussion of local and global history lists
beginning on page 39.
## You can use the HISTORY command as an aid in writing
batch files by redirecting the HISTORY output to a
file and then editing the file appropriately.
However, it is easier to use the LOG /H command for
this purpose.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 249
HISTORY
-------------------------------------------------------------------
## You can disable the history list or specify a minimum
command-line length to save with the HistMin directive
in the .INI file.
Options: ## /A(dd): Add a command to the history list. This
performs the same function as the Ctrl-K key at the
command line (see page 36).
/F(ree): Erase all entries in the command history
list.
/P(rompt): Wait for a key after displaying each page
of the list. Your options at the prompt are explained
in detail on page 50.
## /R(ead): Read the command history from the specified
file and append it to the history list currently held
in memory. Each line in the file must fit within the
command-line length limit for your command processor
(see page 50).
You can save the history list by redirecting the
output of HISTORY to a file. This example saves the
command history to a file called HISTFILE and reads it
back again immediately. If you leave out the HISTORY
/F command on the second line, the contents of the
file will be appended to the current history list
instead of replacing it:
c:\> history > histfile
c:\> history /f
c:\> history /r histfile
If you need to save your history at the end of each
day's work, you might use commands like this in your
AUTOEXEC.BAT or other startup file:
if exist c:\histfile history /r c:\histfile
alias shut*down `history > c:\histfile`
This restores the previous history list if it exists,
then defines an alias which will save the history
before shutting off the system.
## If you are creating a HISTORY /R file by hand, and
need to create an entry that spans multiple lines in
the file, you can do so by terminating each line,
except the last, with an escape character (see page
73). However, you cannot use this method to exceed
the command-line length limit.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 250
IF
-------------------------------------------------------------------
IF (Enhanced)
Purpose: Execute a command if a condition or set of conditions
is true.
Format: IF [NOT] condition [.AND. | .OR. | .XOR. [NOT]
condition ...] command
condition: A test to determine if the command should
be executed.
command: The command to execute if the condition is
true.
See also: IFF; @IF on page 116.
Usage: IF is normally used only in aliases and batch files.
It is always followed by one or more conditions and
then a command. First, the conditions are evaluated.
If they are true, the command is executed. Otherwise,
the command is ignored. If you add a NOT before a
condition, the command is executed only when the
condition is false.
You can link conditions with .AND., .OR., or .XOR.,
and you can nest IF statements. The conditions can
test strings, numbers, the existence of a file or
subdirectory, the exit code returned by the preceding
external command, and the existence of alias names and
internal commands.
The command can be an alias, an internal command, an
external command, or a batch file. The entire IF
statement, including all conditions and the command,
must fit on one line.
## You can use command grouping (see page 71) to execute
multiple commands if the condition is true. For
example, the following command tests if any .TXT files
exist. If they do, they are copied to drive A: and
their extensions are changed to .TXO:
if exist *.txt (copy *.txt a: ^ ren *.txt *.txo)
(Change the command separator to an ampersand [&] to
use a command like this under 4OS2 or 4DOS/NT. Also,
note that the IFF command provides a more structured
method of executing multiple commands if a condition
or set of conditions is true.)
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 251
IF
-------------------------------------------------------------------
4DOS ! ## If you receive a stack overflow error when using IF
in complex, nested command sequences, see the notes
under the StackSize directive on page 150.
Conditions: The following conditional tests are available in both
the IF and IFF commands. They fit into two
categories: string and numeric tests, and status
tests. The tests can use environment variables,
internal variables and variable functions, file names,
literal text, and numeric values as their arguments.
Spaces are required on either side of the test
condition in all cases, except == which will work with
or without spaces around it.
String and Numeric Tests
Six test conditions can be used to test character
strings. The same conditions are available for both
numeric and normal text strings (see below for
details). In each case you enter the test as:
string1 operator string2
The operator defines the type of test (equal, greater
than or equal, and so on). The operators are:
Operator Tests
-------- ----------------------------------
EQ or == string1 equal to string2
NE or != string1 not equal to string2
LT string1 less than string2
LE string1 less than or equal to string2
GE string1 greater than or equal to
string2
GT string1 greater than string2
When IF compares two character strings, it will use
either a numeric comparison or a string comparison. A
numeric comparison treats the strings as numeric
values and tests them arithmetically. A string
comparison treats the strings as text.
The difference between numeric and string comparisons
is best explained by looking at the way two values are
tested. For example, consider comparing the values 2
and 19. Numerically, 2 is smaller, but as a string it
is "larger" because its first digit is larger than the
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 252
IF
-------------------------------------------------------------------
first digit of 19. So the first of these conditions
will be true, and the second will be false:
if 2 lt 19 ...
if "2" lt "19" ...
IF determines which kind of test to do by examining
the first character of each string. If both strings
begin with a numeric character (a digit, sign, or
decimal point), a numeric comparison is used. If
either value does not begin with a numeric character,
a string comparison is used. To force a string
comparison when both values are or may be numeric, use
double quotes around the values you are testing, as
shown above. Because the double quote is not a
numeric character, it forces IF to do a string
comparison.
Case differences are ignored in string comparisons.
If two strings begin with the same text but one is
shorter, the shorter string is considered to be "less
than" the longer one. For example, "a" is less than
"abc", and "hello_there" is greater than "hello".
When you compare text strings, you should always
enclose the arguments in double quotes in order to
avoid syntax errors which may occur if one of the
argument values is empty.
Numeric comparisons work with both integer and decimal
values. The values to be compared must contain only
numeric digits, decimal points, and an optional sign
(+ or -). The number to the left of the decimal point
may not exceed 2,147,483,648 (the maximum possible 32-
bit positive integer). The number of digits to the
right of the decimal point is limited only by the
length of the command line.
Internal variables (page 100) and variable functions
(page 108) are very powerful when combined with string
and numeric comparisons. They allow you to test the
state of your system, the characteristics of a file,
date and time information, or the result of a
calculation. You may want to review the variables and
variable functions when determining the best way to
set up an IF test.
This first example is a batch file fragment which runs
a program called MONOPROG if a monochrome monitor is
attached to the system (this example will work in 4DOS
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 253
IF
-------------------------------------------------------------------
or 4OS2; 4DOS/NT does not include the _MONITOR
variable):
if "%_monitor" == "mono" monoprog
The second batch file fragment tests for a string
value:
input "Enter your selection : " %%cmd
if "%cmd" == "WP" goto wordproc
if "%cmd" NE "GRAPHICS" goto badentry
This example calls GO.BTM if the first two characters
in the file MYFILE are "GO" (enter this example on one
line):
if "%@instr[0,2,%@line[myfile,0]]"=="GO"
call go.btm
The next two examples test whether there is more than
500 KBytes of free memory or more than 2 MBytes of
free EMS memory (the EMS example only applies to
4DOS):
c:\> if %@dosmem[k] gt 500 echo Over 500K free
c:\> if %@ems[m] gt 2 echo Over 2 MB EMS free
Status Tests
These conditions test the system or command processor
status. You can use internal variables and variable
functions to test many other parts of the system
status.
ERRORLEVEL [operator] n
This test retrieves the exit code of the
preceding external program. By convention,
programs return an exit code of 0 when they are
successful and a number between 1 and 255 to
indicate an error. The condition can be any of
the operators listed above (EQ, !=, GT, etc.).
If no operator is specified, the default is GE.
The comparison is done numerically.
Not all programs return an explicit exit code.
For programs which do not, the behavior of
ERRORLEVEL is undefined.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 254
IF
-------------------------------------------------------------------
EXIST filename
If the file exists, the condition is true. You
can use wildcards in the filename, in which case
the condition is true if any file matching the
wildcard name exists.
ISALIAS aliasname
If the name is defined as an alias, the condition
is true.
ISDIR | DIREXIST path
If the subdirectory exists, the condition is
true. For compatibility with DR DOS and Novell
DOS, DIREXIST may be used as a synonym for ISDIR.
ISINTERNAL command
If the specified command is an active internal
command, the condition is true. Commands can be
activated and deactivated with the SETDOS /I
command.
4NT ISWINDOW "title"
If a window with the title exists, the condition
is true. Double quotes must be used around the
title.
The first batch file fragment below tests for the
existence of A:\JAN.DOC before copying it to drive C.
if exist a:\jan.doc copy a:\jan.doc c:\
This example tests the exit code of the previous
program and stops all batch file processing if an
error occurred:
if errorlevel==0 goto success
echo "External Error -- Batch File Ends!"
cancel
## Combining Tests
You can negate the result of any test with NOT, and
combine tests of any type with .AND., .OR., and .XOR.
Test conditions are always scanned from left to right
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 255
IF
-------------------------------------------------------------------
- there is no implied order of precedence, as there is
in some programming languages.
When two tests are combined with .AND., the result is
true if both individual tests are true. When two
tests are combined with .OR., the result is true if
either (or both) individual tests are true. When two
tests are combined with .XOR., the result is true only
if one of the tests is true and the other is false.
This example runs a program called HIGHRES if either
an EGA or VGA video adapter is in use (this will work
in 4DOS or 4OS2; 4DOS/NT does not include the _VIDEO
variable):
if "%_video"=="EGA" .or. "%_video"==vga highres
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 256
IFF
-------------------------------------------------------------------
IFF (New)
Purpose: Perform IF / THEN / ELSE conditional execution of
commands.
Format: IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT]
condition ...] THEN ^ commands
[ELSEIFF condition THEN ^ commands] ...
[ELSE ^ commands]
^ ENDIFF
condition: A test to determine if the command(s)
should be executed.
commands: One or more commands to execute if the
condition(s) is true. If you use multiple commands,
they must be separated by command separators or be
placed on separate lines of a batch file.
See also: IF.
Usage: IFF is similar to the IF command, except that it can
perform one set of commands when a condition or set of
conditions is true and different commands when the
conditions are false.
IFF can execute multiple commands when the conditions
are true or false; IF normally executes only one
command. IFF imposes no limit on the number of
commands and is generally a "cleaner" and more
structured command than IF.
IFF is always followed by one or more conditions. If
they are true, the commands that follow the word THEN
are executed. Additional conditions can be tested
with ELSEIFF. If none of these conditions are true,
the commands that follow the word ELSE are executed.
In both cases, after the selected commands are
executed, processing continues after the word ENDIFF.
If you add a NOT before the condition, the THEN
commands are executed only when the condition is false
and the ELSE commands are executed only when the
condition is true.
The commands may be separated by command separators,
or may be on separate lines of a batch file. You
should include a command separator or a line break
after a THEN, before an ELSEIFF, and before and after
an ELSE. Note that the syntax above and the examples
below use the default 4DOS command separator, a caret
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 257
IFF
-------------------------------------------------------------------
[^]. Replace the caret with an ampersand [&] if you
are using 4OS2 or 4DOS/NT.
You can link conditions with .AND., .OR., or .XOR.,
and you can nest IFF statements up to 15 levels deep.
The conditions can test strings or numbers, the
existence of a file or subdirectory, the errorlevel
returned from the preceding external command, and the
existence of alias names and internal commands.
See the IF command for a list of the possible
conditions.
The commands can include any internal command, alias,
external command, or batch file.
The following batch file fragment for 4DOS or 4OS2
tests the monitor type (monochrome or color), and sets
the appropriate colors and prompt (enter the "prompt"
lines on one line of the batch file):
iff "%_monitor" == "color" then
color bright white on blue ^ cls
prompt=$e[s$e[1;1f$e[41;1;37m$e[K Path:
$p$e[u$e[44;37m$n$g
else
prompt=$e[s$e[1;1f$e[0;7m$e[K Path:
$p$e[u$e[0m$n$g
endiff
(The above example uses ANSI color sequences in the
prompt, which work in 4DOS if an ANSI driver is
loaded, and in 4OS2. They will not work in 4DOS/NT,
because Windows NT does not offer ANSI support. See
PROMPT for additional details.)
The alias in this second example checks to see if the
argument is a subdirectory. If so, the alias deletes
the subdirectory's files and removes it (enter this on
one line):
c:\> alias prune `iff isdir %1 then ^
del /sxz %1 ^ else ^
echo Not a directory!^endiff`
! ## Be sure to read the cautionary notes about GOTO and
IFF under the GOTO command (page 246) before using a
GOTO inside an IFF statement.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 258
INKEY
-------------------------------------------------------------------
INKEY (New)
Purpose: Get a single keystroke from the user and store it in
an environment variable.
Format: INKEY [/C /D /K"keys" /P /Wn /X] [prompt] %%varname
prompt: Optional text that is displayed as a prompt.
varname: The variable that will hold the user's
keystroke.
/C(lear buffer) /P(assword)
/D(igits only) /W(ait)
/K (valid keystrokes) /X (no carriage return)
See also: INPUT and KEYSTACK.
Usage: INKEY optionally displays a prompt. Then it waits for
a specified time or indefinitely for a keystroke, and
places the keystroke into an environment variable. It
is normally used in batch files and aliases to get a
menu choice or other single-key input. Along with the
INPUT command, INKEY allows great flexibility in
reading input from within a batch file or alias.
If prompt text is included in an INKEY command, it is
displayed while INKEY waits for input.
The following batch file fragment prompts for a
character and stores it in the variable NUM:
inkey Enter a number from 1 to 9: %%num
INKEY reads standard input for the keystroke, so it
will accept keystrokes from a redirected file or from
the Keystack under 4DOS. You can supply a list of
valid keystrokes with the /K option.
Standard keystrokes with ASCII values between 1 and
255 are stored directly in the environment variable.
Extended keystrokes (for example, function keys and
cursor keys) are stored as a string in decimal format,
with a leading @ (for example, the F1 key is @59).
The Enter key is stored as an extended keystroke, with
the code @28. See Appendix B (page 371) for a list of
the ASCII and extended key codes.
If you press Ctrl-C or Ctrl-Break while INKEY is
waiting for a key, execution of an alias will be
terminated, and execution of a batch file will be
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 259
INKEY
-------------------------------------------------------------------
suspended while you are asked whether to cancel the
batch job (see page 85). In a batch file you can
handle Ctrl-C and Ctrl-Break yourself with the ON
BREAK command (see page 288).
Options: /C(lear buffer): Clears the keyboard buffer before
INKEY accepts keystrokes. If you use this option,
INKEY will ignore any keystrokes which you type,
either accidentally or intentionally, before INKEY is
ready to accept input.
/D(igits only): Prevents INKEY from accepting any
keystroke except a digit from 0 to 9.
/K["keys"]: Specify the permissible keystrokes. The
list of valid keystrokes should be enclosed in double
quotes. For alphabetic keys the validity test is not
case-sensitive. You can specify extended keys by
enclosing their names in square brackets (within the
quotes), for example:
inkey /k"ab[Alt-F10]" Enter A, B, or Alt-F10
%%var
See page 31 for a complete listing of the key names
you can use within the square brackets, and a
description of the key name format.
If an invalid keystroke is entered, the command
processor will echo the keystroke if possible, beep,
move the cursor back one character, and wait for
another keystroke.
/P(assword): Prevents INKEY from echoing the
character.
/W(ait): Timeout period, in seconds, to wait for a
response. If no keystroke is entered by the end of
the timeout period, INKEY returns with the variable
unchanged. You can specify /W0 to return immediately
if there are no keys waiting in the keyboard buffer.
For example, the following batch file fragment waits
up to 10 seconds for a character, then tests to see if
a "Y" was entered:
set net=N
inkey /K"YN" /w10 Load the network (Y/N)? %%net
iff "%net" == "Y" then
rem Commands to load the network go here
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 260
INKEY
-------------------------------------------------------------------
endiff
/X (no carriage return): Prevents INKEY from
displaying a carriage return and line feed after the
user's entry.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 261
INPUT
-------------------------------------------------------------------
INPUT (New)
Purpose: Get a string from the keyboard and save it in an
environment variable.
Format: INPUT [/C /D /E /Ln /N /P /Wn /X] [prompt] %%varname
prompt: Optional text that is displayed as a prompt.
varname: The variable that will hold the user's
input.
/C(lear buffer) /N(o colors)
/D(igits only) /P(assword)
/E(dit) /W(ait)
/L(ength) /X (no carriage return)
See also: INKEY and KEYSTACK.
Usage: INPUT optionally displays a prompt. Then it waits for
a specified time or indefinitely for your entry. It
places any characters you type into an environment
variable. INPUT is normally used in batch files and
aliases to get multi-key input. Along with the INKEY
command, INPUT allows great flexibility in reading
user input from within a batch file or alias.
If prompt text is included in an INPUT command, it is
displayed while INPUT waits for input. Standard
command-line editing keys may be used to edit the
input string as it is entered. If you use the /P
password option, INPUT will echo asterisks instead of
the keys you type.
All characters entered up to, but not including, the
carriage return are stored in the variable.
The following batch file fragment prompts for a string
and stores it in the variable FNAME:
input Enter the file name: %%fname
INPUT reads standard input, so it will accept text
from a re-directed file or from the KEYSTACK.
If you press Ctrl-C or Ctrl-Break while INPUT is
waiting for input, execution of an alias will be
terminated, and execution of a batch file will be
suspended while you are asked whether to cancel the
batch job (see page 85). In a batch file you can
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 262
INPUT
-------------------------------------------------------------------
handle Ctrl-C and Ctrl-Break yourself with the ON
BREAK command (see page 288).
Option: /C(lear buffer): Clears the keyboard buffer before
INPUT accepts keystrokes. If you use this option,
INPUT will ignore any keystrokes which you type,
either accidentally or intentionally, before INPUT is
ready.
/D(igits only): Prevents INPUT from accepting any
keystrokes except digits from 0 to 9.
/E(dit): Allows you to edit an existing value. If
there is no existing value for varname, INPUT proceeds
as if /E had not been used, and allows you to enter a
new value.
/Ln (Length): Sets the maximum number of characters
which INPUT will accept to "n". If you attempt to
enter more than this number of characters, INPUT will
beep and prevent further input (you will still be able
to edit the characters typed before the limit was
reached).
/N(o colors): Disables the use of input colors
defined in the InputColor directive in the .INI file,
and forces INPUT to use the default display colors.
/P(assword): Tells INPUT to echo asterisks, instead
of the characters you type.
/W(ait): Timeout period, in seconds, to wait for a
response. If no keystroke is entered by the end of
the timeout period, INPUT returns with the variable
unchanged. If you enter a key before the timeout
period, INPUT will wait indefinitely for the remainder
of the line. You can specify /W0 to return
immediately if there are no keys waiting in the
keyboard buffer.
/X (no carriage return): Prevents INPUT from
displaying a carriage return and line feed after the
user's entry.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 263
KEYBD
-------------------------------------------------------------------
KEYBD (New)
Purpose: Set the state of the keyboard toggles: Caps Lock, Num
Lock, and Scroll Lock.
Format: KEYBD [/Cn /Nn /Sn]
/C(aps lock) /S(croll lock)
/N(um lock)
n can be 0 to turn off the toggle, or 1 to turn it on.
Usage: Most keyboards have 3 toggle keys, the Caps Lock, Num
Lock, and Scroll Lock. The toggle key status is
usually displayed by three lights at the top right
corner of the keyboard.
This command lets you turn any toggle key on or off.
It is most useful in batch files and aliases if you
want the keys set a particular way before collecting
input from the user.
For example, to turn off the Num Lock and Caps Lock
keys, you can use this command:
c:\> keybd /c0 /n0
If you use the KEYBD command with no switches, it will
display the present state of the toggle keys.
4DOS ## In 4DOS, KEYBD works by performing a BIOS setting.
Some memory resident programs that monitor the
physical keyboard rather than BIOS settings may not
recognize that the state of the toggle keys has
changed after a KEYBD command.
4OS2 ## In OS/2, the toggle key state is different for each
session. Changes made with KEYBD will affect the
session in which the command is executed, but will not
affect other sessions.
4NT ## In Windows NT, the toggle key state is the same for
all sessions. Changes made in one session will affect
all other sessions.
Options: /C(aps lock): Turn the Caps Lock key on or off.
/N(um lock): Turn the Num Lock key on or off.
/S(croll lock): Turn the Scroll Lock key on or off.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 264
[4OS2, 4DOS/NT] KEYS
-------------------------------------------------------------------
KEYS [4OS2, 4DOS/NT] (Enhanced)
Purpose: Enable, disable, or display the history list.
Format: KEYS [ON | OFF | LIST]
See also: HISTORY.
Usage: This command is provided for compatibility with KEYS
command in CMD.EXE, which controls the history list in
OS/2 and Windows NT. The same functions are available
by setting the HistMin directive in the .INI file, and
by using the HISTORY command.
The history list collects the commands you type for
later recall, editing, and viewing. You can view the
contents of the list through the history list window
or by typing any of the following commands:
[c:\] history
[c:\] history /p
[c:\] keys list
The first command displays the entire history list.
The second displays the entire list and pauses at the
end of each full screen. The third command produces
the same output as the first, except that each line is
numbered.
You can disable the collection and storage of commands
in the history list by typing:
[c:\] keys off
You can turn the history back on with the command:
[c:\] keys on
If you issue the KEYS command without any parameters,
4OS2 or 4DOS/NT will show you the current status of
the history list.
4OS2 KEYS also affects the way 4OS2 reads input from the
keyboard. KEYS OFF will force 4OS2 into line input
mode; KEYS ON will return input to the usual character
by character method. See the LineInput directive on
page 140, or the /L option of the SETDOS command on
page 325, for details on line input mode.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 265
[4DOS] KEYSTACK
-------------------------------------------------------------------
KEYSTACK [4DOS] (New)
Purpose: Feed keystrokes to a program or command automatically.
Format: KEYSTACK [/Wn] ["abc"] [keyname] [!] ...
"abc": Literal characters to be placed in the
Keystack.
keyname: Name or code for a key to be placed in the
Keystack.
!: Signal to clear the Keystack and the keyboard
buffer.
/W(ait)
Usage: KEYSTACK takes a series of keystrokes and feeds them
to a program or command as if they were typed at the
keyboard. When the program has used all of the
keystrokes in the keystack buffer, it will begin to
read the keyboard for input, as it normally would.
The KEYSTACK command must be executed before running
the program which is going to receive the keystrokes.
This places the keystrokes into the buffer first, so
the program can find them when it runs.
KEYSTACK will only work if the memory-resident program
KSTACK.COM has been loaded. KSTACK is usually loaded
from the AUTOEXEC.BAT file (see page 86). If KSTACK
is not loaded, the KEYSTACK command will display an
error message. If you are using a multitasking system
such as DESQview or Windows, see your Introduction and
Installation Guide for information on loading KSTACK
within a window.
Characters entered within double quotes ("abc") will
be stored "as is" in the keyboard buffer. The only
items allowed outside double quotes are key names, key
codes, and the ! and /W options.
See page 31 for a complete listing of key names and a
description of the key name format.
An exclamation mark [!] will clear all pending
keystrokes, both in the KEYSTACK buffer and in the
keyboard buffer.
For example, to start ProComm Plus and skip the
opening screen you could use the command:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 266
[4DOS] KEYSTACK
-------------------------------------------------------------------
c:\comm> keystack 32 ^ pcplus
This places a space (ASCII code 32) in the buffer,
then runs ProComm Plus. When ProComm looks for a
keystroke to end the display of the opening screen the
keystroke is already in the buffer, and the opening
screen is removed immediately.
You can store a maximum of 255 characters in the
KEYSTACK buffer. Each time the KEYSTACK command is
executed, it will clear any remaining keystrokes
stored by a previous KEYSTACK command.
You may need to experiment with your programs and
insert delays (see the /W option) to find a keystroke
sequence that works for a particular program.
Programs that bypass DOS and the BIOS for keyboard
input cannot read keystrokes entered with KEYSTACK.
If you use KEYSTACK and then run such a program, the
keystrokes will not appear in the program, but may
appear at the prompt when you exit the program and
return to 4DOS.
## KEYSTACK treats the number 0 as a special case; it is
used with programs that flush the keyboard buffer.
When KEYSTACK processes a key value of 0, it tells the
program the buffer is clear, so subsequent keystrokes
will be accepted normally. Some programs will require
several "0"s before they will accept input; you may
need to experiment to determine the correct number.
For example, the following batch file starts Lotus 1-
2-3 and loads the file specified on the command line
when the batch file is invoked (the KEYSTACK command
should be entered on one line):
pushd c:\123
keystack 0 Enter 0 Enter 0 Enter 0 Enter 0 Enter
"/FR" 0 "%1" Enter
123
popd
The sequence of "0 Enter" pairs tells 1-2-3 that the
keyboard buffer is empty, then passes 1-2-3 a carriage
return, repeating this sequence five times. This gets
1-2-3 to a point where an empty spreadsheet is
displayed. The rest of the KEYSTACK line issues a
File Retrieve command (/FR), simulates an empty
keyboard buffer once more, enters the file name passed
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 267
[4DOS] KEYSTACK
-------------------------------------------------------------------
on the batch command line (%1), and finally enters a
carriage return to end the file name.
## Here's the same command defined as an alias (enter
this on one line):
alias 321 `pushd c:\123 ^ keystack 0 Enter 0
Enter 0 Enter 0 Enter 0 Enter "/FR" 0 "%1" Enter
^ 123 ^ popd`
## KEYSTACK mimics the BIOS by stacking both an ASCII
code and a scan code for each key. It does so by
calculating the code for each character, whether it is
entered as part of a quoted string, as a key name, or
as an ASCII value less than 128. However, if you are
stacking keys for a program which distinguishes
between keys with the same symbol, like the plus on
the keyboard and the gray plus, you will have to
calculate the codes for the keys on the numeric keypad
yourself. Calculate the value ((256 * scan code) +
ASCII code) and enter that numeric value as an
argument for KEYSTACK. For example, for the Enter key
on the numeric keypad, the scan code is 224 and the
ASCII code is 13, so to stack both values use ((256 *
224) + 13) or KEYSTACK 57357. Try this approach if a
"normal" KEYSTACK command does not work (for example,
if you use "KEYSTACK Enter" for the Enter key and the
program doesn't see the correct character). To stack
combined key codes you must use the numeric value, not
the key name. See Appendix B on page 371 for a
complete list of ASCII codes and scan codes.
Options: ## /W(ait): Delay the next keystroke in the KEYSTACK
buffer by a specified number of clock "ticks". A
clock tick is approximately 1/18 second. The number
of clock ticks to delay should be placed immediately
after the W, and must be between 1 and 65535 (65535
ticks is about 1 hour). You can use the /W option as
many times as desired and at any point in the string
of keystrokes except within double quotes. Some
programs may need the delays provided by /W in order
to receive keystrokes properly from KEYSTACK. The
only way to determine what delay is needed is to
experiment. Sometimes a combination of a delay and an
"empty buffer" signal (a 0) are required. For
example, to start the program CADX and send it an F7,
a delay of one second, an indication that the keyboard
buffer is empty, and a carriage return:
c:\> keystack F7 /W18 0 Enter ^ cadx
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 268
[4DOS] LH / LOADHIGH
-------------------------------------------------------------------
LH / LOADHIGH [4DOS] (Compatible)
Purpose: Load a memory resident program into an Upper Memory
Block (UMB).
Format: LH [/L:r1,n1;r2,n2;... /S] filename
or
LOADHIGH [/L:r1,n1;r2,n2;... /S] filename
filename: The name of the program to load into high
memory.
/L(oad region) /S(hrink)
Usage: LH and LOADHIGH are synonyms. You can use either one.
LOADHIGH requires version 5.0 or later of MS-DOS, PC-
DOS, DR DOS, or Novell DOS, or an OS/2 2.x DOS
session.
If you load memory-resident programs into UMBs, you
will have more room in base memory for application
programs. If your system has no UMBs, or if the
program is larger than the largest UMB, then LOADHIGH
will load the program into conventional base memory.
For example, to load the program C:\UTIL\CACHE.EXE
into high memory:
c:\> loadhigh c:\util\cache.exe
If you are running MS-DOS / PC-DOS 5.0 or above, or an
OS/2 2.x DOS session, LOADHIGH requires the DOS=UMB
command in your CONFIG.SYS file. It can only be used
to load programs into UMBs managed by version 5.0 or
later of MS-DOS, PC-DOS, DR DOS, or Novell DOS; or by
OS/2 2.x DOS sessions.
! If you use a memory manager like 386MAX or QEMM to
manage your UMBs, rather than the MS-DOS DOS=UMB
directive, then LOADHIGH will not work, and you must
use the equivalent command supplied with your memory
manager in order to load programs high.
See your 4DOS Introduction and Installation Guide for
complete details on UMBs and UMB regions, and the
hardware and software required to support them.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 269
[4DOS] LH / LOADHIGH
-------------------------------------------------------------------
## The /L and /S switches are designed to aid in
optimizing the use of upper memory by selecting one or
more UMB regions for a particular memory-resident
program to use. They are fully compatible with the
MS-DOS 6.0 and above memory optimizer, MEMMAKER, and
may also be used under MS-DOS 5.0 and in OS/2 2.x DOS
sessions. (They are not used by other memory
optimizers, such as QEMM's OPTIMIZE or 386MAX's
MAXIMIZE.)
While a complete discussion of memory optimization
techniques is well beyond the scope of this manual,
the basic technique is to load each memory-resident
program into a specific region to free up the maximum
possible amount of base memory.
Optimizing UMB usage requires a detailed knowledge of
the memory requirements for your memory-resident
programs. This information can be very difficult to
obtain, because some programs require more memory when
starting and less when running, and each program is
unique. However, if you know these memory
requirements, you may be able to use /L and /S to
optimize the use of upper memory, or to improve on the
optimization done by MEMMAKER or another memory
optimizer.
Options: ## /L:r1,n1;r2,n2;... (Load region): Specifies which
region(s) should be used for the program, and
optionally the minimum free space required in a region
before the program is allowed access to that region.
If /L is not used, all upper memory regions are
available to the program. If /L is used, you must
specify one or more regions (r1, r2, etc.); only those
regions will be made available. Upper memory regions
are numbered sequentially beginning with 1 (region 0
refers to low memory, and is normally used only by
MEMMAKER).
If only a region number is given, the entire region is
made available to the program (assuming there is free
space in the region). If a size is given for a
particular region (n1, n2, etc.), then the region is
only made available if the free space in the region is
equal to or greater than that size. All sizes are in
bytes. Any region not available to a particular
program is "locked out" while that program is loading
and made available again once the program is loaded.
If the combination of /L values you use does not
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 270
[4DOS] LH / LOADHIGH
-------------------------------------------------------------------
provide sufficient upper memory space for the program
to load, it will be loaded in low memory.
You can combine /L values in several ways. In each of
the following examples, if the requested space is not
available or is insufficient the program is loaded
into low memory:
lh /l:2 filename
The program can use region 2 only.
lh /l:2;3 filename
The program can use regions 2 and 3 only.
lh /l:2,2048 filename
The program can use region 2 only, and only
if it has 2048 or more bytes free.
lh /l:2,2048;3 filename
The program can use region 2 if it has 2048
or more bytes free, and region 3 regardless
of how many bytes it has free
## /S(hrink): Shrinks each region selected by /L to the
minimum size used in /L before loading the program.
This prevents memory-resident programs which take all
available memory from using more than you want them
to. This switch is primarily intended for use by
MEMMAKER.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 271
LIST
-------------------------------------------------------------------
LIST (New)
Purpose: Display a file, with forward and backward paging and
scrolling.
Format: LIST [/A[[:][-]rhsda] /H /S /W /X] file...
file: A file or list of files to display.
/A(ttribute select) /W(rap)
/H(igh bit off) /X (heX display mode)
/S(tandard input)
See also: TYPE.
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: LIST provides a much faster and more flexible way to
view a file than TYPE, without the overhead of loading
and using a text editor.
LIST is most often used for displaying ASCII text
files. Most other files contain non-alphabetic
characters and may be unreadable, except in hex mode.
For example, to display a file called MEMO.DOC:
c:\> list memo.doc
LIST uses the cursor pad to scroll through the file.
The following keys have special meanings:
Home Display the first page of the
file.
End Display the last page of the
file.
Esc Exit the current file.
Ctrl-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.
Ctrl-Left Arrow Scroll left 40 columns.
Ctrl-Right Arrow Scroll right 40 columns.
F1 Display online help
B Go back to the previous file in
the current group of files.
F Prompt and search for a string.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 272
LIST
-------------------------------------------------------------------
G Go to a specific line or, in hex
mode, to a specific hexadecimal
offset.
H Toggle the "strip high bit" (/H)
option.
I Display information on the
current file (the full name,
size, date, and time).
N Find next matching string.
P Print the current page or the
entire file.
W Toggle the "line wrap" (/W)
option.
X Toggle the hex-mode display (/X)
option.
Text searches performed with F and N are not case-
sensitive. However, if the display is currently in
hexadecimal mode and you press F, you will be prompted
for whether you want to search in hexadecimal as well.
If you answer Y, you should then enter the search
string as a sequence of 2-digit hexadecimal numbers
separated by spaces, for example 41 63 65 (these are
the ASCII values for the string "Ace"; see Appendix B
on page 371 for a complete list of ASCII codes).
Hexadecimal searches are case-sensitive, and search
for exactly the string you enter.
You can use wildcards in the search string. For
example, you can search for the string "to*day" to
find the next line which contains the word "to"
followed by the word "day" later on the same line, or
search for the numbers "101" or "401" with the search
string "[14]01". See page 59 for complete information
on wildcards.
LIST saves the search string used by F and N, so you
can LIST multiple files and search for the same string
simply by pressing N in each file, or repeat your
search the next time you use LIST.
LIST normally allows long lines in the file to extend
past the right edge of the screen. You can use the
horizontal scrolling keys (see above) to view text
that extends beyond the screen width. If you use the
W command or /W switch to wrap the display, each line
is wrapped when it reaches the right edge of the
screen, and the horizontal scrolling keys are
disabled.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 273
LIST
-------------------------------------------------------------------
If you print the file which LIST is displaying, you
will be asked whether you wish to print the entire
file or the current display page. The print format
will match the display format. If you have switched
to hexadecimal or wrapped mode, that mode will be used
for the printed output as well. If you print in
wrapped mode, long lines will be wrapped at the width
of the display. If you print in normal display mode
without line wrap, long lines will be wrapped or
truncated by the printer, not by LIST.
Printed output normally goes to device LPT1. If you
wish to send the printed output to another device, use
the Printer directive in the .INI file (see page 141).
## Most of the LIST keystrokes can be reassigned with
.INI file directives (see pages 143 and 147).
## You can set the colors used by LIST with the
ListColors and ListStatBarColors directives in the
.INI file. If ListColors is not used, the LIST
display will use the current default colors. If
ListStatBarColors is not used, the status bar will use
the reverse of the LIST display colors.
4DOS ## LIST normally writes text directly to the screen. If
you have an unusual display adapter which does not
support direct video output, see the OutputBIOS
directive on page 150.
Options: ## /A(ttribute select): Select only those files that have
the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will select
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., LIST /A
...), LIST will select all files and subdirectories
including hidden and system files. If attributes are
combined, all the specified attributes must match for
a file to be selected. For example, /A:RHS will
select only those files with all three attributes set.
See page 18 for more information on file attributes.
## /H(igh bit off): Strip the high bit from each
character before displaying. This is useful when
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 274
LIST
-------------------------------------------------------------------
displaying files created by some word processors that
turn on the high bit for formatting purposes. You can
toggle this option on and off from within LIST with
the H key.
/S(tandard input): Read from standard input rather
than a file. This allows you to redirect command
output and view it with LIST. For example, to use
LIST to display the output of DIR:
c:\> dir | list /s
/W(rap): Wrap the text at the right edge of the
screen. This option is useful when displaying files
that don't have a carriage return at the end of each
line. The horizontal scrolling keys do not work when
the display is wrapped. You can toggle this option on
and off from within LIST with the W key.
/X (hex mode): Display the file in hexadecimal (hex)
mode. This option is useful when displaying
executable files and other files that contain non-text
characters. Each byte of the file is shown as a pair
of hex characters. The corresponding text is
displayed to the right of each line of hexadecimal
data. You can toggle this mode on and off from within
LIST with the X key.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 275
LOADBTM
-------------------------------------------------------------------
LOADBTM (New)
Purpose: Switch a batch file to or from BTM mode.
Format: LOADBTM [ON | OFF]
Usage: 4DOS, 4OS2, and 4DOS/NT recognize two kinds of batch
files: .BAT or .CMD, and .BTM. Batch files executing
in BTM mode run two to five times faster than in BAT
or CMD mode. (However, BTM mode should not be used to
load memory-resident programs in DOS, nor should BTM
mode be used for self-modifying batch files.) Batch
files automatically start in the mode indicated by
their extension. For more information on .BTM, .BAT,
and .CMD files, see page 80.
The LOADBTM command turns BTM mode on and off. It can
be used to switch modes in either a .BAT .CMD or /
.BTM file. If you use LOADBTM with no argument, it
will display the current batch mode: LOADBTM ON or
LOADBTM OFF.
LOADBTM can only be used within a batch file. It is
most often used to switch a .BAT file into BTM mode
after memory-resident programs are loaded, to convert
a .BAT or .CMD file to BTM mode without changing its
extension, or to switch a .BTM file into BAT mode in
order to load memory-resident programs under DOS.
Using LOADBTM to repeatedly switch modes within a
batch file is not efficient. In most cases the speed
gained by running some parts of the file in BTM mode
will be more than offset by the speed lost through
repeated loading of the file each time BTM mode is
invoked.
The following .BAT file fragment loads some memory
resident programs (TSRs), and then switches to BTM
mode:
rem Because this file has a .BAT extension,
rem the initial default state is LOADBTM OFF
rem Loading TSRs...
ansi.com
mouse.com
rem Switch to high-speed (BTM) mode now that
rem TSRs are loaded
loadbtm on
path c:\;c:\util;c:\dos
alias /r c:\aliases
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 276
LOG
-------------------------------------------------------------------
LOG (New)
Purpose: Save a log of commands to a disk file.
Format: LOG [/H /W file] [ON | OFF | text]
file: The name of the file to hold the log.
text: An optional message that will be added to the
log.
/H(istory log) /W(rite to).
See also: HISTORY.
Usage: LOG keeps a record of all internal and external
commands you use. Each entry includes the current
system date and time, along with the actual command
after any alias or variable expansion (see page 121
for more information on alias and variable expansion).
You can use the log file as a record of your daily
activities.
LOG with the /H option keeps a similar record, but it
does not record the date and time for each command.
In addition, it records commands before aliases and
variables are expanded.
By default, LOG writes to the file 4DOSLOG, 4OS2LOG,
or 4NTLOG (depending on which command processor you
are using), in the root directory of the boot drive.
The corresponding default file names for LOG /H are
4DOSHLOG, 4OS2HLOG, and 4NTHLOG.
Entering LOG or LOG /H with no parameters displays the
name of the log file and the log status (ON or OFF):
c:\> log
LOG (C:\4DOSLOG) is OFF
To enable or disable logging, add the word "ON" or
"OFF" after the LOG command:
c:\> log on
or
c:\> log /h on
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 277
LOG
-------------------------------------------------------------------
Entering LOG or LOG /H with text writes a message to
the log file, even if logging is set OFF. This
allows you to enter headers in the log file:
c:\> log "Started work on the database system"
The LOG file format looks like this:
[mm-dd-yy hh:mm:ss] command
The LOG /H output can be used as the basis for writing
batch files. Start LOG /H, then execute the commands
that you want the batch file to execute. When you are
finished, turn LOG /H off. The resulting file can be
turned into a batch file that performs the same
commands with little or no editing.
You can have both a regular log (with time and date
stamping) and a history log (without the time stamps)
enabled simultaneously.
Options: /H(istory log): This option turns on (or off) the
history log, which saves commands without the time and
date stamp. For example, to turn on history logging
and write to the file C:\LOG\HLOG:
c:\> log /h /w c:\log\hlog
/W(rite): This switch specifies a different filename
for the LOG or LOG /H output. It also automatically
performs a LOG ON command. For example, to turn
logging on and write the log to C:\LOG\LOGFILE:
c:\> log /w c:\log\logfile
Once you select a new file name with the LOG /W or LOG
/H/W command, LOG will use that file until you issue
another LOG /W or LOG /H/W command, or until you
reboot your computer. Turning LOG or LOG /H off or on
does not change the file name. You can set the
default log file names when your command processor
starts with the LogName and HistLogName directives in
the .INI file.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 278
MD / MKDIR
-------------------------------------------------------------------
MD / MKDIR (Enhanced)
Purpose: Create a subdirectory.
Format: MD [/S] pathname...
or
MKDIR [/S] pathname...
pathname: The name of one or more directories to
create.
/S(ubdirectories)
See also: RD.
Usage: MD and MKDIR are synonyms. You can use either one.
MD creates a subdirectory anywhere in the directory
tree. To create a subdirectory from the root, start
the pathname with a backslash [\]. For example, this
command creates a subdirectory called MYDIR in the
root directory:
c:\> md \mydir
If no path is given, the new subdirectory is created
in the current directory. This example creates a
subdirectory called DIRTWO in the current directory:
c:\mydir> md dirtwo
To create a directory from the parent of the current
directory (that is, to create a sibling of the current
directory), start the pathname with two periods and a
backslash [..\].
The operating system limits the permissible length of
the full subdirectory name. See page 16 for details.
Option: /S(ubdirectories): MD creates one directory at a time
unless you use the /S option. If you need to create
the directory C:\ONE\TWO\THREE and none of the named
directories exist, you can use /S to have MD create
all of the necessary subdirectories for you in a
single command:
c:\> md /s \one\two\three
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 279
MEMORY
-------------------------------------------------------------------
MEMORY (New)
Purpose: Display the amount and status of system RAM.
Format: MEMORY
Usage: MEMORY displays information about the RAM in your
system.
4DOS In 4DOS, MEMORY lists the amount of total RAM in your
system and the amount available for applications after
DOS, 4DOS, and memory-resident programs have been
laoded; the amount of EMS expanded memory, XMS
extended memory, and non-XMS extended memory; the HMA
status; and the amount of memory 4DOS is using for
environment variable space, alias space, and history
: space
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 (HMA in use)
512 bytes total environment
195 bytes free
1,024 bytes total alias
452 bytes free
1,024 bytes total history
You can use the information from the MEMORY display to
fine tune your system, to aid in setting the proper
alias and environment sizes in 4DOS.INI, and to be
sure that you have sufficient memory for your largest
applications.
If you compare the free RAM displayed by MEMORY with
the free RAM displayed by CHKDSK and some memory map
programs, MEMORY will usually show a slightly higher
value. The difference is the size of the environment
passed to these external programs; most memory mapping
programs do not count the passed environment as free
space, but MEMORY does.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 280
MEMORY
-------------------------------------------------------------------
The MEMORY command displays for 4OS2 and 4DOS/NT are
somewhat different to reflect the way in which OS/2
and Windows NT organize the computer's memory.
4OS2 A typical MEMORY display using 4OS2 is shown below:
16,379,904 bytes total physical RAM
40,546,048 bytes total resident RAM
5,050,368 bytes largest free block
3,145,728 bytes total swap file
4,096 bytes total environment
2,451 bytes free
4,096 bytes total alias
1,910 bytes free
1,024 bytes total history
4NT A typical MEMORY display using 4DOS/NT is shown below:
21 % Memory load
16,449,536 bytes total physical RAM
3,665,920 bytes available physical RAM
37,715,968 bytes total page file
19,038,208 bytes available page file
4,096 bytes total environment
3,192 bytes free
32,768 bytes total alias
32,767 bytes free
1,024 bytes total history
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 281
MOVE
-------------------------------------------------------------------
MOVE (New)
Purpose: Move files to a new directory and drive.
Format: MOVE [/A[[:][-]rhsda] /C /D /F /H /M /N /P /Q /R /S
/T /U /V] source... destination
source: A file or list of files to move.
destination: The new location for the files.
/A(ttribute select) /P(rompt)
/C(hanged) /Q(uiet)
/D(irectory) /R(eplace)
/F(orce delete) /S(ubdirectory tree)
/H(idden and system) /T(otal)
/M(odified files) /U(pdate)
/N(othing) /V(erify)
See also: COPY and RENAME.
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67). Date,
time, or size ranges anywhere on the line apply to all
source files.
Usage: The MOVE command moves one or more files from one
directory to another, whether the directories are on
the same drive or not. It has the same effect as
copying the files to a new location and then deleting
the originals. Like COPY and RENAME, MOVE works with
single files, multiple files, and sets of files
specified with an include list.
The simplest MOVE command moves a single source file
to a new location and, optionally, gives it a new
name. These two examples both move one file from
drive C: to the root directory on drive A:
c:\> move myfile.dat a:\
c:\> move myfile.dat a:\savefile.dat
In both cases, MYFILE.DAT is removed from drive C:
after it has been copied to drive A:. If a file
called MYFILE.DAT in the first example, or
SAVEFILE.DAT in the second example, already existed on
drive A:, it would be overwritten. (This demonstrates
the difference between MOVE and RENAME. MOVE will
move files between drives and will overwrite the
destination file if it exists; RENAME will not.)
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 282
MOVE
-------------------------------------------------------------------
If you MOVE multiple files, the destination must be a
directory name. MOVE will move each file into the
destination directory with its original name (if the
target is not a directory, MOVE will display an error
message and exit):
c:\> move *.wks *.txt c:\finance\myfiles
You cannot move a file to a character device like the
printer, or to itself.
When you move files to another directory, if you add a
backslash [\] to the end of the destination name MOVE
will display an error message if the name does not
refer to an existing directory. You can use this
feature to keep MOVE from treating a mistyped
destination directory name as a file name, and
attempting to move all source files to that name. The
/D option performs the same function but will also
prompt to see if you want to create the destination
directory if it doesn't exist.
! Be careful when you use MOVE with the SELECT command.
If you SELECT multiple files and the target is not a
directory (for example, because of a misspelling),
MOVE will assume it is a file name. In this case each
file will be moved in turn to the target file,
overwriting the previous file, and then the original
will be erased before the next file is moved. At the
end of the command, all of the original files will
have been erased and only the last file will exist as
the target file. You can avoid this problem by using
square brackets with SELECT instead of parentheses (be
sure that you don't allow the command line to get too
long - watch the character count in the upper left
corner while you're selecting files). MOVE will then
receive one list of files to move instead of a series
of individual filenames, and it will detect the error
and halt. You can also add a backslash [\] to the end
of the destination name to ensure that it is the name
of a subdirectory (see above).
## MOVE first attempts to rename the file(s), which is
the fastest way to move files between subdirectories
on the same drive. If that fails (the destination is
on a different drive or already exists), MOVE will
copy the file(s) and then delete the originals.
## If you are using 4DOS in an OS/2 DOS session, MOVE
will copy OS/2 extended attributes from the source to
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 283
MOVE
-------------------------------------------------------------------
the destination, provided the file system on the
destination drive supports them.
## If MOVE must physically copy the files and delete the
originals, rather than renaming them (see above), then
some disk space may be freed on the source drive. The
free space may be the result of moving the files to
another drive, or of overwriting a larger destination
file with a smaller source file. MOVE displays the
amount of disk space recovered unless the /Q option is
used (see below). It does so by comparing the amount
of free disk space before and after the MOVE command
is executed. However, this amount may be incorrect if
you are using a deletion tracking system which stores
deleted files in a hidden directory, or if, under a
multitasking system, another program performs a file
operation while the MOVE command is executed.
## When physically copying files, MOVE preserves the
hidden, system, and read-only attributes of the source
files, and sets the archive attribute of the
destination files. However, if the files can be
renamed, and no copying is required, then the source
file attributes are not changed.
4NT ## If you MOVE files with long filenames from an NTFS
volume to a FAT volume, 4DOS/NT will now store the
destination files with their short, FAT-compatible
names when running under Windows NT 3.1 (long names
are used under Windows NT 3.5 and above; see page 18
for additional details). You can view the short names
before executing the MOVE with the DIR /X command.
Options: ## /A(ttribute select): Select only those files that have
the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will select
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., MOVE /A
...), MOVE will select all files and subdirectories
including hidden and system files. If attributes are
combined, all the specified attributes must match for
a file to be selected. For example, /A:RHS will
select only those files with all three attributes set.
See page 18 for more information on file attributes.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 284
MOVE
-------------------------------------------------------------------
/C(hanged files): Move files only if the destination
file exists and is older than the source (see also
/U). This option is useful for updating the files in
one directory from those in another without moving any
newly-created files.
/D(irectory): Requires that the destination be a
directory. If the destination does not exist, MOVE
will prompt to see if you want to create it. If the
destination exists as a file, MOVE will fail with an
"Access denied" error. Use this option to avoid
having MOVE accidentally interpret your destination
name as a file name when it's really a mistyped
directory name.
## /F(orce delete): This option is only for use in the
32-bit version of 4OS2, and in 4DOS when running in an
OS/2 2.1 or later DOS session. It forces deletion of
the source file without saving it to the DELDIR
directory (if DELDIR is not in use, /F has no effect).
## /H(idden): Move all files, including hidden and
system files.
/M(odified files): Move only files that have the
archive bit set. The archive bit will remain set
after the MOVE; to clear it use ATTRIB (page 173).
/N(othing): Do everything except actually move the
file(s). This option is most useful for testing what
a complex MOVE command will do.
/P(rompt): Prompt the user to confirm each move.
Your options at the prompt are explained in detail on
page 50.
/Q(uiet): Don't display filenames, the total number
of files moved, or the amount of disk space recovered,
if any. This option is most often used in batch
files. See also /T.
/R(eplace): Prompt for a Y or N response before
overwriting an existing destination file.
/S(ubdirectories): Move an entire subdirectory tree
to another location. MOVE will attempt to create the
destination directories if they don't exist, and will
remove empty subdirectories after the move. When /D
is used with /S, you will be prompted if the first
destination directory does not exist, but
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 285
MOVE
-------------------------------------------------------------------
subdirectories below that will be created
automatically by MOVE. If you attempt to use /S to
move a subdirectory tree into part of itself, MOVE
will display an error message and halt.
/T(otal): Don't display filenames as they are moved,
but display the total number of files deleted and the
amount of free disk space recovered, if any.
/U(pdate): Move each source file only if it is newer
than a matching destination file or if a matching
destination file does not exist (also see /C). This
option is useful for moving new or changed files from
one directory to another.
## /V(erify): Verify each disk write. This is the same
as executing the VERIFY ON command, but is only active
during the MOVE. /V does not read back the file and
compare its contents with what was written; it only
verifies that the data written to disk is physically
readable.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 286
[4DOS/NT] MSGBOX
-------------------------------------------------------------------
MSGBOX [4DOS/NT] (New)
Purpose: Display a message box and collect the user's response.
Format: MSGBOX OK | OKCANCEL | YESNO | YESNOCANCEL ["title"]
prompt
title: Text for the title bar of the message box.
prompt: Text that will appear inside the message box.
Usage: MSGBOX can display one of 4 kinds of message boxes and
wait for the user's response. You can use title and
prompt to display any text you wish. 4DOS/NT
automatically sizes and locates the box on the screen.
The message box may have 1, 2, or 3 response buttons.
The command MSGBOX OK creates a single-button box; the
user must simply acknowledge the prompt text.
The OKCANCEL and YESNO forms have 2 buttons each. The
YESNOCANCEL form has 3 buttons. The button the user
chooses is returned in the 4DOS/NT variable %_?. Be
sure to save the return value in another variable or
test it immediately; the value of %_? changes with
every internal command.
The following list shows the value returned for each
possible selection:
Yes 10 No 11
OK 10 Cancel 12
If you exit the message box without selecting one of
these options (for example, some message boxes allow
you to exit by pressing Esc or double-clicking the
close button), MSGBOX will set %_? to 0. If there is
an error in the MSGBOX command itself, %_? will be set
as described on page 102.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 287
ON
-------------------------------------------------------------------
ON (New)
Purpose: Execute a command in a batch file when a specific
condition occurs.
Format: ON BREAK [command]
or
ON ERROR [command]
Usage: ON can only by used in batch files.
ON sets a "watchdog" that remains in effect for the
duration of the current batch file. Whenever a BREAK
or ERROR condition occurs after ON has been executed,
the command is automatically executed.
ON BREAK will execute its command if the user presses
Ctrl-C or Ctrl-Break.
ON ERROR will execute its command after any command
processor or operating system error (including
critical errors; see page 51). That is, ON ERROR will
detect errors such as a disk write error, and 4DOS,
4OS2, or 4DOS/NT errors such as a COPY command that
fails to copy any files, or the use of an unacceptable
command option.
ON BREAK and ON ERROR are independent of each other.
You can use either one, or both, in any batch file.
Each time ON BREAK or ON ERROR is used, it defines a
new command to be executed for a break or error, and
any old command is discarded. If you use ON BREAK or
ON ERROR with no following command, that type of error
handling is disabled. Error handling is also
automatically disabled when the batch file exits.
ON BREAK and ON ERROR only affect the current batch
file. If you CALL another batch file, the first batch
file's error handling is suspended, and the CALLed
file must define its own error handling. When control
returns to the first batch file, its error handling is
reactivated.
The command can be any command that can be used on a
batch file line by itself. Frequently, it is a GOTO
or GOSUB command. For example, the following fragment
traps any user attempt to end the batch file by
pressing Ctrl-C or Ctrl-Break. It scolds the user for
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 288
ON
-------------------------------------------------------------------
trying to end the batch file and then continues
displaying the numbers from 1 to 1000:
on break gosub gotabreak
do i = 1 to 1000
echo %i
enddo
quit
:gotabreak
echo Hey! Stop that!!
return
You can use a command group (see page 71) as the
command if you want to execute multiple commands, for
example:
on break (echo Oops, got a break!^quit)
ON BREAK and ON ERROR always assume that you want to
continue executing the batch file. After the command
is executed, control automatically returns to the next
command in the batch file (the command after the one
that was interrupted by the break or error). The only
way to avoid continuing the batch file after a break
or error is for the command to transfer control to
another point with GOTO, end the batch file with QUIT
or CANCEL, or start another batch file (without
CALLing it).
When handling an error condition with ON ERROR, you
may find it useful to use internal variables (see page
100), particularly %_? and %_SYSERR, to help determine
the cause of the error.
! If a break or error occurs while the command specified
in ON BREAK or ON ERROR is executing, the command will
be restarted. This means you must use caution to
avoid or handle any possible errors in the commands
invoked by ON ERROR, since such errors can cause an
infinite loop and/or a stack overflow condition.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 289
PATH
-------------------------------------------------------------------
PATH (Enhanced)
Purpose: Display or alter the list of directories that 4DOS,
4OS2, or 4DOS/NT will search for executable files,
batch files, and files with executable extensions that
are not in the current directory.
Format: PATH [directory[;directory...]]
directory: The full name of a directory to include in
the path setting.
See also: ESET and SET.
Usage: When the command processor is asked to execute an
external command (a .COM, .EXE, .BTM, .BAT, or .CMD
file or executable extension), it first looks for the
file in the current directory. If it fails to find an
executable file there, it then searches each of the
directories specified in the PATH setting. See page
20 for more details on how the path is searched.
For example, after the following PATH command, the
command processor will search for an executable file
in four directories: the current directory, then the
root directory on drive C, then the DOS subdirectory
on C, and then the UTIL subdirectory on C:
c:\> path c:\;c:\dos;c:\util
The list of directories to search can be set or viewed
with the PATH command. The list is stored as an
environment string, and can also be set or viewed with
SET, and edited with ESET.
Directory names in the path must be separated by
semicolons [;]. Each directory name is shifted to
upper case to maintain compatibility with programs
which can only recognize upper case directory names in
the path. If you modify your path with the SET or
ESET command, you may include directory names in lower
case. These may cause trouble with some programs,
which assume that all path entries have been shifted
to upper case.
If you enter PATH with no parameters, the current path
is displayed:
c:\> path
PATH=C:\;C:\DOS;C:\UTIL
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 290
PATH
-------------------------------------------------------------------
Entering PATH and a semicolon clears the search path
so that only the current directory is searched for
executable files (this is the default at system
startup).
Some applications also use the PATH to search for
their data files.
## If you include an explicit file extension on a command
name (for example, WP.EXE), the search will find files
with that name and extension in the current directory
and every directory in the path. It will not locate
other executable files with the same base name.
## If you have an entry in the path which consists of a
single period [.], the current directory will not be
searched first, but instead will be searched when the
command processor reaches the "." in the path. This
allows you to delay the search of the current
directory for executable files and files with
executable extensions. In rare cases, this feature
may not be compatible with applications which use the
path to find their files; if you experience a problem,
you will have to remove the "." from the path while
using any such application.
4DOS ## In normal use, 4DOS can create a path as long as 250
characters (the command-line limit is 255 characters,
and "PATH " takes five). However, some DOS
applications expect a path no longer than the
traditional limit of 123 characters. If you extend
your path beyond this limit and experience problems
with application programs, see Appendix A of the 4DOS
Introduction and Installation Guide for tips on
resolving the difficulty.
## To create a path longer than the command-line length
limit, use PATH repeatedly to append additional
directories to the path:
path [first list of directories]
path %path;[second list of directories]
...
You cannot use this method to extend the path beyond
506 characters in 4DOS or 2042 characters in 4OS2 and
4DOS/NT (the internal buffer limits, with room for
"PATH"). It is usually more efficient to use aliases
to load application programs than to create a long
PATH. See ALIAS on page 161 for details.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 291
PATH
-------------------------------------------------------------------
If you specify an invalid directory in the path, it
will be skipped and the search will continue with the
next directory in the path.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 292
PAUSE
-------------------------------------------------------------------
PAUSE (Enhanced)
Purpose: Suspend batch file or alias execution.
Format: PAUSE [text]
text: The message to be displayed as a user prompt.
Usage: A PAUSE command will suspend execution of a batch file
or alias, giving you the opportunity to change disks,
turn on the printer, etc.
PAUSE waits for any key to be pressed and then
continues execution. You can specify the text that
PAUSE displays while it waits for a keystroke, or let
4DOS use the default message:
Press any key when ready...
For example, the following batch file fragment prompts
the user before erasing files (the PAUSE command
should be entered on one line):
pause Press Ctrl-C to abort, any other key to
erase all .LST files
erase *.lst
If you press Ctrl-C or Ctrl-Break while PAUSE is
waiting for a key, execution of an alias will be
terminated, and execution of a batch file will be
suspended while you are asked whether to cancel the
batch job (see page 85). In a batch file you can
handle Ctrl-C and Ctrl-Break yourself with the ON
BREAK command (see page 288).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 293
POPD
-------------------------------------------------------------------
POPD (New)
Purpose: Return to the disk drive and directory at the top of
the directory stack.
Format: POPD [*]
See also: DIRS and PUSHD.
Usage: Each time you use the PUSHD command, it saves the
current disk drive and directory on the internal
directory stack. POPD restores the last drive and
directory that was saved with PUSHD and removes that
entry from the stack. You can use these commands
together to change directories, perform some work, and
return to the starting drive and directory.
Directory changes made with POPD are recorded for
display in the directory history window (see page 45).
This example saves and changes the current disk drive
and directory with PUSHD, and then restores it. The
current directory is shown in the prompt:
c:\> pushd d:\database\test
d:\database\test> pushd c:\wordp\memos
c:\wordp\memos> pushd a:\123
a:\123> popd
c:\wordp\memos> popd
d:\database\test> popd
c:\>
You can use the DIRS command to see the complete list
of saved drives and directories (the directory stack).
The POPD command followed by an asterisk [*] clears
the directory stack without changing the current drive
and directory.
## If the directory on the top of the stack is not on the
current drive, POPD will switch to the drive and
directory on the top of the stack without changing the
default directory on the current drive.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 294
PROMPT
-------------------------------------------------------------------
PROMPT (Enhanced)
Purpose: Change the command-line prompt.
Format: PROMPT [text]
text: Text to be used as the new command-line prompt.
Usage: You can change and customize the command-line prompt
at any time. The prompt can include normal text, and
system information such as the current drive and
directory, the time and date, and the amount of memory
available. You can create an informal "Hello, Bob!"
prompt or an official-looking prompt full of
impressive information.
The prompt text can contain special commands in the
form $?, where ? is one of the characters listed
below:
b The vertical bar character [|].
c The open parenthesis [(].
d Current date, in the format: Fri Jan 7,
1994.
D Current date, in the format: Fri 1-07-94
(the month, day, and year are formatted
according to your current country settings).
e The ASCII ESC character (decimal 27).
f The close parenthesis [)].
g The > character.
h Backspace over the previous character.
i Display the OS/2 prompt header line, which
reminds you of how to return to the OS/2
desktop, or get help.
l The < character.
m Time in hours and minutes using 24-hour
format.
M Time in hours and minutes using the default
country format and retaining "a" or "p",
e.g. 4:07p.
n Current drive letter.
p Current drive and directory (lower case).
P Current drive and directory (upper case).
q The = character.
r The numeric exit code of the last external
command.
s The space character.
t Current 24-hour time, in the format
hh:mm:ss.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 295
PROMPT
-------------------------------------------------------------------
T Current 12-hour time, in the format
hh:mm:ss[a|p].
v Operating system version number, in the
format 3.10.
xd: Current directory on drive d:, in lower
case. (Uses the actual case of the
directory name as stored on the disk for
HPFS and NTFS drives, and FAT drives under
Windows NT 3.5 and above; see page 17 for
details).
Xd: Current directory on drive d:, in upper
case.
z Current shell nesting level; the primary
command processor is shell 0.
$ The $ character.
_ CR/LF (go to beginning of a new line).
For example, to set the prompt to the current date and
time, with a ">" at the end:
c:\> prompt $d $t $g
Fri Dec 3, 1993 10:29:19 >
To set the prompt to the current date and time,
followed by the current drive and directory in upper
case on the next line, with a ">" at the end:
c:\> prompt $d $t$_$P$g
Fri Dec 3, 1993 10:29:19
C:\>
Under DOS, you can include the PROMPT command in your
AUTOEXEC.BAT file to set the prompt whenever your
system is rebooted. The 4OS2 prompt can be set in
CONFIG.SYS (see below), and the prompt for any command
processor can be set in 4START (see page 85), or in
any batch file that runs when the command processor
starts.
4DOS The default prompt is $n$g (drive name plus ">") on
drives A and B, and $p$g (current drive and directory
plus ">") on all other drives. If you use 4DOS under
OS/2, the SET PROMPT statement in the OS/2 CONFIG.SYS
file (see next paragraph) will override the default
4DOS prompt. You must delete this statement if you
want to use the default prompt.
4OS2 The 4OS2 default prompt is [$n] (drive name in square
brackets) on floppy drives, and [$p] (current drive
and directory in square brackets) on all other drives.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 296
PROMPT
-------------------------------------------------------------------
When OS/2 is installed, it inserts a SET PROMPT
statement in CONFIG.SYS to set the prompt to $i[$p].
This prompt will override the 4OS2 defaults. The $i
adds a header line to the default prompt to remind you
of certain OS/2 keystrokes. You must delete this
statement if you want to use the default prompt.
4NT The 4DOS/NT default prompt is [$n] (drive name in
square brackets) on floppy drives, and [$p] (current
drive and directory in square brackets) on all other
drives.
If you enter PROMPT with no arguments, the prompt will
be reset to its default value. The PROMPT command
sets the environment variable PROMPT, so to view the
current prompt setting use the command:
c:\> set prompt
(If the prompt is not set at all, the PROMPT
environment variable will not be used, in which case
the SET command above will give a "Not in environment"
error.)
## Along with literal text, special characters, and ANSI
sequences (under DOS and OS/2), you can include the
text of any environment variable, internal variable,
or variable function (see pages 100 and 108) in a
prompt. For example, if you want to include the
amount of free memory in the command prompt, plus the
current drive and directory, you could use this
command:
c:\> prompt (%%@dosmem[K]K) $p$g
(601K) c:\data>
Notice that the @DOSMEM function is shown with two
leading percent signs [%]. If you used only one
percent sign, the @DOSMEM function would be expanded
once when the PROMPT command was executed, instead of
every time the prompt is displayed. As a result, the
amount of memory would never change from the value it
had when you entered the PROMPT command. You can also
use back-quotes to delay expanding the variable
function until the prompt is displayed:
c:\> prompt `(%@dosmem[K]K) $p$g`
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 297
PROMPT
-------------------------------------------------------------------
4DOS, ## If you have an ANSI-compatible driver installed
4OS2 under 4DOS, or are running 4OS2, you can include ANSI
escape sequences in the PROMPT text. See your online
help for complete details on ANSI. This example uses
ANSI sequences to set a prompt that displays the shell
level, date, time and path in color on the top line of
the screen (enter the command 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
4NT You cannot use ANSI escape sequences in your prompt in
4DOS/NT, because Windows NT does not provide ANSI
support.
## A few older batch files use the PROMPT command to
transmit ANSI.SYS control sequences to the screen (for
example, to redefine function keys). This technique
will not work with 4DOS and 4OS2, because they don'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 and 4OS2,
use the ECHO command, substituting an escape character
followed by an e for $e in the PROMPT string (see page
73 for more information on the escape character).
## You may find it helpful to define a different prompt
in secondary shells, perhaps including $z in the
prompt to display the shell level. To do so, place a
PROMPT command in your 4START file and use IF or IFF
statements to set the appropriate prompt for different
shells (for an example, see page 108).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 298
PUSHD
-------------------------------------------------------------------
PUSHD (New)
Purpose: Save the current disk drive and directory, optionally
changing to a new drive and directory.
Format: PUSHD [pathname]
pathname: The name of the new default drive and
directory.
See also: DIRS, POPD and Directory Changes on page
. 44
Usage: PUSHD saves the current drive and directory on a "last
in, first out" directory stack. The POPD command
returns to the last drive and directory that was saved
by PUSHD. You can use these commands together to
change directories, perform some work, and return to
the starting drive and directory. The DIRS command
displays the contents of the directory stack.
To save the current drive and directory, without
changing directories, use the PUSHD command by itself,
with no pathname.
If a pathname is specified as part of the PUSHD
command, the current drive and directory are saved and
PUSHD changes to the specified drive and directory.
If the pathname includes a drive letter, PUSHD changes
to the specified directory on the new drive without
changing the current directory on the original drive.
This example saves the current directory and changes
to C:\WORDP\MEMOS, then returns to the original
directory:
c:\> pushd \wordp\memos
c:\wordp\memos> popd
c:\>
Directory changes made with PUSHD are recorded for
display in the directory history window (see page 45).
## The directory stack can hold up to 255 characters, or
about 10 to 20 entries (depending on the length of the
names). If you exceed this limit, the oldest entry is
removed before adding a new entry.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 299
PUSHD
-------------------------------------------------------------------
## If PUSHD can't change directly to the specified
directory, it will look for the CDPATH variable. See
page 44 for details on CDPATH.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 300
QUIT
-------------------------------------------------------------------
QUIT (New)
Purpose: Terminate the current batch file.
Format: [value] QUIT
value: The exit code from 0 to 255 to return to the
command processor or to the previous batch file.
See also: CANCEL.
Usage: QUIT provides a simple way to exit a batch file before
reaching the end of the file. If you QUIT a batch
file called from another batch file, you will be
returned to the previous file at the line following
the original CALL.
This example batch file fragment checks to see if the
user entered "quit" and exits if true.
input Enter your choice : %%option
if "%option" == "quit" quit
QUIT only ends the current batch file. To end all
batch file processing, use the CANCEL command.
## If you specify a value, QUIT will set the ERRORLEVEL
or exit code (see the IF command, and the %? variable
on page 102) to that value.
## You can also use QUIT to terminate an alias. If you
QUIT an alias while inside a batch file, QUIT will end
both the alias and the batch file and return you to
the command prompt or to the calling batch file.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 301
RD / RMDIR
-------------------------------------------------------------------
RD / RMDIR (Enhanced)
Purpose: Remove one or more subdirectories.
Format: RD [/S] pathname...
or
RMDIR [/S] pathname...
pathname: The name of a subdirectory to remove.
4NT /S(ubdirectories)
See also: MD.
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: RD and RMDIR are synonyms. You can use either one.
RD removes directories from the directory tree. For
example, to remove the subdirectory MEMOS from the
subdirectory WP, you can use this command:
c:\> rd \wp\memos
Before using RD, you must delete all files and
subdirectories (and their files) in the pathname you
want to remove. Remember to remove hidden and read-
only files as well as normal files (you can use DEL /Z
to delete hidden and read-only files).
You can use wildcards in the pathname.
## You cannot remove the root directory, the current
directory (.), any directory above the current
directory in the directory tree, or any directory in
use by another process in a multitasking system.
Options: /S(ubdirectories): This option is included only for
compatibility with Windows NT's CMD.EXE, and should be
4NT ! ## used with EXTREME CAUTION! It deletes all files
(including hidden and system files) in the named
directory and all of its subdirectories, then removes
all empty subdirectories. This option does not prompt
for permission before deleting files and
subdirectories, and can potentially erase all files on
a drive with a single command.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 302
REBOOT
-------------------------------------------------------------------
REBOOT (New)
Purpose: Do a warm or cold system reboot.
Format: REBOOT [/C /L /S /V]
/C(old reboot) /S(hutdown)
/L(ogoff) /V(erify)
## Usage: REBOOT will completely restart your computer. It
normally performs a warm reboot, which is comparable
to pressing Ctrl-Alt-Delete under DOS or OS/2, or to a
shutdown and restart under Windows NT. Under DOS,
REBOOT can also perform a cold reboot, which is
comparable to turning the power off and back on or
pressing the reset button. A reboot is necessary to
activate any changes to your CONFIG.SYS file in DOS
and OS/2, and may also be used if you wish to restart
DOS with an altered 4START or AUTOEXEC.BAT file.
The following example prompts you to verify the
reboot, then does a warm boot:
c:\> reboot /v
REBOOT defaults to performing a warm boot, with no
prompting.
REBOOT flushes the disk buffers, resets the drives,
and waits one second before rebooting, to allow disk
caching programs to finish writing any cached data.
4OS2 and 4DOS/NT issue the proper commands to shut
down the operating system before rebooting.
4DOS ! Under DOS, some system BIOSes, memory managers,
multitaskers, or memory-resident programs (TSRs) may
intercept attempts to reboot your system and defeat
them entirely, convert a cold boot request to a warm
boot or vice versa, or in very rare cases, hang the
system - requiring a reboot! As a result you may need
to experiment with which reboot options work best for
your system hardware and software configuration, and
under rare circumstances REBOOT may not be usable on
your system.
4OS2 ! ## Under OS/2, REBOOT must use the DOS.SYS device
driver to reboot your system. DOS.SYS is loaded via a
DEVICE= statement in your CONFIG.SYS file. If DOS.SYS
is not loaded, REBOOT will not work.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 303
REBOOT
-------------------------------------------------------------------
Options: /C(old): Do a "cold" reboot. This is similar to
turning the power off and back on, and may be
necessary to properly initialize the system.
4DOS REBOOT /C may not physically reset all hardware
devices as thoroughly as actually turning off the
power; its effect depends on the internal design of
each hardware device and on your system configuration.
4NT /L(ogoff): Log off Windows NT, but do not reboot.
This option is equivalent to Logoff choice on the
Program Manager's File menu in Windows NT.
4OS2, /S(hutdown): Shut down the system, but do not reboot.
4NT This option is equivalent to clicking the "Shutdown"
choice on the OS/2 2.x Workplace Shell popup menu, or
using the Shutdown choice on the Program Manager's
File menu in Windows NT.
/V(erify): Prompt for confirmation (Y or N) before
rebooting or taking the action specified by other
REBOOT options.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 304
REM
-------------------------------------------------------------------
REM (Compatible)
Purpose: Put a comment in a batch file.
Format: REM [comment]
comment: The text to include in the batch file.
Usage: The REM command lets you place a remark or comment in
a batch file. Batch file comments are useful for
documenting the purpose of a batch file and the
procedures you have used. For example:
rem This batch file provides a
rem menu-based system for accessing
rem word processing utilities.
rem
rem Clear the screen and get selection
cls
REM must be followed by a space or tab character and
then your comment. Comments can be up to 255
characters long in 4DOS, or 1023 characters long in
4OS2 and 4DOS/NT. 4DOS, 4OS2, and 4DOS/NT will
normally ignore everything on the line after the REM
command, including quote characters, redirection
symbols, and other commands (see below for the
exception to this rule).
If ECHO is ON, the comment is displayed. Otherwise,
it is ignored. If ECHO is ON and you don't want to
display the line, preface the REM command with an at
sign [@].
## You can use REM to create a zero-byte file if you use
a redirection symbol immediately after the REM
command. For example, to create the zero-byte file
C:\FOO:
c:\> rem>foo
(This capability is included for compatibility with
COMMAND.COM and CMD.EXE. A simpler method for
creating a zero-byte file with 4DOS, 4OS2, or 4DOS/NT
is to enter >filename as a command, with no actual
command before the [>] redirection character.)
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 305
REN / RENAME
-------------------------------------------------------------------
REN / RENAME (Enhanced)
Purpose: Rename files or subdirectories.
Format: REN [/A[[:][-]rhsda] /N /P /Q /S /T] old_name...
new_name
or
RENAME [/A[[:][-]rhsda] /N /P /Q /S /T] old_name...
new_name
old_name: Original name of the file(s) or
subdirectory.
new_name: New name to use, or new path on the same
drive.
/A(ttribute select) /Q(uiet)
/N(othing) /S(ubdirectory)
/P(rompt) /T(otal)
See also: COPY and MOVE.
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: REN and RENAME are synonyms. You may use either one.
REN lets you change the name of a file or a
subdirectory, or move one or more files to a new
subdirectory on the same drive. (If you want to move
files to a different drive, use MOVE.)
In its simplest form, you simply give REN the old_name
of an existing file or subdirectory and then a
new_name. The new_name must not already exist - you
can't give two files the same name (unless they are in
different directories). The first example renames the
file MEMO.TXT to MEM.TXT. The second example changes
the name of the \WORD directory to \WP:
c:\> rename memo.txt mem.txt
c:\> rename \word \wp
You can also use REN to rename a group of files that
you specify with wildcards, as multiple files, or in
an include list. When you do, the new_name must use
one or more wildcards to show what part of each
filename to change. Both of the next two examples
change the extensions of multiple files to .SAV:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 306
REN / RENAME
-------------------------------------------------------------------
c:\> ren config.sys autoexec.bat 4start.btm *.sav
c:\> ren *.txt *.sav
REN can move files to a different subdirectory on the
same drive. When it is used for this purpose, REN
requires one or more filenames for the old_name and a
directory name for the new_name:
c:\> ren memo.txt \wp\memos\
c:\> ren oct.dat nov.dat \data\save\
The final backslash in the last two examples is
optional. If you use it, you force REN to recognize
the last argument as the name of a directory, not a
file. The advantage of this approach is that if you
accidentally mistype the directory name, REN will
report an error instead of renaming your files in a
way that you didn't intend.
Finally, REN can move files to a new directory and
change their name at the same time if you specify both
a path and file name for new_name. In this example,
the files are renamed with an extension of .SAV as
they are moved to a new directory:
c:\> ren *.dat \data\save\*.sav
When new_name refers to a file or files (rather than a
directory), the file(s) must not already exist. Also,
you cannot rename a subdirectory to a new location on
the directory tree.
## REN does not change a file's attributes. The new_name
file(s) will have the same attributes as old_name.
Options: ## /A(ttribute select): Rename only those files that have
the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will select
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., REN /A ...),
REN will rename all files and subdirectories including
hidden and system files. If attributes are combined,
all the specified attributes must match for a file to
be selected. For example, /A:RHS will select only
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 307
REN / RENAME
-------------------------------------------------------------------
those files with all three attributes set. See page
18 for more information on file attributes.
/N(othing): Do everything except actually rename the
file(s). This option is useful for testing what a REN
command will actually do.
/P(rompt): Prompt the user to confirm each rename
operation. Your options at the prompt are explained
in detail on page 50.
/Q(uiet): Don't display filenames or the number of
files renamed. This option is most often used in
batch files. See also /T.
/S(ubdirectory): Normally, you can rename a
subdirectory only if you do not use any wildcards in
the new_name. This prevents subdirectories from being
renamed inadvertently when a group of files is being
renamed with wildcards. /S will let you rename a
subdirectory even when you use wildcards.
/T(otal): Don't display filenames as they are
renamed, but report the number of files renamed. See
also /Q.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 308
RETURN
-------------------------------------------------------------------
RETURN (New)
Purpose: Return from a GOSUB (subroutine) in a batch file.
Format: RETURN
See also: GOSUB.
Usage: 4DOS, 4OS2, and 4DOS/NT allow subroutines in batch
files.
A subroutine begins with a label (a colon followed by
a word) and ends with a RETURN command.
The subroutine is invoked with a GOSUB command from
another part of the batch file. When a RETURN command
is encountered the subroutine terminates, and
execution of the batch file continues on the line
following the original GOSUB.
The following batch file fragment calls a subroutine
which displays the files in the current directory:
echo Calling a subroutine
gosub subr1
echo Returned from the subroutine
quit
:subr1
dir /a/w
return
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 309
SCREEN
-------------------------------------------------------------------
SCREEN (New)
Purpose: Position the cursor on the screen and optionally
display a message.
Format: SCREEN row column [text]
row: The new row location for the cursor.
column: The new column location for the cursor.
text: Optional text to display at the new cursor
location.
See also: ECHO, SCRPUT, TEXT, and VSCRPUT.
Usage: SCREEN allows you to create attractive screen displays
in batch files. You use it to specify where a message
will appear on the screen. You can use SCREEN to
create menu displays, logos, etc. 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
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 or
VSCRPUT. SCREEN always leaves the cursor at the end
of the displayed text.
The row and column values are zero-based, so on a
standard 25 line by 80 column display, valid rows are
0 - 24 and valid columns are 0 - 79. You can also
specify the row and column as offsets from the current
cursor position. Begin the value with a plus sign [+]
to move the cursor down the specified number of rows
or to the right the specified number of columns, or
with a minus sign [-] to move the cursor up or to the
left. This example prints a string 3 lines above the
current position, in absolute column 10:
screen -3 10 Hello, World!
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 310
SCREEN
-------------------------------------------------------------------
SCREEN checks for a valid row and column, and displays
a "Usage" error message if either value is out of
range.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 311
SCRPUT
-------------------------------------------------------------------
SCRPUT (New)
Purpose: Position text on the screen and display it in color.
Format: SCRPUT row col [BRIght] [BLInk] fg ON [BRIght] bg text
row: Starting row
col: Starting column
fg: Foreground character color
bg: Background character color
text: The text to display
See also: CLS, ECHO, SCREEN, TEXT, and VSCRPUT.
Usage: SCRPUT allows you to create attractive screen displays
in batch files. You use it to specify where a message
will appear on the screen and what colors will be used
to display the message text. You can use SCRPUT to
create menu displays, logos, etc.
SCRPUT works like SCREEN, but allows you to specify
the display colors. It writes directly to the screen
and does not require ANSI support. It always leaves
the cursor in its current position. See page 26 for
details about colors and color names, and notes on the
use of bright background colors.
The row and column are zero-based, so on a standard 25
line by 80 column display, valid rows are 0 - 24 and
valid columns are 0 - 79. You can also specify the
row and column as offsets from the current cursor
position. Begin the value with a plus sign [+] to
move down the specified number of rows or to the right
the specified number of columns, or with a minus sign
[-] to move up or to the left.
The following batch file fragment displays a menu in
color:
cls white on blue
scrput 3 10 bri whi on blu Select an option:
scrput 6 20 bri red on blu 1 - Word Processing
scrput 7 20 bri yel on blu 2 - Spreadsheet
scrput 8 20 bri gre on blu 3 - Communications
scrput 9 20 bri mag on blu 4 - Quit
4DOS ## If you have an unusual display adapter which does not
support the direct video output used by SCRPUT, see
the OutputBIOS directive on page 150.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 312
SELECT
-------------------------------------------------------------------
SELECT (New)
Purpose: Interactively select files for a command.
Format: SELECT [/A[:][-]rhsda /C[HP] /D /E /H /I"text"
/O[:][-]acdeginrsu /Z] [command]... (files...)...
command: The command to execute with the selected
files.
files: The files from which to select. File names
may be enclosed in either parentheses or square
brackets. The difference is explained below.
/A(ttribute select) /H(ide dots)
/C[HP] (Compression) /I (match descriptions)
/D(isable color coding) /O(rder)
/E (use upper case) /Z (use FAT format)
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67). Date,
time, or size ranges must appear immediately after the
SELECT keyword.
Usage: SELECT allows you to select files for internal and
external commands by using a full-screen "point and
shoot" display. You can have SELECT execute a command
once for each file you select, or have it create a
list of files for a command to work with. The command
can be an internal command, an alias, an external
command, or a batch file.
If you use parentheses around the files, SELECT
executes the command once for each file you have
selected. During each execution, one of the selected
files is passed to the command as an argument. If you
use square brackets around files, the SELECTed files
are combined into a single list, separated by spaces.
The command is then executed once with the entire list
presented as its command-line arguments.
SELECT uses the cursor up, cursor down, PgUp, and PgDn
keys to scroll through the file list.
Press the L key to view the current highlighted file
with LIST. When you exit from LIST, the SELECT screen
will be restored.
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 reverse all of the current marks
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 313
SELECT
-------------------------------------------------------------------
(excluding subdirectories), and the / key will unmark
everything. 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 without marking any
other files.
To skip the files listed in the current display and go
on to the next file specification inside the
parentheses or brackets (if any), press the Esc key.
To cancel the current SELECT command entirely, press
Ctrl-C or Ctrl-Break.
In the simplest form of SELECT, you merely specify the
command and then the list of files from which you will
make your selection(s). For example:
c:\> select copy (*.com *.exe) a:\
will let you select from among the .COM and .EXE files
on the current drive. It will then invoke the COPY
command to copy each file you select to drive A:. You
will be able to select first from a list of all .COM
files in the current directory, and then from a list
of all .EXE files.
If you want to select from a list of all the .COM and
.EXE files mixed together, create an include list
inside the parentheses by inserting a semicolon (see
page 67 for information on include lists):
c:\> select copy (*.com;*.exe) a:\
Finally, if you want the SELECT command to send a
single list of files to COPY, instead of invoking COPY
once for each file you select, put the file names in
square brackets instead of parentheses:
c:\> select copy [*.com;*.exe] a:\
If you use brackets, you have to be sure that the
resulting command (the word COPY, the list of files,
and the destination drive in this example) is no more
than 255 characters long for internal commands and no
more than 127 characters long for external commands
under 4DOS. The line length limit for 4OS2 and
4DOS/NT is 1,023 characters for both internal and
external commands. The current line length is
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 314
SELECT
-------------------------------------------------------------------
displayed by SELECT while you are marking files to
help you to conform to these limits.
The parentheses or brackets enclosing the file name(s)
can appear anywhere within the command; SELECT assumes
that the first set of parentheses or brackets it finds
is the one containing the list of files from which you
wish to make your selection.
The list of files from which you wish to select can be
further refined by using date, time, and size ranges
(see page 62). The range must be placed immediately
after the word SELECT. If the command is an internal
command that supports ranges, an independent range can
also be used in the command itself.
## If you don't specify a command, the selected
filename(s) will become the command. For example,
this command defines an alias called UTILS that
selects from the executable files in the directory
C:\UTIL, and then executes them in the order marked
(enter the alias on one line):
c:\> alias utils select
(c:\util\*.com;*.exe;*.btm;*.bat)
## If you want to use filename completion (see page 41)
to enter the filenames inside the parentheses, type a
space after the opening parenthesis. Otherwise the
command-line editor will treat the open parenthesis as
the first character of the filename.
## You can set the default colors used by SELECT with the
SelectColors and SelectStatBarColors directives in the
.INI file (see page 141). If SelectColors is not
used, the SELECT display will use the current default
colors. If SelectStatBarColors is not used, the
status bar will use the reverse of the SELECT display
colors.
You can display the filenames in color by setting the
COLORDIR environment variable or using the ColorDir
directive in your .INI file. See page 30 for details.
To disable directory color coding within SELECT, use
the /D option.
When displaying descriptions, SELECT adds a right
arrow at the end of the line if the description is too
long to fit on the screen. This symbol will alert you
to the existence of additional description text.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 315
SELECT
-------------------------------------------------------------------
You can use the left and right arrow keys to scroll
the screen horizontally and view the additional text.
## With the /I option, you can select files based on
their descriptions. SELECT will display files if
their description matches the text after the /I
switch. The search is not case sensitive. You can
use wildcards and extended wild cards as part of the
text.
## When sorting file names and extensions for the SELECT
display, 4DOS, 4OS2, and 4DOS/NT normally assume that
sequences of digits should be sorted numerically (for
example, the file DRAW2 would come before DRAW03
because 2 is numerically smaller than 03), rather than
strictly alphabetically (where DRAW2 would come second
because "2" comes after "0"). You can defeat this
behavior and force a strict alphabetic sort with the
/O:a option.
4DOS ## SELECT normally writes text directly to the screen.
If you have an unusual display adapter which does not
support direct video output, see the OutputBIOS
directive on page 150.
4DOS ## ! If you receive a stack overflow error when using
SELECT in complex, nested command sequences, see the
notes under the StackSize directive on page 150.
Options: ## /A(ttribute select): Display only those files that
have the specified attribute set. Preceding the
attribute character with a minus [-] will display
files that do not have that attribute set. Attributes
can also be combined. The attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., SELECT /A
...), SELECT will display all files and subdirectories
including hidden and system files. If attributes are
combined, all the specified attributes must match for
a file to be included in the listing. For example,
/A:RHS will display only those files with all three
attributes set. See page 18 for more information on
file attributes.
4DOS /C(ompression): Display compression ratios on
compressed drives. The compression ratio is displayed
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 316
SELECT
-------------------------------------------------------------------
instead of the file description. The ratio is left
blank for directories, for files with a length of 0
bytes, and for files on non-compressed drives. See
APPNOTES.DOC for a list of supported compression
systems.
Using /CH displays compression ratios like /C, but
bases the calculation on the host drive's cluster
size. This gives a more accurate picture of the space
saved through compression than is given by /C.
If /CP is used instead of /C, the compression is
displayed as a percentage instead of a ratio. If /CHP
is used instead of /CH, the host compression is
displayed as a percentage. The /CHP option must be
entered as shown; you can not use /CPH.
See the DIR /C documentation on page 209 for more
details on how compression ratios are calculated.
## /D(isable color coding): Temporarily turn off
directory color coding within SELECT.
/E (use upper case): Display filenames in the
traditional upper case format; also see SETDOS /U and
the UpperCase directive in the .INI file.
/H(ide dots): Suppress the display of the "." and
".." directories.
/I (match descriptions): Display filenames by
matching text in their descriptions. The text can
include wild cards and extended wildcards. The search
text must be enclosed in quotation marks. /I will be
ignored if /C or /O:c is also used.
/O(rder): Set the sort order for the files. The
order can be any combination of the following options:
- Reverse the sort order for the next option
a Sort names and extensions in standard ASCII
order, rather than sorting numerically when
digits are included in the name or extension
c Sort by compression ratio (the least
compressed file in the list will be
displayed first). The compression ratios
will be used as the basis of the sort and
will also be displayed. If /O:c is used
with /CH or /CHP, the sort will be based on
the host-drive compression ratios.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 317
SELECT
-------------------------------------------------------------------
d Sort by date and time (oldest first)
e Sort by extension
g Group subdirectories together
i Sort by the file description (ignored if /C
or /O:c is also used)
n Sort by filename (this is the default)
r Reverse the sort order for all options
s Sort by size
u Unsorted
4OS2, /Z: Display HPFS and NTFS filenames in FAT format.
4NT Long names will be truncated to 12 characters. If
the name is longer than 12 characters, it will be
followed by a right arrow to show that one or more
characters have been truncated.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 318
SET
-------------------------------------------------------------------
SET (Enhanced)
Purpose: Display, create, modify, or delete environment
variables.
Format: SET [/M /P /R filename...] [name[=][value]]
filename: The name of a file containing variable
definitions.
name: The name of the environment variable to define
or modify.
value: The new value for the variable.
/M(aster) /R(ead from file)
/P(ause)
See also: ESET and UNSET.
Usage: Every program and command inherits an environment,
which is a list of variable names, each of which is
followed by an equal sign and some text. Many
programs use entries in the environment to modify
their own actions. 4DOS, 4OS2, and 4DOS/NT use
several environment variables (see page 98). See
pages 21 and 96 for more information on the
environment.
If you simply type the SET command with no options or
arguments, it will display all the names and values
currently stored in the environment. Typically, you
will see an entry called COMSPEC, an entry called
PATH, an entry called CMDLINE, and whatever other
environment variables you and your programs have
established:
c:\> set
COMSPEC=C:\4DOS.COM
PATH=C:\;C:\DOS;C:\UTIL
CMDLINE=E:\UTIL\MAPMEM.EXE
To add a variable to the environment, type SET, a
space, the variable name, an equal sign, and the text:
c:\> set mine=c:\finance\myfiles
The variable name is converted to upper case by 4DOS
and 4OS2 (for compatibility with CMD.EXE, 4DOS/NT does
not shift variable names to upper case). The text
after the equal sign will be left just as you entered
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 319
SET
-------------------------------------------------------------------
it. If the variable already exists, its value will be
replaced with the new text that you entered.
! Normally you should not put a space on either side of
the equal sign. A space before the equal sign will
become part of the name; a space after the equal sign
will become part of the value.
! If you use SET to create a variable with the same name
as one of the 4DOS, 4OS2, or 4DOS/NT internal
variables (see page 100), you will disable the
internal variable. If you later execute a batch file
or alias that depends on that internal variable, it
may not operate correctly.
To display the contents of a single variable, type SET
plus the variable name:
c:\> set mine
You can edit environment variables with the ESET
command. To remove variables from the environment,
use UNSET, or type SET plus a variable name and an
equal sign:
c:\> set mine=
The variable name is limited to a maximum of 80
characters. Under 4DOS, the name and value together
cannot be longer than 255 characters. In 4OS2 and
4DOS/NT, the maximum length for the name and value
together is 1,023 characters.
4DOS ## Unless you use /M, SET only affects the environment of
the current command processor and the programs it
executes. If you EXIT to a parent command processor,
the original environment will be unchanged.
In 4DOS, the size of the environment is specified by
the Environment and EnvFree directives in 4DOS.INI
(see page 132) or by the /E: startup switch (see the
4DOS Introduction and Installation Guide). In 4OS2
and 4DOS/NT the size of the environment is set
automatically.
Options: ## /M(aster): Display or modify the master environment
4DOS rather than the local environment. This option only
makes sense in a secondary shell.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 320
SET
-------------------------------------------------------------------
/P(ause): Wait for a key to be pressed after each
screen page before continuing the display. Your
options at the prompt are explained in detail on page
50.
## /R(ead): Read environment variables from a file.
This is much faster than loading variables from a
batch file with multiple SET commands. Each entry in
the file must fit within the command-line length limit
for your command processor: 255 bytes for 4DOS and
1,023 bytes for 4OS2 and 4DOS/NT. 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.
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 load variables from multiple files by listing
the filenames individually after the /R. You can add
comments to a variable file by starting the comment
line with a colon [:].
If you are creating a SET /R file by hand, and need to
create an entry that spans multiple lines in the file,
you can do so by terminating each line, except the
last, with an escape character (see page 73).
However, you cannot use this method to exceed the
command-line length limit.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 321
SETDOS
-------------------------------------------------------------------
SETDOS (New)
Purpose: Display or set the 4DOS, 4OS2, or 4DOS/NT
configuration.
Format: SETDOS [/A? /B? /C? /D /E? /Fn.n /I+|- command /L? /M?
/N? /P? /R? /S?:? /U? /V? /X[+|-]n /Y]
/A(NSI) /N(o clobber)
/B(right background) /P(arameter character)
/C(ompound) /R(ows)
/D(escriptions) /S(hape of cursor)
/E(scape character) /U(pper case)
/F(ormat for @EVAL) /V(erbose)
/I(nternal commands) /X (expansion)
/L(ine) /Y (single step)
/M(ode for editing)
Usage: SETDOS allows you to customize certain aspects of
4DOS, 4OS2, or 4DOS/NT to suit your personal tastes or
the configuration of your system. Each of these
options is described below.
You can display the value of all SETDOS options by
entering the SETDOS command with no parameters.
Most of the SETDOS options can be initialized when the
command processor executes the directives in the .INI
file (see page 136). The name of the corresponding
directive is listed in square brackets [ ] with each
option below; if none is listed, that option cannot be
set from the .INI file. You can also define the
SETDOS options in your AUTOEXEC.BAT, 4START, or other
startup file (see page 85), in aliases, or at the
command line.
Secondary shells automatically inherit most
configuration settings currently in effect in the
previous shell. If values have been changed by SETDOS
since 4DOS, 4OS2, or 4DOS/NT started, the new values
will be passed to the secondary shell. For details on
inheritance of SETDOS values by secondary shells and
their relationship to the .INI file, see page 129.
SETDOS /I settings are not inherited by secondary
shells. If you want to use SETDOS /I- to disable
commands in all shells, place the SETDOS command(s) in
your 4START file (see page 85), which is executed when
any shell starts.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 322
SETDOS
-------------------------------------------------------------------
Many of the options below are marked with ##. If you
are a new user, skip these and read the /M, /S, and /U
options, which are more common.
Options: ## /A(NSI) [ANSI]: The ANSI option determines whether
4DOS will attempt to use ANSI escape sequences for the
4DOS CLS and COLOR commands. 4DOS normally determines this
itself, but if you are using a non-standard ANSI
driver or your loading sequence is unusual, you may
need to explicitly inform 4DOS. /A0 allows 4DOS to
determine automatically whether an ANSI driver is
installed (the default). /A1 forces 4DOS to assume
an ANSI driver is installed. /A2 forces 4DOS to
assume an ANSI driver is not installed. See page 25
for more information on ANSI drivers.
4OS2 The /A(NSI) option and the corresponding ANSI
directive are not available in 4OS2. ANSI support is
automatically turned on by 4OS2, which assumes that it
remains enabled.
4NT The /A(NSI) option and the corresponding ANSI
directive are not available in 4DOS/NT because Windows
NT does not provide ANSI support.
4DOS, /B(right background) [BrightBG]: The BRIGHTBG option
4OS2 determines whether 4DOS and 4OS2 configure your video
adapter for blinking text (/B0, the default) or bright
background colors (/B1). See page 26 for a detailed
discussion of this option.
## /C(ompound character) [CommandSep]: The COMPOUND
option sets the character used for separating multiple
commands on the same line. The default is the caret
[^] in 4DOS and the ampersand [&] in 4OS2 and 4DOS/NT.
You cannot use any of the redirection characters (| >
<), or the blank, tab, comma, or equal sign as the
command separator. This example changes the COMPOUND
character to a tilde [~]:
c:\> setdos /c~
If you want to share batch files or aliases between
4DOS and 4OS2 or 4DOS/NT, see page 102 for information
on the %+ variable, which retrieves the current
command separator, and page 74 for details on using
compatible command separators for all the products you
use.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 323
SETDOS
-------------------------------------------------------------------
## /D(escriptions) [Descriptions]: The DESCRIPTIONS
option controls whether file processing commands like
COPY, DEL, MOVE, and REN process file descriptions
along with the files they belong to. /D1 turns
description processing on, which is the default. /D0
turns description processing off.
## /E(scape character) [EscapeChar]: The ESCAPE option
sets 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. The default escape character is Ctrl-X
(ASCII 24, which appears on screen as an up-arrow) in
4DOS, and the caret [^] in 4OS2 and 4DOS/NT. You
cannot use any of the redirection characters (| > <)
or the blank, tab, comma, or equal sign as the escape
character. Certain characters (b, c, e, f, n, r, s,
and t) have special meanings when immediately preceded
by the escape character. See page 73 for additional
details on the escape character.
If you want to share batch files or aliases between
4DOS and 4OS2 or 4DOS/NT, see page 102 for information
on the %= variable, which retrieves the current escape
character, and page 74 for details on using compatible
escape characters for all the products you use.
/F(ormat for @EVAL) [EvalMax, EvalMin]: The FORMAT
option lets you set default decimal precision for the
@EVAL variable function (see page 112). The maximum
precision is 16 digits to the left of the decimal
point and 8 digits to the right of the decimal point.
By default, the minimum precision to the right of the
decimal point is 0.
The general form of this option is /Fx.y, where the x
value sets the minimum number of digits to the right
of the decimal place and the y value sets the maximum
number of digits. Both values can range from 0 to 8;
if x is greater than y, it is ignored. You can
specify either or both values: /F2.5, /F2, and /F.5
are all valid entries. See the @EVAL function on page
112 if you want to set the precision for a single
computation.
## /I(nternal): The INTERNAL option allows you to
disable or enable internal commands. To disable a
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 324
SETDOS
-------------------------------------------------------------------
command, precede the command name with a minus [-].
To re-enable a command, precede it with a plus [+].
For example, to disable the internal LIST command to
force 4DOS to use an external command:
c:\> setdos /i-list
4DOS, ## /L(ine) [LineInput]: The LINE option controls how
4OS2 4DOS or 4OS2 gets its input from the command line.
/L0 tells the command processor to use character input
(the default). /L1 tells it to use line input (like
COMMAND.COM and CMD.EXE). /L1 will disable command-
line editing, history recall, filename completion, and
the directory history window, and will reduce the 4OS2
input length limit from 1023 characters to 255
characters. It should only be used if it is needed
for compatibility with a specific program. If you
have a program that requires line input, you can use
the following line in an alias or batch file to change
the line input option just for that single program
(change the command separator to an ampersand [&] for
4OS2):
setdos /L1 ^ program %& ^ setdos /L0
See APPNOTES.DOC (for 4DOS) or README.DOC (for 4OS2)
for information on programs which require this option.
/M(ode) [EditMode]: The MODE option controls the
initial line editing mode. To start in overstrike
mode at the beginning of each command line, use /M0
(the default). To start in insert mode, use /M1.
## /N(o clobber) [NoClobber]: The NOCLOBBER option
controls output redirection (see page 52). /N0 means
existing files will be overwritten by output
redirection (with >) and that appending (with >>) does
not require the file to exist already. This is the
default. /N1 means existing files may not be
overwritten by output redirection, and that when
appending the output file must exist. A /N1 setting
can be overridden with the [!] character. If you use
/N1, you may have problems with a few unusual programs
that shell out to run a command with redirection, and
expect to be able to overwrite an existing file.
## /P(arameter character) [ParameterChar]: This option
sets the character used after a percent sign to
specify all or all remaining command-line arguments in
a batch file or alias (e.g., %& or %n&; see pages 82
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 325
SETDOS
-------------------------------------------------------------------
and 168). The default is the ampersand [&] for 4DOS
and the dollar sign [$] for 4OS2 and 4DOS/NT.
If you want to share batch files or aliases between
4DOS and 4OS2 or 4DOS/NT, see page 74 for details on
selecting compatible parameter characters for all the
products you use.
## /R(ows) [ScreenRows]: The ROWS option sets the
number of screen rows used by the video display.
Normally 4DOS, 4OS2, and 4DOS/NT detect the screen
size, but if you have a non-standard display you may
need to set it explicitly. This option does not
affect screen scrolling (that is controlled by your
video driver or, under 4DOS, the 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.
/S(hape) [CursorOver, CursorIns]: The SHAPE option
sets the cursor shape. The format is /So:i where o is
the cursor size for overstrike mode, i the cursor size
for insert mode. The size is entered as a percentage
of the total character height. The default values are
10:100 (an underscore cursor for overstrike mode, and
a block cursor for insert mode). Because of the way
video BIOSes and drivers remap the cursor shape, you
may not get a smooth progression in the cursor size
from 0% - 100%. To disable the cursor, enter /S0:0.
If either value is -1, , the command processor will
not attempt to modify the cursor shape at all. You
can use this feature to give another program full
control of the cursor shape.
/U(pper) [UpperCase]: The UPPER option controls the
default case (upper or lower) for file and directory
names displayed by internal commands like COPY and
DIR. /U0 displays file names in lower case (the
default). /U1 displays file names in the traditional
upper case. The /U setting is ignored for HPFS and
NTFS filenames under 4OS2 and 4DOS/NT, and FAT
filenames under Windows NT 3.5 and above. HPFS and
NTFS names are always displayed in the case in which
they are stored; see page 17 for more details.
## /V(erbose) [BatchEcho]: The VERBOSE option controls
the default for command echoing in batch files. /V0
disables echoing of batch file commands unless ECHO is
explicitly set ON. /V1, the default setting, enables
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 326
SETDOS
-------------------------------------------------------------------
echoing of batch file commands unless ECHO is
explicitly set OFF.
/V2 forces echoing of all batch file commands, even if
ECHO is set OFF or the line begins with an "@". This
allows you to turn echoing on for a batch file without
editing the batch file and removing the ECHO OFF
command(s) within it. /V2 is intended for debugging,
and can be set with SETDOS, but not with the BatchEcho
directive in 4DOS.INI. For more information on batch
file debugging see page 89, and /Y (below).
## /X[+|-]n (expansion and special characters): This
option enables and disables alias and environment
variable expansion, and controls whether special
characters have their usual meaning or are treated as
text. It is most often used in batch files to process
text strings which may contain special characters.
See page 91 for further details on string processing
in batch files, and page 121 for details on alias
expansion, variable expansion, and special characters.
The features enabled or disabled by /X are numbered.
All features are enabled when the command processor
starts, and you can re-enable all features at any time
by using /X0. To disable a particular feature, use
/X-n, where n is the feature number from the list
below. To re-enable the feature, use /X+n. To enable
or disable multiple individual features, list their
numbers in sequence after the + or - (e.g. /X-345 to
disable features 3, 4, and 5).
The features are:
1 All alias expansion.
2 Nested alias expansion only.
3 All variable expansion (includes environment
variables, batch file parameters, and alias
parameters).
4 Nested variable expansion only.
5 Multiple commands, conditional commands, and
piping (affects the command separator, ||,
&&, |, and |&).
6 Redirection (affects < , >, >&, >&>, etc.).
7 Quoting (affects back-quotes [`] and double
quotes ["]).
8 Escape character.
If nested alias expansion is disabled, the first alias
of a command is expanded but any aliases it invokes
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 327
SETDOS
-------------------------------------------------------------------
are not expanded. If nested variable expansion is
disabled, each variable is expanded once, but
variables containing the names of other variables are
not expanded further.
For example, to disable all features except alias
expansion while you are processing a text file
containing special characters:
setdos /x-35678
... [perform text processing here]
setdos /x0
## /Y (single step): /Y1 enables single-stepping through
a batch file. Each command is displayed on the screen
along with a Y/N/R (yes / no / remainder) prompt.
Press Y to execute the command, N to omit the command
and go on to the next, or R to execute the remainder
of the batch file (up to the next SETDOS /Y1 command).
You may also press Ctrl-C or Ctrl-Break to terminate
the batch file. For more information on batch file
debugging, see page 89, and /V (above).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 328
SETLOCAL
-------------------------------------------------------------------
SETLOCAL (New)
Purpose: Save a copy of the current disk drive, directory,
environment, and alias list.
Format: SETLOCAL
See also: ENDLOCAL.
Usage: SETLOCAL is used in batch files to save the default
disk drive and directory, the environment, and the
alias list to a reserved block of memory. You can
then change their values and later restore the
original values with the ENDLOCAL command.
For example, this batch file fragment saves
everything, removes all aliases so that user aliases
will not affect batch file commands, changes the disk
and directory, modifies a variable, runs a program,
and then restores the original values:
setlocal
unalias *
cdd d:\test
set path=c:\;c:\dos;c:\util
rem run some program here
endlocal
SETLOCAL and ENDLOCAL are not nestable within a 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.
You cannot use SETLOCAL in an alias or at the command
line.
An ENDLOCAL is performed automatically at the end of a
batch file if you forget to do so. If you invoke one
batch file from another without using CALL, the first
batch file is terminated, and an automatic ENDLOCAL is
performed. The second batch file inherits the drive,
directory, aliases, and environment variables as they
were prior to any unterminated SETLOCAL.
4DOS ! Do not load memory-resident programs (TSRs) from a
batch file while 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 usually harmful, but
wastes memory.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 329
SHIFT
-------------------------------------------------------------------
SHIFT (Enhanced)
Purpose: Allows the use of more than 127 batch file parameters
in a batch file.
Format: SHIFT [n]
n: Number of positions to shift.
Usage: SHIFT is provided for compatibility with older batch
files, where it was used to access more than 10
parameters. 4DOS, 4OS2, and 4DOS/NT support 128
parameters (%0 to %127), so you may not need to use
SHIFT for batch files running exclusively under JP
Software command processors.
SHIFT moves each of the batch file parameters n
positions to the left. The default value for n is 1.
SHIFT 1 moves the parameter in %1 to position %0, the
parameter in %2 becomes %1, etc. You can reverse a
SHIFT by giving a negative value for n (i.e., after
SHIFT -1, the former %0 is restored, %0 becomes %1, %1
becomes %2, etc.).
SHIFT also affects the parameters %n& (command-line
tail; %n$ in 4OS2 and 4DOS/NT) and %# (number of
command arguments).
For example, create a batch file called TEST.BAT:
echo %1 %2 %3 %4
shift
echo %1 %2 %3 %4
shift 2
echo %1 %2 %3 %4
shift -1
echo %1 %2 %3 %4
Executing TEST.BAT produces the following results:
c:\> test one two three four five six seven
one two three four
two three four five
four five six seven
three four five six
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 330
START
-------------------------------------------------------------------
START (New)
Purpose: Start a program in another session or window.
Format: The format for START depends on which command
processor you are using (see the Options section below
for additional minor differences in valid options
under 4DOS and 4OS2):
4DOS, START ["program title"] [/B[G] /C /DOS[=optfile] /F[G]
4OS2 /FS /ICON=iconfile /INV /K /L /LA /LD /LH /MAX /MIN /N
/PGM progname /PM /POS=row,col,width,height /WIN
/WIN3[=optfile] /WIN3S[=optfile]] [command]
4NT START ["program title"] [/B /C /Dpath /HIGH /I
/INV /K /L /LA /LD /LH /LOW /MAX /MIN /NORMAL
/PGM progname /POS=row,col,width,height /REALTIME
/SEPARATE /SIZE=rows,columns /WAIT] [command]
program title: Title to appear on title bar.
optfile: Option settings file.
iconfile: Name of icon (.ICO) file.
progname: Program name (not the session name).
path: Startup directory.
command: Command to be executed.
/B (no new console) /LOW (priority)
/B[G] (background ) /MAX(imized)
/C(lose when done) /MIN(imized)
/D(irectory) /N(o CMD.EXE)
/DOS (DOS session) /NORMAL (priority)
/F[G] (foreground ) /PGM (program name)
/FS (full screen) /PM (PM application)
/HIGH (priority) /POS(ition of window)
/I(nherit environment) /REALTIME (priority)
/ICON (name .ICO file) /SEPARATE (virtual machine)
/INV(isible) /SIZE (of screen buffer)
/K(eep when done) /WAIT (for session to finish)
/L(ocal lists) /WIN(dowed session)
/LA (local aliases) /WIN3 (enhanced mode)
/LD (local dir history) /WIN3S (standard mode)
/LH (local history list)
See also: DETACH.
Usage: START is used to begin a new OS/2 session or Windows
NT window and, optionally, to run a program in that
session or window. If you use START with no
parameters, it will begin a new session or window. If
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 331
START
-------------------------------------------------------------------
you add a command, START will begin a new session or
window and execute that command.
The program title, if it is included, will appear on
the title bar, on the Presentation Manager task list
(OS/2 version 1.x) or window list (OS/2 version 2.x),
or on the task list and Alt-Tab displays (Windows NT).
The program title must be enclosed in quotation marks
and cannot exceed 60 characters in 4OS2 and 4DOS, or
127 characters in 4DOS/NT. If the program title is
omitted, the program name will be used as the title.
You can use START if you are running 4OS2, 4DOS/NT, or
4DOS in an OS/2 2.1 or later DOS session. START will
not work when running 4DOS under DOS, or DOS plus
Windows.
Although the START command has the same purpose in
4DOS, 4OS2, and 4DOS/NT, there are several subtle
differences between platforms. The 4DOS and 4OS2
versions of START are similar because both rely on the
services of the OS/2 operating system. The 4DOS/NT
version of START has different options available,
partly to maintain compatibility with the START
command in the Windows NT version of CMD.EXE, and
partly because of the features of and limitations
imposed by Windows NT.
START offers a large number of switches to control the
session you start. In most cases you need only a few
switches to accomplish what you want. The list below
summarizes the most commonly used START options, and
how you can use them to control the way a session is
started:
/MAX, /MIN, and /POS allow you to start a
character-mode windowed session in a maximized
window, a minimized window, or a window with a
specified position and size. The default is to
let the operating environment choose the position
and size of the window.
/C allows you to close the session when the
command is finished (the default for DOS, OS/2
Presentation Manager, and Windows NT graphical
sessions); /K allows you to keep the session open
and go to a prompt (the default for OS/2 and
Windows NT character mode sessions).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 332
START
-------------------------------------------------------------------
4OS2, /BG and /FG allow you to start the session in the
4DOS background (does not respond to keystrokes until
selected) or foreground (responds to keystrokes
until deselected). /FG is the default if /DOS,
/FS, /WIN, or /PM is used; otherwise, /BG is the
default.
4OS2, /FS and /WIN control whether a character-mode
4DOS session is started in full-screen or windowed
mode. The default is to start a session of the
same type as the current session, if the
application can be run in such a session.
4OS2, Under 4OS2 and 4DOS/NT, START determines the
4NT application type automatically and starts the session
in the appropriate mode: OS/2, Windows, DOS, full-
screen, windowed, or Presentation Manager for OS/2;
DOS, 16-bit Windows, 32-bit Windows, 32-bit Windows NT
(both graphical and character mode), 16-bit OS/2 1.x
character mode, or POSIX for Windows NT.
START gives you some flexibility in determining the
session mode. For example, if the command is the name
of a batch file (either a .BTM or .CMD file), you can
use the /FS or /WIN options to run the batch file as
part of a new 4OS2 session in either full-screen or
windowed mode.
However, you cannot start a session in a mode that is
inappropriate for the application type. A DOS
application cannot be run as part of a Presentation
Manager session, for example, even if you use the /PM
switch. Invalid or conflicting options will be
ignored. 4OS2 and 4DOS/NT will always attempt to run
the command in the appropriate type of session.
4DOS The 4DOS START command is unable to determine the
application type. If you don't specify the type on
the command line, 4DOS will start a new OS/2 session
to run it.
4OS2 ## If the program is a DOS application or .BAT file, 4OS2
will return an error message in OS/2 version 1.x. In
OS/2 version 2.x, 4OS2 will start a new DOS session to
run the program or batch file. The DOS session will
close itself automatically as soon as the program or
batch file ends, unless /K is used. If you want the
session to wait for a keystroke before it closes
itself, you can use the syntax:
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 333
START
-------------------------------------------------------------------
[c:\] start /DOS command ^^ pause
(Because the caret [^] is the default 4OS2 escape
character, two carets must be used in order to pass
one on to 4DOS as a command separator.)
4OS2, If you want to start a DOS command-line session in
4DOS OS/2 version 2.x, you can use the command:
[c:\] start /DOS
4OS2, ! ## Under OS/2, you can specify settings for DOS and
4DOS Windows sessions by using a settings options file, and
loading it with the /DOS=, /WIN3=, or /WIN3S= option.
This allows you to start DOS and Windows sessions with
specific settings without creating a desktop object
and modifying the settings manually. Before using
this capability you should read the description of it
under /DOS= (below) very carefully, since errors in
the settings file can occasionally hang your system.
Options: Unlike most commands, the options below are not in
strictly alphabetical order. Instead, they are
divided first by product, then alphabetically.
The following options are available in 4OS2, 4DOS/NT,
and 4DOS:
/C(lose): The session or window is closed when
the application ends.
/INV(isible): Start the session or window as
invisible. No icon will appear and the session
will only be accessible through the Task Manager
or Window List.
/K(eep session or window at end): The session or
window continues after the application program
ends. Use the EXIT command to end the session.
/L(ocal lists): Start the command processor with
local alias, history, and directory history
lists. Under 4OS2 or 4DOS/NT, this option
combines the effects of /LA, /LD, and /LH
(below).
/LA: Start the command processor with a local
alias list. See page 169 for information on
local and global aliases.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 334
START
-------------------------------------------------------------------
/LD: Start the command processor with a local
directory history list. See page 45 for
information on local and global directory
history.
/LH: Start the command processor with a local
history list. See page 39 for information on
local and global history lists.
/MAX(imized): Start the session or window
maximized.
/MIN(imized): Start the session or window
minimized.
/PGM: The string following this option is the
program name. The first quoted string on the
line will be used as the session and task list
title, and not as the program name.
/POS(ition): Start the window at the specified
screen position. The syntax is /POS=row, col,
width, height where the values are specified in
pixels or pels. Under 4DOS and 4OS2, row and col
refer to the position of the bottom left corner
of the window relative to the bottom left corner
of the screen. Under 4DOS/NT, row and col refer
to the position of the top left corner of the
window relative to the top left corner of the
screen.
4OS2, The following options are available in 4OS2 and 4DOS,
4DOS but not in 4DOS/NT:
/BG: The session is started as a background
session. /BG may be abbreviated to /B.
/DOS[=filename]: Start a DOS session under OS/2
version 2.x. This option is not available in
OS/2 version 1.x, which doesn't allow multiple
DOS sessions.
If you include the =filename, OS/2 will load DOS
settings from the specified file. This option is
available only in the 32-bit version of 4OS2, and
in 4DOS.
! Starting a session with specific DOS settings is
an undocumented feature which was implemented
within OS/2 with little error checking. It is
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 335
START
-------------------------------------------------------------------
included in START because it substantially eases
a complex task, but you must experiment carefully
to ensure that the settings you select will work
properly on the systems on which you plan to use
them. Incorrect settings may be ignored, but
they may also hang your session or stop the
entire system. Be sure your experiments are not
conducted while critical tasks are in process.
Each line in the file must have a name, an equal
sign [=], and a value. The names are those shown
in OS/2's DOS Settings dialog box. Do not use
spaces on either side of the equal sign.
The names in the DOS Settings dialog box will
vary depending on the device drivers and other
settings in your CONFIG.SYS file, though many are
available on all systems. You must ensure that
the names you use are valid for the systems on
which you use them. For example, if you replace
IBM's COM.SYS and VCOM.SYS with different
communications drivers, the COM_ settings will
probably not be valid for the new drivers. If
you have a settings file which contains settings
defined by a particular driver, and use it on a
system where the corresponding driver is not
loaded, the results are undefined.
The values in your settings file must be numeric
for settings which show a numeric value under DOS
Settings (e.g., DOS_FILES=30), and must be text
strings for settings shown with a string (e.g.,
DOS_SHELL=C:\4DOS.COM C:\4DOS /P). Strings
should be entered without trailing blanks. For
values shown as multiple choice on the DOS
Settings page you must specify a numeric value,
typically "0" for Off and 1 for On (e.g.,
DOS_HIGH=1). Items with choices other than Off
and On may use different values, or may not work
at all; experimentation is usually required to
find out what works. Attempting to use strings
for choice items (e.g., DOS_HIGH=ON) will not
work, and can hang your system. This is due to
the internal operation of OS/2, and is not a
problem in 4OS2 or 4DOS.
A typical DOS settings file might look like this:
DOS_FILES=30
DOS_HIGH=1
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 336
START
-------------------------------------------------------------------
DOS_SHELL=C:\4DOS\4DOS.COM C:\4DOS /P
MOUSE_EXCLUSIVE_ACCESS=0
VIDEO_FASTPASTE=1
You can include comments in a settings file by
beginning any line with a colon [:].
/FG: Start the session as the foreground
session. /FG may be abbreviated to /F.
/FS: Start the session as a full-screen session.
/ICON=filename: Use the specified icon file. If
you don't use /ICON, 4OS2 or 4DOS will look for
an .ICO file with the same file name and in the
same directory as the program file. Some
versions of OS/2 may ignore this option and use
the default icon for the session. If you
encounter this problem, check whether an update
to OS/2 has been released which addresses it.
/N(o CMD.EXE): Under 4OS2, start an OS/2 program
directly, without a command processor. The
command cannot be an internal command or batch
file. This is the default for PM applications.
Under 4DOS, start a DOS program directly.
/PM: Start a program in the PM session.
/WIN(dowed): Start the session in a window.
/WIN3[=filename]: Run the program in an
enhanced-mode Windows 3.x session. The session
will run seamless (on the OS/2 desktop) if
started from 4OS2, or full-screen if started from
4DOS. (To start a Windows application in full-
screen mode from 4OS2, use /FS rather than
/WIN3). You can include an equal sign and the
name of an options file to set options for the
specific session and application (see /DOS= above
for details). The setting names in the file
should be taken from those shown in OS/2's
WIN-OS/2 Settings dialog box. Available only in
the 32-bit version of 4OS2, and in 4DOS.
/WIN3S[=filename]: Equivalent to /WIN3, but runs
the program in standard mode rather than enhanced
mode. Available only in 4OS2/32 and 4DOS.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 337
START
-------------------------------------------------------------------
4OS2, The following options are available in 4OS2 and
4NT 4DOS/NT, but cannot be used under 4DOS:
/I(nherit environment): Inherit the default
environment specified in CONFIG.SYS, if any,
rather than the current environment.
/WAIT: Wait for the new session or window to
finish before continuing. Cannot be used with
/WIN3 or /WIN3S.
4NT The final group of options is only available under
4DOS/NT:
/B: The program is started without creating a
new window or console.
/D(irectory): Specifies the startup directory.
Include the directory immediately after the /D,
with no intervening spaces or punctuation.
/HIGH: Start the window at high priority.
/LOW: Start the window at low priority.
/NORMAL: Start the window at normal priority.
/REALTIME: Start the window at realtime
priority.
/SEPARATE: Start a 16-bit Windows application in
a separate virtual machine (Windows NT 3.5 and
above only).
/SIZE: Start the window with the specified
screen buffer size. The full syntax is
/SIZE=rows, columns, where rows is the number of
text rows and columns is the number of text
columns.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 338
[4DOS] SWAPPING
-------------------------------------------------------------------
SWAPPING [4DOS] (New)
Purpose: Enable or disable 4DOS swapping, or display the
swapping state.
Format: SWAPPING [ON | OFF]
## Usage: SWAPPING temporarily disables or enables the swapping
of the transient portion of 4DOS to expanded memory,
extended memory, to XMS or to disk (see page 134).
Setting SWAPPING OFF is particularly useful for
speeding up batch files (including AUTOEXEC.BAT) when
4DOS is using disk swapping. When you are running
several small programs from a batch file, disk
swapping can sometimes cause a noticeable delay.
However, if you disable swapping, there will be about
128K less memory available for large application
programs.
The following batch file fragment disables swapping,
runs several programs, and then re-enables swapping:
swapping off
c:\util\mouse
c:\video\ansi.com
cls bright white on blue
c:\bin\cache.com
swapping on
If you enter SWAPPING with no arguments, 4DOS displays
the current swapping type (XMS, EMS, Disk, or None)
and state:
c:\> swapping
SWAPPING (XMS) is ON
Setting SWAPPING OFF does not close the disk swap file
or release any reserved EMS or XMS memory.
You may have trouble if you load memory-resident
programs (TSRs) with SWAPPING OFF and unload them with
SWAPPING ON, or vice versa. Many TSRs expect the
system to be in the same state when they unload that
it was in when they loaded, and variation from this
norm may cause the TSR to unload improperly or hang
your system.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 339
TEE
-------------------------------------------------------------------
TEE (New)
Purpose: Copy standard input to both standard output and a
file.
Format: TEE [/A] file...
file: One or more files that will receive the "tee-d"
output.
/A(ppend)
See also: Y, and the redirection options (page 52).
## Usage: TEE is normally used to "split" the output of a
program so that you can see it on the display and also
save it in a file. It can also be used to capture
intermediate output before the data is altered by
another program or command.
TEE gets its input from standard input (usually the
piped output of another command or program), and sends
out two copies: one goes to standard output, the
other to the file or files that you specify. TEE is
not likely to be useful with programs which do not use
standard output, because these programs cannot send
output through a pipe. See page 55 for more
information on pipes.
For example, to search the file DOC for any lines
containing the string "4DOS", make a copy of the
matching lines in 4.DAT, sort the lines, and write
them to the output file 4D.DAT:
c:\> find "4DOS" doc | tee 4.dat | sort > 4d.dat
If you are typing at the keyboard to produce the input
for TEE, you must enter a Ctrl-Z to terminate the
input.
4DOS When using TEE with a pipe under 4DOS, the previous
command writes its output to a temporary file. When
that command finishes, TEE begins operation and can
read the temporary file, display the output, and write
it to the file(s) named in the TEE command.
4OS2, When using TEE with a pipe under 4OS2 or 4DOS/NT, the
4NT programs on the two ends of the pipe run
simultaneously, not sequentially as in 4DOS. See page
56 for more information.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 340
TEE
-------------------------------------------------------------------
Option: /A(ppend): Append the output to the file(s) rather
than overwriting them.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 341
TEXT
-------------------------------------------------------------------
TEXT (New)
Purpose: Display a block of text in a batch file.
Format: TEXT
.
.
.
ENDTEXT
See also: ECHO, SCREEN, SCRPUT, and VSCRPUT.
Usage: TEXT can only be used in batch files.
The TEXT command is useful for displaying menus or
multi-line messages. TEXT will display all subsequent
lines in the batch file until terminated by ENDTEXT.
Both TEXT and ENDTEXT must be entered as the only
command on the line.
To redirect the entire block of text, use redirection
on the TEXT command itself, but not on the actual text
lines or the ENDTEXT line. No environment variable
expansion or other processing is performed on the
lines between TEXT and ENDTEXT; they are displayed
exactly as they are stored in the batch file.
4DOS, If you are running 4OS2, or 4DOS with an ANSI driver
4OS2 loaded, you can change screen colors by inserting ANSI
escape sequences anywhere in the text block. This
will not work in 4DOS/NT, because Windows NT does not
provide ANSI support. You can also use a CLS or COLOR
command in 4DOS, 4OS2, or 4DOS/NT to set the screen
color before executing the TEXT command.
The following batch file fragment displays a simple
menu:
@echo off
cls
screen 2 0
text
Enter one of the following:
1 - Spreadsheet
2 - Word Processing
3 - DOS Utilities
Enter your selection :
endtext
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 342
TIME
-------------------------------------------------------------------
TIME (Compatible)
Purpose: Display or set the current system time.
Format: TIME [hh[:mm[:ss]]] [AM | PM]
hh: The hour (0 - 23).
mm: The minute (0 - 59).
ss: The second (0 - 59).
See also: CHCP and DATE
Usage: If you don't enter any parameters, TIME will display
the current system time and prompt you for a new time.
Press Enter if you don't wish to change the time;
otherwise, enter the new time:
c:\> time
Wed Dec 22, 1993 9:30:10
New time (hh:mm:ss):
TIME defaults to 24-hour format, but you can
optionally enter the time in 12-hour format by
appending "a", "am", "p", or "pm" to the time you
enter.
For example, to enter the time as 9:30 am:
c:\> time 9:30 am
The operating system adds the system time and date to
the directory entry for every file you create or
modify. If you keep both the time and date accurate,
you will have a record of when you last updated each
file.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 343
TIMER
-------------------------------------------------------------------
TIMER (New)
Purpose: TIMER is a system stopwatch.
Format: TIMER [ON] [/1 /2 /3 /S]
ON: Force the stopwatch to restart
/1 (stopwatch #1) /3 (stopwatch #3)
/2 (stopwatch #2) /S(plit)
Usage: The TIMER command turns a system stopwatch on and off.
When you first run TIMER, the stopwatch starts:
c:\> timer
Timer 1 on: 12:21:46
When you run TIMER again, the stopwatch stops and the
elapsed time is displayed:
c:\> timer
Timer 1 off: 12:21:58 Elapsed time: 0:00:12.06
There are three stopwatches available (1, 2, and 3) so
you can time multiple overlapping events. By default,
TIMER uses stopwatch #1.
TIMER is particularly useful for timing events in
batch files. For example, to time both an entire
batch file, and an intermediate section of the same
file, you could use commands like this:
rem Turn on timer 1
timer
rem Do some work here
rem Turn timer 2 on to time the next section
timer /2
rem Do some more work
echo Intermediate section completed
rem Display time taken in intermediate section
timer /2
rem Do some more work
rem Now display the total time
timer
The smallest interval TIMER can measure depends on the
operating system you are using, your hardware, and the
interaction between the two. However, it should never
be greater than .06 second. The largest interval is
23 hours, 59 minutes, 59.99 seconds.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 344
TIMER
-------------------------------------------------------------------
Options: /1: Use timer #1 (the default).
/2: Use timer #2.
/3: Use timer #3.
/S(plit): Display a split time without stopping the
timer. To display the current elapsed time but leave
the timer running:
c:\> timer /s
Timer 1 elapsed: 0:06:40.63
ON: Start the timer regardless of its previous state
(on or off). Otherwise the TIMER command toggles the
timer state (unless /S is used).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 345
[4DOS/NT] TITLE
-------------------------------------------------------------------
TITLE [4DOS/NT] (Compatible)
Purpose: Change the window title.
Format: TITLE "title"
title: The new window title
See also: ACTIVATE and WINDOW.
Usage: TITLE changes the text that appears in the caption bar
at the top of the 4DOS/NT window. It is included only
for compatibility with CMD.EXE. You can also change
the window title with the WINDOW command or the
ACTIVATE command.
The title text must be enclosed in double quotes. The
quotes will not appear as part of the actual title.
To change the title of the current window to "4DOS for
Windows NT":
[c:\] title "4DOS for Windows NT"
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 346
[4DOS] TRUENAME
-------------------------------------------------------------------
TRUENAME [4DOS] (New)
Purpose: Find the full, true path and file name for a file.
Format: TRUENAME file
file: The file whose name TRUENAME will report.
See also: @TRUENAME variable function on page 119.
Usage: Default directories, as well as the JOIN and SUBST
external commands, can obscure the true name of a
file. TRUENAME "sees through" these obstacles and
reports the fully qualified name of a file.
The following example uses TRUENAME to get the true
pathname for a file:
c:\> subst d: c:\util\test
c:\> truename d:\test.exe
c:\util\test\test.exe
TRUENAME requires MS-DOS or PC-DOS 3.0 or above,
DR DOS or Novell DOS 6.0 or above, or OS/2 version 2.0
or above.
TRUENAME can handle simple drive substitutions such as
those created by JOIN, SUBST, or most network drive
mappings. However it may not be able to correctly
determine the true name if you use "nested" JOIN or
SUBST commands, or a network which does not report
true names properly.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 347
TYPE
-------------------------------------------------------------------
TYPE (Enhanced)
Purpose: Display the contents of the specified file(s).
Format: TYPE [/A[[:][-]rhsda] /L /P] file...
file: The file or list of files that you want to
display.
/A(ttribute select) /P(ause)
/L(ine numbers)
See also: LIST.
Selection: Supports extended wildcards, ranges, multiple file
names, and include lists (see pages 59 - 67).
Usage: The TYPE command displays a file. It is normally only
useful for displaying ASCII text files. Executable
files (.COM and .EXE) and many data files may be
unreadable when displayed with TYPE because they
include non-alphanumeric characters.
To display the files MEMO1 and MEMO2:
c:\> type /p memo1 memo2
You can press Ctrl-S to pause TYPE's display and then
any key to continue.
You will probably find LIST to be more useful for
displaying files. However, the TYPE /L command used
with redirection (see page 52) is useful if you want
to add line numbers to a file.
Options: ## /A(ttribute select): Select only those files that have
the specified attribute(s) set. Preceding the
attribute character with a hyphen [-] will select
files that do not have that attribute set. The
attributes are:
R Read-only D Subdirectory
H Hidden A Archive
S System
If no attributes are listed at all (e.g., TYPE /A
...), TYPE will select all files and subdirectories
including hidden and system files. If attributes are
combined, all the specified attributes must match for
a file to be selected. For example, /A:RHS will
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 348
TYPE
-------------------------------------------------------------------
select only those files with all three attributes set.
See page 18 for more information on file attributes.
/L(ine numbers): Display a line number preceding each
line of text.
/P(ause): Prompt after displaying each page. Your
options at the prompt are explained in detail on page
50.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 349
UNALIAS
-------------------------------------------------------------------
UNALIAS (New)
Purpose: Remove aliases from the alias list.
Format: UNALIAS [/Q] alias...
or
UNALIAS *
alias: One or more aliases to remove from memory.
/Q(uiet)
See also: ALIAS and ESET.
Usage: 4DOS, 4OS2, and 4DOS/NT maintain a list of the aliases
that you have defined. The UNALIAS command will
remove aliases from that list. You can remove one or
more aliases by name, or you can delete the entire
alias list by using the command UNALIAS *.
For example, to remove the alias DDIR:
c:\> unalias ddir
To remove all the aliases:
c:\> unalias *
Options: /Q(uiet): Prevents UNALIAS from displaying an error
message if one or more of the aliases does not exist.
This option is most useful in batch files, for
removing a group of aliases when some of the aliases
may not have been defined.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 350
UNSET
-------------------------------------------------------------------
UNSET (New)
Purpose: Remove variables from the environment.
Format: UNSET [/M /Q] name...
or
UNSET *
name: One or more variables to remove from the
environment.
/M(aster environment) /Q(uiet)
See also: ESET and SET.
Usage: UNSET removes one or more variables from the
environment. For example, to remove the variable
CMDLINE:
c:\> unset cmdline
If you use the command UNSET *, all of the environment
variables will be deleted:
c:\> unset *
UNSET is often used in conjunction with the SETLOCAL
and ENDLOCAL commands in order to clear the
environment of variables that may cause problems for
some applications.
For more information on environment variables, see the
SET command and the general discussions on pages 21
and 96.
! Use caution when removing environment variables, and
especially when using UNSET *. Many programs will not
work properly without certain environment variables;
for example, 4DOS depends on PATH and COMSPEC, and
4OS2 uses PATH and DPATH.
Options: ## /M(aster): Remove the variable from the master
4DOS environment rather than the local environment. This
option only makes sense if used in a secondary shell.
/Q(uiet): Prevents UNSET from displaying an error
message if one or more of the variables does not
exist. This option is most useful in batch files, for
removing a group of variables when some of the
variables may not have been defined.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 351
VER
-------------------------------------------------------------------
VER (Enhanced)
Purpose: Display the current command processor and operating
system versions.
Format: VER [/R]
/R(evision level)
Usage: Version numbers consist of a one-digit major version
number, a period, and a one- or two-digit minor
version number. The VER command displays both version
numbers:
c:\> ver
4DOS 5.0 DOS 6.0
4DOS 4DOS's VER command will automatically detect OS/2 and
DR DOS or Novell DOS and display the corresponding
operating system name and version number. For
example:
c:\> ver
4DOS 5.0 OS/2 2.1
Option: /R(evision level): Display the command processor and
operating system internal revision level (if any),
plus your 4DOS, 4OS2, or 4DOS/NT serial number and
registered name.
Under 4DOS, /R also displays whether DOS is loaded
into the high memory area (HMA), is resident in ROM,
or is in normal base memory. This output is only
meaningful in MS-DOS or PC-DOS version 5.0 or above or
in an OS/2 2.x DOS session.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 352
VERIFY
-------------------------------------------------------------------
VERIFY (Compatible)
Purpose: Enable or disable disk write verification or display
the verification state.
Format: VERIFY [ON | OFF]
Usage: DOS and OS/2 maintain an internal verify flag. When
the flag is on, the operating system attempts to
verify each disk write by making sure that the data
written to the disk can be read back successfully into
the computer. It does not compare the data written
with the data actually placed on disk.
4NT Disk write verification cannot actually be enabled or
disabled under Windows NT. 4DOS/NT supports VERIFY as
a "do-nothing" command, for compatibility with
CMD.EXE. This avoids "unknown command" errors in
batch files which use the VERIFY command. The
additional discussion below applies only to 4DOS and
4OS2, and not to 4DOS/NT.
If used without any parameters, VERIFY will display
the state of the verify flag:
c:\> verify
VERIFY is OFF
VERIFY is off when the system boots up. Once it is
turned on with the VERIFY ON command, it stays on
until you use the VERIFY OFF command or until you
reboot.
Verification will slow your disk write operations
slightly (the effect is not usually noticeable).
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 353
VOL
-------------------------------------------------------------------
VOL (Enhanced)
Purpose: Display disk volume label(s).
Format: VOL [d:] ...
d: The drive or drives to search for labels.
Usage: Each disk may have a volume label, created when the
disk is formatted or with the external LABEL command.
Also, every floppy disk formatted with DOS version 4.0
or above, OS/2, or Windows NT has a volume serial
number.
The VOL command will display the volume label and, if
available, the volume serial number of a disk volume.
If the disk doesn't have a volume label, VOL will
report that it is "unlabeled." If you don't specify a
drive, VOL displays information about the current
drive:
c:\> vol
Volume in drive C: is MYHARDDISK
If available, the volume serial number will appear
after the drive label or name.
To display the disk labels for drives A and B:
c:\> vol a: b:
Volume in drive A: is unlabeled
Volume in drive B: is BACKUP_2
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 354
VSCRPUT
-------------------------------------------------------------------
VSCRPUT (New)
Purpose: Display text vertically in the specified color.
Format: VSCRPUT row col [BRIght] [BLInk] fg ON [BRIght] bg
text
row: Starting row number.
col: Starting column number.
fg: Foreground text color.
bg: Background text color.
text: The text to display.
See also: SCRPUT.
Usage: VSCRPUT writes text vertically on the screen rather
than horizontally. Like the SCRPUT command, it uses
the colors you specify to write the text. VSCRPUT can
be used for simple graphs and charts generated by
batch files. It always leaves the cursor in its
current position. See page 26 for details about
colors and color names, and notes on the use of bright
background colors.
The row and column are zero-based, so on a standard 25
line by 80 column display, valid rows are 0 - 24 and
valid columns are 0 - 79. You can also specify the
row and column as offsets from the current cursor
position. Begin the value with a plus sign [+] to
move down the specified number of rows or to the right
the specified number of columns before displaying
text, or with a minus sign [-] to move up or to the
left.
The following batch file fragment displays an X and Y
axis and labels them:
cls bright white on blue
drawhline 20 10 40 1 bright white on blue
drawvline 2 10 19 1 bright white on blue
scrput 21 20 bright red on blue X axis
vscrput 8 9 bright red on blue Y axis
VSCRPUT checks for a valid row and column, and
displays a "Usage" error message if either value is
out of range.
4DOS ## VSCRPUT normally writes text directly to the screen.
If you have an unusual display adapter which does not
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 355
VSCRPUT
-------------------------------------------------------------------
support direct video output, see the OutputBIOS
directive on page 150.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 356
[4OS2, 4DOS/NT] WINDOW
-------------------------------------------------------------------
WINDOW [4OS2, 4DOS/NT] (New)
Purpose: Minimize or maximize the current window, restore the
default window size, or change the window title.
Format: WINDOW [MIN | MAX | RESTORE] [/POS=row,col,width,
height] [/SIZE=rows,columns] ["title"]
title: A new title for the window.
/POS(ition) /SIZE (of screen buffer)
See also: ACTIVATE and TITLE.
Usage: WINDOW is used to control the appearance and title of
the current window. WINDOW MIN reduces the window to
an icon, WINDOW MAX enlarges it to its maximum size,
and WINDOW RESTORE returns the window to its default
size and location on the desktop.
You can use the /POS option to set the location and
size of the window on the desktop. The row and column
values of the /POS option select the window's origin
while the width and height values determine its size.
If you specify a new title, the title text must be
enclosed in double quotes. The quotes will not appear
as part of the actual title.
Options: /POS(ition): Set the window screen position and size.
The syntax is /POS=row, col, width, height where the
values are specified in pixels or pels. Under 4OS2,
row and col refer to the position of the bottom left
corner of the window relative to the bottom left
corner of the screen. Under 4DOS/NT, row and col
refer to the position of the top left corner of the
window relative to the top left corner of the screen.
/SIZE (of screen buffer): Specify the screen buffer
size. The full syntax is /SIZE=rows, columns, where
rows is the number of text rows and columns is the
number of text columns.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 357
Y
-------------------------------------------------------------------
Y (New)
Purpose: Copy standard input to standard output, and then copy
the specified file(s) to standard output.
Format: Y file ...
file: The file or list of files to send to standard
output.
See also: TEE.
## Usage: The Y command copies input from standard input
(usually the keyboard) to standard output (usually the
screen). Once the input ends, the named files are
appended to standard output.
For example, to get text from standard input, append
the files MEMO1 and MEMO2 to it, and send the output
to MEMOS:
c:\> y memo1 memo2 > memos
The Y command is most useful if you want to add
redirected data to the beginning of a file instead of
appending it to the end. For example, this command
copies the output of DIR, followed by the contents of
the file DIREND, to the file DIRALL:
c:\> dir | y dirend > dirall
If you are typing at the keyboard to produce input
text for Y, you must enter a Ctrl-Z to terminate the
input.
! When using Y with a pipe under 4OS2 or 4DOS/NT, you
must take into account that the programs on the two
ends of the pipe run simultaneously, not sequentially.
56 See page for more information.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 358
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
APPENDIX A / ERROR MESSAGES
This appendix lists error messages generated by 4DOS, 4OS2, and
4DOS/NT, and includes a recommended course of action for most
errors. If you are unable to resolve the problem, look through
your Introduction and Installation Guide for any additional
troubleshooting recommendations, then contact JP Software for
technical support (see page 7).
Error messages relating to files are generally reports of errors
returned by the operating system. You may find some of these
messages (for example, "Access denied") vague enough that they are
not always helpful. 4DOS, 4OS2, and 4DOS/NT include the file name
in file error messages, but are often unable to determine a more
accurate explanation of these errors. The message shown is the
best information available based on the error codes returned by the
operating system.
For some errors you are instructed to "restart the session or
reboot the system." This means that you should attempt to correct
the error by closing and restarting the current session under OS/2,
Windows NT, or a DOS task switcher or multitasker (including
Windows). Under DOS without a multitasker or task switcher, you
will probably have to reboot the system to correct the problem.
The following list includes all error messages, in alphabetical
order:
4DOS 4DOS internal stack overflow: You attempted to nest batch
files or commands like DO, EXCEPT, FOR, IF, IFF, GLOBAL, or
SELECT too deep, and 4DOS ran out of stack space. Restructure
your command, alias, or batch file, or use the StackSize
directive in 4DOS.INI to increase 4DOS's internal stack size.
4DOS 4DOS initialization error --: An error occurred during the
4DOS startup process. Look up the rest of the message in this
list for a more specific explanation.
4DOS 4DOS server error --: An error occurred in communication
between 4DOS's resident and transient portions. A more
specific error message follows.
4DOS 4DOS swapping failed, loading in non-swapping mode: None of
the swapping options worked, so 4DOS loaded in non-swapping
mode, which requires about 128K more memory than swapping
mode. Check your Swapping specification in 4DOS.INI, and/or
free some XMS or EMS memory or disk space.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 359
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
4DOS 4DOS unrecoverable error XX: An error occurred in the
resident portion of 4DOS. These errors will terminate
secondary shells and, and may require you to reboot the system
or restart the session if they occur during a primary shell or
if 4DOS cannot continue. The error codes are:
BI Bad function code. Contact JP Software.
DI Same as Disk swap file corrupted.
DR Same as Swap file read error.
DS Same as Swap file seek error.
EI Same as EMS mapping error.
NS No number for new shell. You have started too
many 4DOS secondary shells without properly
exiting some of them, perhaps by closing DESQview
windows rather than EXITing. Clean up any work
in process and reboot the system or restart the
session.
PT Illegal process termination. Contact JP
Software.
TS Terminated inactive shell. Contact JP Software.
XI Same as XMS move failed.
Access denied: You tried to write to or erase a read-only
file, rename a file or directory to an existing name, create a
directory that already exists, remove a read-only directory or
a directory with files or subdirectories still in it, or
access a file in use by another program in a multitasking
system.
4DOS Address table missing: Your 4DOS.COM file is invalid. If you
used an executable file compression program on 4DOS.COM, the
compression may not be compatible with 4DOS. Re-install
4DOS.COM from diskette, or download a new copy.
Alias loop: An alias refers back to itself either directly or
indirectly (i.e., a = b = a), or aliases are nested more than
16 deep. Correct your alias list.
4DOS Attempt to exit from root shell: Another program has probably
destroyed a portion of 4DOS's memory. Reboot the system or
restart the session; if the error persists, contact JP
Software.
Bad disk unit: Generally caused by a disk drive hardware
failure.
4DOS Bad environment: The DOS environment has a bad structure,
probably because a program destroyed 4DOS's master environment
space. Reboot the system or restart the session.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 360
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
Batch file missing: 4DOS, 4OS2, or 4DOS/NT can't find the
batch (.BAT or .CMD) file it was running. It was either
deleted, renamed, moved, or the disk was changed. Correct the
problem and rerun the file.
Can't copy file to itself: You cannot COPY or MOVE a file to
itself. 4DOS, 4OS2, and 4DOS/NT perform full path and
filename expansion before copying to ensure that files aren't
inadvertently destroyed.
Can't create: The command processor can't create the
specified file. The disk may be full or write protected, or
the file already exists and is read-only, or the root
directory is full.
Can't delete: The command processor can't delete the
specified file or directory. The disk is probably write
protected.
Can't get directory: The command processor can't read the
directory. The disk drive is probably not ready.
Can't make directory entry: The command processor can't
create the filename in the directory. This is usually caused
by a full root directory. Create a subdirectory and move some
of the files to it.
Can't open: The command processor can't open the specified
file. Either the file doesn't exist or the disk directory or
File Allocation Table is damaged.
Can't remove current directory: You attempted to remove the
current directory, which the operating system does not allow.
Change to the parent directory and try again.
4DOS Can't set up disk swap file: The disk swap file you specified
cannot be opened. The path or drive is invalid, the disk is
full, DOS is out of file handles, or there is a hardware
problem. Check 4DOS.INI to be sure your Swapping directive is
correct.
Command line too long: A single command exceeded 255
characters in 4DOS or 1023 characters in 4OS2 or 4DOS/NT, or
the entire command line exceeded 511 characters in 4DOS, or
2047 characters in 4OS2 or 4DOS/NT, during alias and variable
expansion. Reduce the complexity of the command or use a
batch file. Also check for an alias which refers back to
itself either directly or indirectly.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 361
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
Command only valid in batch file: You have tried to use a
batch file command, like DO or GOSUB, from the command line or
in an alias. A few commands can only be used in batch files
(see the individual commands for details).
4DOS Command tail too long, truncated: A program attempted to pass
a command in an improper format or a command longer than 126
characters to a 4DOS secondary shell. This is probably a bug
in the program from which 4DOS was loaded. Contact the author
of the program or JP Software for technical assistance.
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: The operating system can't read or write properly
to the device. On a floppy drive, this error is usually
caused by a defective floppy disk, dirty disk drive heads, or
a misalignment between the heads on your drive and the drive
on which the disk was created. On a hard drive, this error
may indicate a drive that is too hot or too cold, or a
hardware problem. Retry the operation; if it fails again,
correct the hardware or diskette problem.
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 or close the
write-protect window if necessary.
4DOS Disk swap file corrupted: The 4DOS disk swapping file
(4DOSSWAP.nnn or xxxxxxxx.4SW) has been moved, deleted, or
damaged by another program. Reboot the system or restart the
session.
Drive not ready -- close door: The floppy disk drive door is
open. Close the door and try again.
4DOS EMS deallocation failed: 4DOS can't deallocate EMS memory
when exiting from a secondary shell. The EMS map has been
corrupted or the memory area used by 4DOS or the EMS driver
has been destroyed by a program. Clean up any work in process
and reboot the system or restart the session.
4DOS EMS map save or restore failed: 4DOS cannot save or restore
the EMS page map. The EMS map has been corrupted, memory has
been destroyed by a program, or you have an incompatible EMS
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 362
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
driver. If this error recurs, try another swapping method,
update your EMS driver, or contact JP Software.
4DOS EMS mapping failed: 4DOS can't map EMS pages when swapping to
or from EMS. The EMS map has been corrupted or the memory
area used by the loader or the EMS driver has been destroyed
by a program. Reboot the system or restart the session.
Environment already saved: You have already saved the
environment with a previous SETLOCAL command. You cannot nest
SETLOCAL / ENDLOCAL pairs.
Error in command-line directive: You used the //iniline
option to place an .INI directive on the startup command line,
or, under 4DOS, on the SHELL= line in CONFIG.SYS, but the
directive is in error. A more specific error message follows.
Error on line [nnnn] of [filename]: There is an error in your
.INI file. The following message explains the error in more
detail. Correct the line in error and restart the command
processor for your change to take effect.
Error reading: The operating system experienced an I/O error
when reading from a device. This is usually caused by a bad
disk, a device not ready, or a hardware error.
Error writing: The operating system experienced an I/O error
when writing to a device. This is usually caused by a full
disk, a bad disk, a device not ready, or a hardware error.
Exceeded batch nesting limit: You have attempted to nest
batch files more than 10 levels deep.
4DOS Fatal error -- please reboot: 4DOS cannot continue due to the
previous error. Reboot the system or restart the session.
File Allocation Table bad: The operating system can't access
the FAT on the specified disk. This can be caused by a bad
disk, a hardware error, or an unusual software interaction.
File exists: The requested output file already exists, and
the command processor won't overwrite it.
File is empty: You attempted to LIST a file with no data (a
zero-byte file).
File not found: 4DOS, 4OS2, or 4DOS/NT couldn't find the
specified file. Check the spelling and path name.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 363
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
General failure: This is usually a hardware problem,
particularly a disk drive failure or a device not properly
connected to a serial or parallel port. Try to correct the
problem, or reboot and try again. Also see Data error above;
the problems described there can sometimes cause a general
failure rather than a data error.
4DOS I/O error in [filename], some directives may not have been
processed: An I/O error occurred while reading your 4DOS.INI
file. There may be a physical problem with data on the disk
or a sharing error on a multitasking system. Check your
4DOS.INI file and try again.
Infinite COPY or MOVE loop: You tried to COPY or MOVE a
directory to one of its own subdirectories and used the /S
switch, so the command would run forever. Correct the command
and try again.
Insufficient disk space: COPY or MOVE ran out of room on the
destination drive. Remove some files and retry the operation.
4DOS Insufficient load space: There is not enough room in 4DOS's
internal memory areas to include all of the options you
requested in 4DOS.INI. Contact JP Software for assistance.
4DOS Internal DOS error: DOS encountered an internal bug and
failed. Reboot the system.
4DOS Invalid AUTOEXEC filename: You specified an invalid path or
filename for the AUTOEXEC file with the /P: startup switch, or
with the DOS_AUTOEXEC setting in an OS/2 DOS session. The
default name will be used instead. Correct the filename, then
reboot the system or restart the session.
Invalid character value: You gave an invalid value for a
character directive in the .INI file.
Invalid choice value: You gave an invalid value for a
"choice" directive (one that accepts a choice from a list,
like "Yes" or "No") in the .INI file.
Invalid color: You gave an invalid value for a color
directive in the .INI file.
Invalid date: An invalid date was entered. Check the syntax
and reenter.
Invalid directive name: 4DOS, 4OS2, or 4DOS/NT can't
recognize the name of a directive in your .INI file.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 364
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
4DOS Invalid DOS version: You need a newer version of DOS to
execute the specified command.
Invalid drive: A bad or non-existent disk drive was
specified.
4DOS Invalid INI file path or name, file not processed: The path
or name for the initialization file on the SHELL= line in
CONFIG.SYS, or on the startup command line, is invalid.
Correct the @d:\path\inifile option to name the correct file.
Invalid key name: You tried to make an invalid key
substitution in the .INI file, or you used an invalid key name
in a keystroke alias or command. Correct the error and retry
the operation.
Invalid numeric [or character] value: You gave an invalid
value for a numeric directive in the .INI file, or for a
character directive in 4DOS.INI.
Invalid parameter: The command processor didn't recognize a
parameter. Check the syntax and spelling of the command you
entered.
Invalid path: The specified path does not exist. Check the
disk specification and/or spelling.
Invalid path or file name: You used an invalid path or
filename in a directive in the .INI file.
4DOS Invalid startup switch, ignored: You passed 4DOS an invalid
option on the SHELL= line in CONFIG.SYS or on the startup
command line for a secondary shell. Correct the switch.
4DOS Invalid Swapping option or path: The swap type or disk swap
path in the 4DOS.INI Swapping directive is invalid. 4DOS
ignores the bad swap type or path and attempts to scan the
rest of the Swapping specification for a valid option.
Multiple errors in the Swapping directive will cause this
message to repeat. Correct 4DOS.INI and reboot the system or
restart the session.
Invalid time: An invalid time was entered. Check the syntax
and reenter.
Keystroke substitution table full: 4DOS, 4OS2, or 4DOS/NT ran
out of room to store keystroke substitutions entered in the
.INI file. Reduce the number of key substitutions or contact
JP Software for assistance.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 365
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
4DOS KSTACK.COM not loaded: You attempted to execute a KEYSTACK
command without loading KSTACK.COM. See the KEYSTACK command
for more information.
Label not found: A GOTO or GOSUB referred to a non-existent
label. Check your batch file.
4DOS Memory [allocation | deallocation] error: 4DOS can't allocate
or deallocate memory while loading, or while reserving or
releasing memory for internal use. DOS memory allocation has
been corrupted, or another application has reserved memory
incorrectly. Reboot the system or restart the session.
4DOS Memory destroyed: The DOS memory control blocks have been
corrupted. Reboot the system or restart the session.
Missing ENDTEXT: A TEXT command is missing a matching
ENDTEXT. Check the batch file.
Missing GOSUB: The command processor 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: An ENDLOCAL was used without a matching
SETLOCAL.
No aliases defined: You tried to display aliases but no
aliases have been defined.
No closing quote: 4DOS, 4OS2, or 4DOS/NT couldn't find a
second matching back-quote [`] or double-quote ["] on the
command line.
No expression: The expression passed to the %@EVAL variable
function is empty. Correct the expression and retry the
operation.
4DOS No file handle available: This is an internal 4DOS disk
swapping error. Change to another swapping method if
possible, and contact JP Software.
No room for INI file name: 4DOS, 4OS2, or 4DOS/NT does not
have enough space to pass the name of your .INI file
to secondary shells; see String area overflow for more
details. Any
[Secondary] section in 4DOS.INI will be ignored in secondary
shells until the problem is corrected and the system or
session is restarted.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 366
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
4DOS No UMBs; loading low: The LOADHIGH (or LH) command can't find
any UMBs for your program. The program is loaded into base
memory. LH and LOADHIGH only work with MS-DOS 5.0 and above,
when the DOS=UMB directive is included in CONFIG.SYS and
sufficient upper memory space is available for the program.
4DOS No upper memory available, low memory will be used for
[resident portion | master environment | global aliases |
global history]: You asked 4DOS to load the block of memory
named in the message into a UMB via the corresponding
directive in 4DOS.INI (UMBLoad, UMBEnvironment, etc.), but no
UMB was available. Check that your XMS driver is properly
installed and/or free up some UMB space in use by another
program.
4DOS Non-DOS disk: DOS can't read the disk. Either the disk is
bad, or it has been formatted by a different operating system.
Reformat it as a DOS disk. Also see Data error above; the
problems described there can sometimes cause a non-DOS disk
error rather than a data error.
Not an alias: The specified alias is not in the alias list.
Not in environment: The specified variable is not in the
environment.
4DOS Not in swapping mode: You attempted to turn swapping on or
off with the SWAPPING command, but 4DOS is loaded in non-
swapping mode.
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.
4DOS Out of environment/alias space: 4DOS has run out of space for
environment variables or aliases. Edit the SHELL line in
CONFIG.SYS or the Environment directive in 4DOS.INI to
increase the environment size, or the Alias directive in
4DOS.INI to increase the alias list size.
Out of memory: The command processor or the operating system
had insufficient memory to execute the last command, or under
DOS, the memory control blocks have been destroyed. If this
error occurs in a 4DOS secondary shell, return to the primary
shell before running the command. Otherwise, try to free some
memory by removing memory-resident programs (under DOS), or
closing other sessions (under OS/2 and Windows NT). If the
error persists, contact JP Software for assistance.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 367
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
4DOS Under 4DOS, if the base memory (DOS RAM) figures reported by
MEMORY are unreasonable, the memory control blocks have
probably been destroyed and you must reboot the system or
restart the session. If you receive this error from DIR when
MEMORY shows sufficient memory for the directory you are
displaying, memory has probably been "fragmented," and
contains a free area larger than 8K but not large enough for
the entire directory. Use a memory mapping program like PMAP,
MAPMEM, or the DOS MEM utility to locate the fragmentation,
and experiment with your TSRs and applications to determine
and remove its cause.
Out of paper: The operating system detected an out-of-paper
condition on one of the printers (LPT1, LPT2, or LPT3). Check
your printer and add paper if necessary.
Overflow: An arithmetic overflow occurred in the %@EVAL
variable function. Check the values being passed to %@EVAL.
%@EVAL can handle 16 digits to the left of the decimal point
and 8 to the right.
Read error: The operating system encountered a disk read
error; usually caused by a bad or unformatted disk.
4DOS Region unavailable, using first available region for [resident
portion | master environment | global aliases | global
history]: You used a 4DOS.INI directive to load the block of
memory named in the message into a specific UMB region, but
that region was unavailable. Check the use of upper memory
for device drivers and other programs loaded before 4DOS,
and/or change the requested region number.
Sector not found: BIOS disk error, usually caused by a bad or
unformatted disk.
Seek error: The operating system can't seek to the proper
location on the disk. This is generally caused by a bad disk
or drive.
Sharing violation: You tried to access a file in use by
another program in a multitasking system or on a network.
Wait for the file to become available, or change your method
of operation so that another program does not have the file
open while you are trying to use it.
String area overflow: The command processor ran out of room
to store the text from string directives in the .INI file.
Reduce the complexity of the .INI file or contact JP Software
for assistance.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 368
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
4DOS Swap file [seek | read | write] failed: 4DOS encountered an
I/O error while accessing the disk swap file (4DOSSWAP.nnn or
xxxxxxx.4SW). The disk was changed, the file has been
destroyed by a program, or 4DOS's memory area has been
overwritten by another program. Reboot the system or restart
the session.
Syntax error: A command or variable function was entered in
an improper format. Check the syntax and correct the error.
4DOS Syntax error in region number or size: You specified an
invalid region number or size in the LH or LOADHIGH command.
Correct the command.
4DOS Too many DR DOS SETs in CONFIG.SYS: The SET commands in your
DR DOS or Novell DOS CONFIG.SYS file exceeded the size of
4DOS's buffer area. Reduce the length of the commands or
contact JP Software for assistance.
4DOS, Too many open files: DOS or OS/2 has run out of file handles.
Try increasing the
4OS2 FILES setting in CONFIG.SYS.
4DOS Transient memory [allocation | deallocation] error: 4DOS
could not reserve or release memory for its transient portion
(probably in a SWAPPING OFF or SWAPPING ON command). The
memory control blocks have been destroyed, or a program has
fragmented memory. Reboot the system or restart the session.
Unbalanced parentheses: The number of left and right
parentheses did not match in an expression passed to the
%@EVAL variable function. Correct the expression and retry
the operation.
Unknown command: A command was entered that 4DOS, 4OS2, or
4DOS/NT didn't recognize and couldn't find in the current
search path. Check the spelling or PATH specification. You
can handle unknown commands with the UNKNOWN_CMD alias (see
171 page ).
Variable loop: A nested environment variable refers to
itself, or variables are nested more than 16 deep. Correct
the error and retry the command.
4OS2, Window title not found: The ACTIVATE or WINDOW command cannot
find a
4NT window with the title you specified. Correct the command and
try again.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 369
APPENDIX A / ERROR MESSAGES
-------------------------------------------------------------------
Write error: The operating system encountered a disk write
error; usually caused by a bad or unformatted disk.
4DOS XMS deallocation failed: 4DOS could not deallocate XMS memory
when exiting a secondary shell. XMS memory has been
destroyed; reboot the system or restart the session.
4DOS XMS move failed: 4DOS could not move data between base memory
and XMS memory while swapping itself. XMS memory has been
destroyed; reboot the system or restart the session.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 370
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
APPENDIX B / ASCII AND KEY CODES
The tables in this section are based on U.S. English conventions.
Your system may differ if it is configured for a different country
or language. See your operating system documentation for more
information about country and language support.
ASCII
To represent the text you type, computers must translate each
letter to and from a number. The code used by all PC-
compatible computers for this translation is called ASCII
(American Standard Code for Information Interchange).
Function keys, cursor keys, and Alt keys do not generate ASCII
codes. For details on these keys and a reference table, see
Keys and Key Codes later in this Appendix.
The ASCII table on the following pages is in three parts.
Each part is described below. The first two parts cover the
128 standard ASCII characters; the third covers the 128
extended ASCII characters used on the IBM PC and compatible
computers. All the tables include a Char column showing the
visual representation of the character, a Dec column showing
the decimal numeric value of the character in the ASCII set,
and a Hex column showing the hexadecimal (base-16) value.
ASCII Control Characters have numeric values between 0 and 31,
and include non-printing characters like carriage return and
line feed. The ASCII standard does not define a visual
representation for these characters, but the IBM PC character
set does define one for most control characters as shown in
the Char column of the table. You can enter these characters
using the key combination shown in the Ctrl column, with a
caret [^] representing the Ctrl key. For example, to enter
character 4, the diamond symbol (^D), press the Ctrl and D
keys together. You can also enter control characters with the
Alt key and the numeric keypad, like extended ASCII codes (see
below). The Name column shows a two or three character "name"
given to each control character as part of the ASCII standard.
ASCII Printing Characters have numeric values between 32 and
127, and include the entire English-language character set as
well as punctuation and other special marks. You enter these
characters by pressing the corresponding keyboard key.
Character 127 has no keyboard key, but can be entered on many
systems by typing Ctrl-Backspace.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 371
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
Extended ASCII Characters have values between 128 and 255 and
include international language characters, line-drawing
characters, and other symbols. You can enter extended ASCII
codes (or other character codes) on the keyboard by holding
down the Alt key, entering the decimal numeric value of the
key on the numeric keypad, and then releasing the Alt key.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 372
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 373
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 374
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
Keys and Key Codes
When you press a single key or a key combination, software
built into your computer (the BIOS or Basic Input / Output
System) translates your keystroke into two numbers: a scan
code, representing the actual key that was pressed, and an
ASCII code, representing the ASCII value for that key. The
BIOS returns these numbers the next time a program requests
keyboard input. This section explains how key codes work; for
information on using them with 4DOS, 4OS2, and 4DOS/NT see the
.INI file (page 143), keystroke aliases (page 165), INKEY
259 (page ), and KEYSTACK (page 266).
Most 4DOS, 4OS2, and 4DOS/NT commands that use the numeric key
codes listed here also use key names, which are usually more
convenient to use than the numeric codes. See page 31 for
more information on key names.
As PCs have evolved, the structure of keyboard codes has
evolved somewhat haphazardly with them, resulting in a
bewildering array of possible key codes. We'll give you a
basic explanation of how key codes work. For a more in-depth
discussion, refer to a BIOS or PC hardware reference manual.
The nuances of how your keyboard behaves depends on the
keyboard manufacturer, the computer manufacturer who provides
the built-in BIOS, and your operating system. As a result, we
can't guarantee the accuracy of the information below for
every system, but the discussion and reference table should be
accurate for most systems. Our discussion is based on the
101-key "enhanced" keyboard commonly used on 286, 386, 486,
and Pentium computers, but virtually all of it is applicable
to the 84-key keyboards on older systems. The primary
difference is that older keyboards lack a separate cursor pad
and only have 10 function keys.
All keys have a scan code, but not all have an ASCII code.
For example, function keys and cursor keys are not part of the
ASCII character set (see page 371) and have no ASCII value,
but they do have a scan code. Some keys have more than one
ASCII code. The A, for example, has ASCII code 97 (lower case
"a") if you press it by itself. If you press it along with
Shift, the ASCII code changes to 65 (upper case "A"). If you
press Ctrl and A the ASCII code changes to 1. In all these
cases, the scan code (30) is unchanged because you are
pressing the same physical key.
Things are different if you press Alt-A. Alt keystrokes have
no ASCII code, so the BIOS returns an ASCII code of 0, along
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 375
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
with the A key's scan code of 30. This allows a program to
detect all the possible variations of A, based on the
combination of ASCII code and scan code.
Some keys generate more than one scan code depending on
whether Shift, Ctrl, or Alt is pressed. This allows a program
to differentiate between two different keystrokes on the same
key, neither of which has a corresponding ASCII value. For
example, F1 has no ASCII value so it returns an ASCII code of
0, and the F1 scan code of 59. Shift-F1 also returns an ASCII
code 0; if it also returned a scan code of 59, a program
couldn't distinguish it from F1. The BIOS or operating system
translates scan codes for keys like Shift-F1 (and Ctrl-F1 and
Alt-F1) so that each variation returns a different scan code
along with an ASCII code of 0.
On the 101-key keyboard there's one more variation: non-ASCII
keys on the cursor keypad (such as up-arrow) return the same
scan code as the corresponding key on the numeric keypad, for
compatibility reasons. If they also returned an ASCII code of
0, a program couldn't tell which key was pressed. Therefore,
these keys return an ASCII code of 224 rather than 0. This
means that older programs, which only look for an ASCII 0 to
indicate a non-ASCII keystroke like up-arrow, may not detect
these cursor pad keys properly.
The number of different codes returned by any given key varies
from one (for the spacebar) to four, depending on the key, the
design of your keyboard, and the BIOS or operating system.
Some keys, like Alt, Ctrl, and Shift by themselves or in
combination with each other, plus Print Screen, SysReq, Scroll
Lock, Pause, Break, Num Lock, and Caps Lock keys, do not have
any code representations at all. The same is true of
keystrokes with more than one modifying key, like Ctrl-Shift-
A. The BIOS or operating system may perform special actions
automatically when you press these keys (for example, it
switches into Caps Lock mode when you press Caps Lock), but it
does not report the keystrokes to whatever program is running.
Programs which detect such keystrokes access the keyboard
hardware directly, a subject which is beyond the scope of this
manual.
The following table lists all of the keys on the 101-key
"enhanced" keyboard. The keys are arranged roughly in scan
code order, which is generally left to right, moving from the
top of the keyboard to the bottom.
Column 1 shows the key's keycap symbol or name. Columns 2 and
3 show the scan code, and the ASCII code if the key is
unshifted. Columns 4 and 5 contain the codes for the shifted
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 376
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
key. Columns 6 and 7 show the codes for Ctrl plus the key.
The last column contains the scan code for Alt plus the key
(Alt keystrokes have no ASCII code and always generate an
ASCII code of 0, which is not shown).
Key names prefaced by np are on the numeric keypad. Those
prefaced by cp are on the cursor keypad between the main
typing keys and the number keypad. The numeric keypad values
are valid if Num Lock is turned off. If you need to specify a
number key from the numeric keypad, use the scan code shown
for the keypad and the ASCII code shown for the corresponding
typewriter key. For example, the keypad "7" has a scan code
of 71 (the np Home scan code) and an ASCII code of 54 (the
ASCII code for "7").
The chart is blank for key combinations that are not reported
at all by the BIOS, like Ctrl-1 and Alt-PgUp.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 377
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
Scan Codes and Key Codes for Top Two Keyboard Rows
Shift Shift Ctrl Ctrl Alt
Key Cap Scan ASCII Scan ASCII Scan ASCII Scan
Symbol Code Code Code Code Code Code Code
Esc 1 27 1 27 1 27 1
1 ! 2 49 2 33 120
2 @ 3 50 3 64 3 0 121
3 # 4 51 4 35 122
4 $ 5 52 5 36 123
5 % 6 53 6 37 124
6 ^ 7 54 7 94 7 30 125
7 & 8 55 8 38 126
8 * 9 56 9 42 127
9 ( 10 57 10 40 128
0 ) 11 48 11 41 129
- _ 12 45 12 95 12 31 130
= + 13 61 13 43 131
Backspace 14 8 14 8 14 127 14
Tab 15 9 15 0 148 0 165
Q 16 113 16 81 16 17 16
W 17 119 17 87 17 23 17
E 18 101 18 69 18 5 18
R 19 114 19 82 19 18 19
T 20 116 20 84 20 20 20
Y 21 121 21 89 21 25 21
U 22 117 22 85 22 21 22
I 23 105 23 73 23 9 23
O 24 111 24 79 24 15 24
P 25 112 25 80 25 16 25
[ { 26 91 26 123 26 27 26
] } 27 93 27 125 27 29 27
Enter 28 13 28 13 28 10 28
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 378
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
Scan Codes and Key Codes for Bottom Two Keyboard Rows
Shift Shift Ctrl Ctrl Alt
Key Cap Scan ASCII Scan ASCII Scan ASCII Scan
Symbol Code Code Code Code Code Code Code
A 30 97 30 65 30 1 30
S 31 115 31 83 31 19 31
D 32 100 32 68 32 4 32
F 33 102 33 70 33 6 33
G 34 103 34 71 34 7 34
H 35 104 35 72 35 8 35
J 36 106 36 74 36 10 36
K 37 107 37 75 37 11 37
L 38 108 38 76 38 12 38
; : 39 59 39 58 39
' " 40 39 40 34 40
` ~ 41 96 41 126 41
\ | 43 92 43 124 43 28 43
Z 44 122 44 90 44 26 44
X 45 120 45 88 45 24 45
C 46 99 46 67 46 3 46
V 47 118 47 86 47 22 47
B 48 98 48 66 48 2 48
N 49 110 49 78 49 14 49
M 50 109 50 77 50 13 50
, < 51 44 51 60 51
. > 52 46 52 62 52
/ ? 53 47 53 63 53
Space 57 32 57 32 57 32 57
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 379
APPENDIX B / ASCII AND KEY CODES
-------------------------------------------------------------------
Scan Codes and Key Codes for Key Pads and Function Keys
Shift Shift Ctrl Ctrl Alt
Key Cap Scan ASCII Scan ASCII Scan ASCII Scan
Symbol Code Code Code Code Code Code Code
F1 59 0 84 0 94 0 104
F2 60 0 85 0 95 0 105
F3 61 0 86 0 96 0 106
F4 62 0 87 0 97 0 107
F5 63 0 88 0 98 0 108
F6 64 0 89 0 99 0 109
F7 65 0 90 0 100 0 110
F8 66 0 91 0 101 0 111
F9 67 0 92 0 102 0 112
F10 68 0 93 0 103 0 113
F11 133 0 135 0 137 0 139
F12 134 0 136 0 138 0 140
np * 55 42 55 42 150 0 55
np Home 71 0 71 55 119 0
cp Home 71 224 71 224 119 224 151
np Up 72 0 72 56 141 0
cp Up 72 224 72 224 141 224 152
np PgUp 73 0 73 57 132 0
cp PgUp 73 224 73 224 132 224 153
np Minus 74 45 74 45 142 0 74
np Left 75 0 75 52 115 0
cp Left 75 224 75 224 115 224 155
np 5 76 0 76 53 143 0
np Right 77 0 77 54 116 0
cp Right 77 224 77 224 116 224 157
np Plus 78 43 78 43 144 0 78
np End 79 0 79 49 117 0
cp End 79 224 79 224 117 224 159
np Down 80 0 80 50 145 0
cp Down 80 224 80 224 145 224 160
np PgDn 81 0 81 51 118 0
cp PgDn 81 224 81 224 118 224 161
np Ins 82 0 82 48 146 0
cp Ins 82 224 82 224 146 224 162
np Del 83 0 83 46 147 0
cp Del 83 224 83 224 147 224 163
np / 224 47 224 47 149 0 164
np Enter 224 13 224 13 224 10 166
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 380
GLOSSARY
-------------------------------------------------------------------
GLOSSARY
Some items in this glossary refer to features or to terms which are
discussed in more detail elsewhere in this manual. Be sure to
check the index to see if more information is available on a
particular feature or term.
4EXIT: A batch file which is executed whenever a secondary
4DOS, 4OS2, or 4DOS/NT shell ends.
4START: A batch file which is executed whenever 4DOS, 4OS2,
or 4DOS/NT is started, either as a primary shell or a
secondary shell.
Alias: A shorthand name for a command or series of commands.
Alias Parameter: A numbered variable (e.g. %2) included in an
alias definition, allowing a different value to be used in the
alias each time it is executed.
AND: A logical combination of two true or false conditions.
If both conditions are true, the result is true; if either
condition is false, the result is false.
ANSI.SYS: A device driver supplied with DOS which provides
enhanced screen display and keyboard macros, or one of the
many similar programs.
APM: A standardized system used by manufacturers of battery-
powered computers to report battery status and control power
management features.
Append: Concatenation of one file or string onto the end of
another (this use is not related to the DOS and OS/2 external
command named APPEND).
Application: A program run from the command prompt or a batch
file. 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 (most backup programs clear
this attribute). Also sometimes refers to a single file (such
as a .ZIP file) which contains a number of other files in
compressed form.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 381
GLOSSARY
-------------------------------------------------------------------
Argument: See Parameter.
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 numbers, or other information
that cannot be sensibly interpreted as text.
Attribute: A characteristic of a file which can be set or
cleared. The standard attributes are Read-Only, Hidden,
System, and Archive.
Automatic Directory Change: A 4DOS, 4OS2, and 4DOS/NT feature
which allows you to change directories by typing the directory
name and a backslash [\] at the prompt.
Base Memory: Under DOS, 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 or 655,360 bytes of the computer's memory.
Base Name: The file name without a drive, path, or extension.
For example, in the file name C:\DIR1\LETTER.DAT the base name
is LETTER.
BAT File: Same as a Batch File.
Batch File: A text file containing a sequence of commands for
the command processor to execute. 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 Parameter: A numbered variable (e.g. %2) 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. See also Character Device.
Boot: The process of starting the computer and loading the
operating system into memory.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 382
GLOSSARY
-------------------------------------------------------------------
Boot Directory: The current directory at the time the system
is booted, usually 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 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 to speed up execution.
Buffer: An area of memory set aside for storage. For
example, disk buffers are used to save information as it is
transferred between your program and the disk, and the
keyboard buffer holds keystrokes until a program can use them.
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. See also Block Device.
Code Page: A set of definitions which tells DOS or OS/2 how
to get and display date, time, and other information in the
format appropriate to a particular country.
Command Completion: A 4DOS, 4OS2, and 4DOS/NT 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, 4OS2, and 4DOS/NT feature which
retains commands you have executed, so that they can be
modified and re-executed later.
Command History Window: A pop-up window used by 4DOS, 4OS2,
and 4DOS/NT to display the command history, allowing you to
choose a previous command to modify and/or execute.
Command Processor: A program which interprets commands and
executes other programs. Sometimes also called a Command
Interpreter.
Command Recall: See Command History.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 383
GLOSSARY
-------------------------------------------------------------------
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 find
the command processor to start a secondary shell.
Conditional Commands: A 4DOS, 4OS2, and 4DOS/NT feature
allowing commands to be executed or skipped depending on the
results of a previous command. See also Exit Code.
Console: The PC keyboard and display.
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.
Country Code: See Code Page.
CPU: The Central Processing Unit which performs all logic and
calculations in a computer. In PC-compatible systems, the CPU
is on a single microprocessor chip.
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 a physical or
hardware problem with input, output, or network access, which
prevents a program from continuing.
Current Directory: The directory in which all file operations
will take place unless otherwise specified.
Date Range: A 4DOS, 4OS2, and 4DOS/NT feature which allows
you to select files based on the date and time they were last
modified.
Description: A string of characters assigned to describe a
file with the 4DOS, 4OS2, or 4DOS/NT DESCRIBE command.
Destination: In file processing commands (e.g. COPY or MOVE),
the name or directory files should have after any copying or
modification has taken place, generally the last specification
on the command line. See also Source.
Device: A physical device for input or output such as the
console, a communications port, or a printer. Sometimes
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 384
GLOSSARY
-------------------------------------------------------------------
"device" is used to refer to character devices, and excludes
block devices.
Device Driver: A program which allows the operating system to
communicate with a device, and which is loaded into memory
when the system boots. Device drivers are also used to manage
memory or for other similar internal functions.
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.
Directory History: A 4DOS, 4OS2, and 4DOS/NT feature which
allows you to recall recently-used directory names in a window
and choose one to switch to.
Disk Swapping: A type of swapping in which the transient
portion of 4DOS is stored on disk while an application is
running.
DOS Memory: See Base Memory.
DOS Session: See Session.
Echo: See Command Echoing.
EMS Memory: Under DOS, memory which conforms to the Lotus /
Intel / Microsoft Expanded Memory Specification (LIM EMS),
which allows programs to access large amounts of memory
outside of base memory or extended memory.
EMS Swapping: A type of swapping in which 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". See also Master Environment
and Passed Environment.
Environment Variable: The name of a single entry in the
environment.
Errorlevel: A numeric value between 0 and 255 returned from
an external command to indicate its result (e.g., success,
failure, response to a question). See also Exit Code.
Escape Character: In some contexts, the 4DOS, 4OS2, or
4DOS/NT escape character, which is used to suppress the normal
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 385
GLOSSARY
-------------------------------------------------------------------
meaning of or give special meaning to the following character.
In other cases, the specific ASCII character ESC. The meaning
must be determined from the context.
Executable Extensions: A 4DOS, 4OS2, and 4DOS/NT 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, usually with the extension .COM or
.EXE, which can be loaded into memory and run as a program.
Exit Code: The result code returned by an external command or
an internal command. 4DOS, 4OS2, and 4DOS/NT internal
commands return an exit code of 0 if successful, or non-zero
if unsuccessful. See also Errorlevel.
Expansion: The process 4DOS, 4OS2, and 4DOS/NT go through
when they scan a command line and substitute the appropriate
actual values for aliases, alias parameters, batch file
parameters, and environment variables. See also Parsing.
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), 386, 486, or Pentium-based computer system which
is above the 1 MB (one megabyte, or 1024*1024 bytes) of memory
that DOS can address directly. See also XMS.
Extended Parent Directory Names: A 4DOS, 4OS2, and 4DOS/NT
feature which allows you to use additional periods in a
directory name to represent directories which are successively
higher in the directory tree.
Extended Wildcard: A 4DOS, 4OS2, and 4DOS/NT feature which
allows you to use multiple wildcard characters, extending the
traditional wildcard syntax. See also Wildcard.
Extension: The final portion of a file name, preceded by a
period. For example, in the file name C:\DIR1\LETTER.DAT the
extension is .DAT.
External Command: A program which resides in an executable
file, as opposed to an internal command which is part of the
command processor.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 386
GLOSSARY
-------------------------------------------------------------------
FAT File System: The traditional file system used by DOS to
store files on diskettes and hard disks; also supported by
OS/2 and Windows NT. Uses a File Allocation Table to keep
track of allocated and unallocated space on the disk.
File Attribute: See Attribute.
File Description: See Description.
Filename Completion: A 4DOS, 4OS2, and 4DOS/NT feature which
allows you to type part of a filename on the command line, and
have the command processor fill in the rest for you.
Free Memory: Usually, the amount of base memory (under DOS)
or total memory (under OS/2 and Windows NT) which is
unoccupied and available for applications.
Hidden: A file attribute indicating that the file should not
be displayed with a normal DIR command, and should not be made
available to programs unless they specifically request access
to hidden files.
History: See Command History.
History Window: See Command History Window and Directory
History.
HPFS or High Performance File System: A file system
distributed with OS/2 and Windows NT which allows longer file
names and provides better performance than the traditional FAT
file system.
Include List: A concise method of specifying several files or
groups of files in the same directory, for use with all 4DOS,
4OS2, and 4DOS/NT commands which take file names as arguments.
.INI File: The 4DOS, 4OS2, or 4DOS/NT initialization file
containing directives which set the initial configuration of
the command processor.
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.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 387
GLOSSARY
-------------------------------------------------------------------
Keyboard Buffer: A buffer which holds keystrokes you have
typed that have not yet been used by the currently executing
program.
Keystroke Alias: An alias assigned to a key, so that it can
be invoked or recalled with a single keystroke.
Label: A marker in a batch file, with the format :name,
allowing GOTO and GOSUB commands to "jump" to that point in
the file. 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.
Memory Resident Mode: A method of installing 4DOS in which
swapping is disabled, and all of 4DOS remains permanently
resident in memory.
Modulo: The remainder after an integer division. For example
11 modulo 3 is 2, because when 11 is divided by 3 the
remainder is 2.
Multiple Commands: A 4DOS, 4OS2, and 4DOS/NT feature which
allows multiple commands to be placed on a line, separated by
a caret [^] in 4DOS, an ampersand [&] in 4OS2 and 4DOS/NT, or
another, 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 OS/2,
Windows, Windows NT, and DESQview.
NTFS or New Technology File System: A file system distributed
with Windows NT with characteristics similar to HPFS. See
also HPFS.
Non-Swapping Mode: See Memory Resident Mode.
Operating System: A collection of software which loads when
the computer is started, provides services to other software,
and ensures that programs don't interfere with each other
while they are running.
Option: See Switch.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 388
GLOSSARY
-------------------------------------------------------------------
OR: A logical combination of two true or false conditions.
If both conditions are false the result is false; if either
condition is true the result is true.
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: A piece of additional information placed after a
command or function name. For example, in the command DIR
XYZ, XYZ is a parameter. Also used to refer to an alias
parameter or batch file parameter.
Parsing: The process 4DOS, 4OS2, and 4DOS/NT perform when
they analyze the command line, perform alias and environment
variable expansion, and find 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.
Path: A specification of all the directories a file resides
in. 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 by the operating system when the system boots or a
session opens.
RAM Disk: A pseudo "disk drive", created by software, which
appears like a normal physical disk drive to programs.
Sometimes also called a "virtual disk."
Range: See Date Range, Size Range, and Time Range.
Read-Only: A file attribute indicating that the file can be
read, but not written or deleted by the operating system or
the command processor unless special commands are used.
Reboot: The process of restarting the computer, usually by
pressing the Ctrl, Alt, and Del keys simultaneously.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 389
GLOSSARY
-------------------------------------------------------------------
Redirection: A method for collecting output from a program in
a file, and/or of providing the input for a program from a
file. See also Pipe.
Resident Portion: The small portion of 4DOS stored
permanently in memory when swapping mode is in use, as opposed
to the larger transient portion.
Root Directory: The first directory on any disk, from which
all other directories are "descended." The root directory is
referenced with a single backslash [\].
Secondary Shell: Any copy of the command processor which is
started by another program, rather than by the operating
system.
Session: A general term for the individual windows or tasks
started by a multitasking system. For example, under OS/2 you
might run an OS/2 program in one session, and a DOS program in
another.
Shell: See Command Processor. Also used to refer to a
program which gives access to DOS functions and commands
through a menu- or mouse-driven system.
Size Range: A 4DOS, 4OS2, and 4DOS/NT feature which allows
you to select files based on their size.
Source: In file processing commands (e.g. COPY or MOVE), the
original files before any copying or modification has taken
place, i.e., those specified earlier on the command line. See
also Destination.
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, Standard Input, and Standard Output: The
file(s) or character device(s) where a program respectively
displays error messages, obtains its normal input, and
displays its normal output. Standard error, standard input,
and standard output always refer to the console, unless
redirection is used.
Subdirectory: Any directory other than the root directory.
Swap File: A disk file created by 4DOS to store its transient
portion when disk swapping is in use.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 390
GLOSSARY
-------------------------------------------------------------------
Swapping: A 4DOS feature which removes the larger transient
portion of 4DOS from base memory while an application is
running, leaving the maximum possible amount of memory for the
application.
Switch: A parameter for 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".
System: A file attribute indicating that the file belongs to
the operating system or command processor, and should not be
accessed by other programs.
Target: See Destination.
Time Range: A 4DOS, 4OS2, and 4DOS/NT feature which allows
you to select files based on the time they were last modified.
Transient Portion: The larger portion of 4DOS stored in
memory temporarily when swapping is in use, as opposed to the
smaller resident portion.
TSR: A DOS Terminate and Stay Resident program, i.e., a
program which "terminates" but remains resident in memory, to
provide features 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 base memory, but within the 1 megabyte of memory that
DOS can address directly.
Variable: See Alias Parameter, Batch File Parameter, and
Environment Variable.
Virtual Disk: See RAM Disk.
Volume Label: A special, hidden file placed on any disk,
whose name constitutes a "label" for the entire disk.
White Space Character: A character used to separate arguments
on the command line. The white space characters recognized by
4DOS, 4OS2, and 4DOS/NT are the space, tab, and comma.
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. See also Extended Wildcard.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 391
GLOSSARY
-------------------------------------------------------------------
XMS Memory: A software method for accessing extended memory
under DOS. XMS memory is not additional memory, but is a
software specification only.
XMS Swapping: A type of swapping where the transient portion
of 4DOS is stored in XMS memory while an application is
running.
XOR (exclusive OR): A logical combination of two true or
false conditions. If both conditions are false or both
conditions are true the result is false; if either condition
is true and the other is false the result is true.
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 392
Index
-------------------------------------------------------------------
* (asterisk)
Index as file name "wildcard", 59
in alias name, 165
in alias value, 163
Conventions: Most fully to temporarily disable an
capitalized terms (e.g., ECHO, alias, 48, 88, 163
SELECT) are command names
unless otherwise noted. ., see Current directory
.., see Parent directory
Special Characters /, in command switches, 156
; (semicolon)
## advanced topic mark, 3, 34, in HPFS and NTFS file
158 names, 17, 62
! warning mark, 3, 158 in include lists, 67
$ (dollar sign), as parameter ? as file name "wildcard", 59
character, 140, 325 ? command, 159
in batch files, 82
@ sign, see also Variable
% sign functions
and alias parameters, 168 for key codes, 32
and batch file parameters, in a keystroke alias,
81 166
and environment variables, in file names, 16
96, 97 in INKEY results, 259
in file names, 16 to define a keystroke
use with variable alias, 165
functions, 108 to override batch file
%# and %n& echo, 81, 223, 305
changing parameter to override command history
character, 140, 325 save, 37
in aliases, 168 to read a file in FOR, 238
in batch files, 82, 330
%0 to %127 ^ (caret)
in aliases, 168 as command separator, 137,
in batch files, 81, 330 323
as escape character, 138,
& (ampersand) 324
as command separator, 137,
323 || (or) in conditional
as parameter character, commands, 71
140, 325
in batch files, 82 4
&& (and) in conditional
commands, 71 4DOS
and DESQview, 149
and disk caching software,
149
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 393
Index
-------------------------------------------------------------------
4DOS (continued) Aliases (continued)
and DR DOS, 255, 269, 352 editing, 227
and HPFS files, 17 examples, 77, 87, 89
and MS-DOS 5.0 and above, expansion, 50, 122
269 and batch file
and Novell DOS, see 4DOS debugging, 90
and DR DOS disabling, 327
and SMARTDRV, see Microsoft nested, 122
SMARTDRV, 392 global, 134, 169
and Windows, see Microsoft storing in upper
Windows memory, 135
configuration, 126 in batch files, 87
memory usage, 136 inheritance, in secondary
resident portion, loading shells, 149
in upper memory, 136 internal variables in, 169
REXX support in, 95 keystroke, 79, 165
stack size, 150 and key assignments,
4DOS/NT 143
configuration, 126 automatic execution of,
EXTPROC support in, 96 74, 79, 166
REXX support in, 95 local, 134, 169
4EXIT, 86 memory space for, 103, 131,
location of, 131 280
4OS2 multiple commands in, 162
configuration, 126 nested, 78, 122, 163
EXTPROC support in, 96 order of execution, 122
REXX support in, 95 parameters, 168, 169
4START, 85, 108 expansion, 122
location of, 131 reading from a file, 171
removing, 350
A saving in a file, 167
saving temporarily, 329
Abort, Retry, Fail message, see sharing between 4DOS, 4OS2,
Critical errors and 4DOS/NT, 74
ACTIVATE command, 160 storing in upper memory,
Advanced Power Management 135
status, 103 suspending execution of,
Advanced topic mark, see v 293
ALIAS command, 20, 161 variable functions in, 120,
Aliases, 77, 161 169
and executable extensions, And (&&) in conditional
69 commands, 71
and QUIT, 301 .AND., in IF and IFF, 251, 255,
asterisk in name, 165 257
asterisk in value, 163 ANSI driver, 25
back-quotes in, 125, 162, and CLS, 185, 323
167, 172 and COLOR, 186, 323
defining default command and PROMPT, 298
options with, 163, 168 and screen colors, 143
disabling, 48, 88, 163, 327 and scrolling, 326
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 394
Index
-------------------------------------------------------------------
ANSI driver (continued) Batch files (continued)
and TEXT, 342 detecting 4DOS, 4OS2, or
detecting, 103 4DOS/NT from, 86
escape sequences, 74, 298, displaying messages in,
342 223, 225, 310, 312, 342,
use by 4DOS, 137 355
APM, see Advanced Power echoing of commands, 81,
Management 137, 223, 326
Appending files, 187 environment variables in,
Archive attribute, see File 82
attributes handling Ctrl-Break, 288
Argument quoting, 123 handling errors, 288
Arguments, see Parameters handling strings in, 91,
Arithmetic, 112 327
ASCII, 22 internal variables in, 82,
Asterisk, see * 108
At sign, see @ sign interrupting, 85
ATTRIB, 173 keyboard input in, 259, 262
Attributes, see File attributes labels in, 245, 246
AUTOEXEC.BAT, 86 line numbers in, 89, 104
location of, 131 modes, 80, 276
parameters for, 132 names of, 82, 104
speeding up, 339 nesting, 104, 179
starting KSTACK.COM, 57, parameters, 81, 330
266 expansion, 122
Automatic batch files, 85 samples, 84
Automatic directory changes, 47 saving environment in, 329
screen display, 219, 221,
B 222
sharing between 4DOS, 4OS2,
Backspace character, 74 and 4DOS/NT, 74
Base memory, see Memory string processing in, 91,
Base name, see File names 327
.BAT files, 20, 80, 276 subroutines, 245, 309
Batch files, 80 suspending execution of,
aliases in, 87, 88 293
and executable extensions, temporary variables in, 83
69 terminating, 180, 301
and redirection, 53 timing events in, 344
automatic, 85 variable functions in, 82,
based on command history, 120
249 BATCOMP.EXE, 93
branching in, 246 BEEP, 83, 137, 176
calling, 179 Beeps
capturing output of, 90 frequency of, 137
chaining, 179 length of, 137
commands for, 83, 154 BIOS output
comments in, 305 and color-coded directory
compression, 93 displays, 31
debugging, 89 and DRAWBOX, 220
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 395
Index
-------------------------------------------------------------------
BIOS output (continued) Colors (continued)
and DRAWHLINE, 221 in directories, 30
and DRAWVLINE, 222 in history window, 139
and LIST, 274 in LIST, 142, 274
and SCRPUT, 312 in PROMPT, 298
and SELECT, 316 in SELECT, 142, 315
and VSCRPUT, 355 names of, 26
BIOS output, in 4DOS, 150 numbers for, 26
Border colors, see Colors of border, 27
Boxes, drawing, on screen, 219 of boxes, 219
BREAK, 177 of lines, 221, 222
.BTM files, 20, 80, 276 of text, 312, 342, 355
of typed input, 36, 142
C setting defaults, 141, 185,
186
CALL, 83, 179 setting, in 4START, 108
CANCEL, 83, 179, 180, 301 standard, 142
Caps Lock key, 264 testing, 104, 105
Carriage return character, 74 Command grouping, 71. see also
in keystroke aliases, 166 EXCEPT, FOR, GLOBAL, and IF
Case (upper / lower), 18, 107, and redirection, 53, 72
141, 326 Command history, see History
CD, 181 list
CDD, 183 Command line, 34
CDFS file system, 116 arguments, see Parameters
CDPATH environment variable, automatic directory
43, 47, 98, 182, 183, 300 changes, 47
Changing directories, 43, 47, echoing of, 223, 224
181, 183, 294, 299 editing, 35, 144, 145
CHCP, 184 editing mode, 35, 138, 325
CHDIR, 181 expanded, viewing, 224
CLS, 83, 185 filename completion, 41
.CMD files, 20, 80, 276 help, 48
CMDLINE environment variable, history, 36. see also
99 History list
Code pages, see Country code history window, 40
Cold reboot, 303 input method, 140, 325
COLOR, 83, 186 multiple commands, 47
Color-coded directory displays, processing of, 19, 121
30, 142, 206, 315 prompt, 295
and redirection, 206 Command parsing, 121
COLORDIR environment variable, Command processor, 10
30, 99, 206, 315 Command Reference Guide, 153
Colors Command separator, 47, 75, 102,
and ANSI driver, 25, 143, 137, 323
323 disabling, 327
blinking text, 28 in IFF, 257
bright background, 28, 141, Command tail, 19, 121
323 COMMAND.COM message server, 149
errors in, 27
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 396
Index
-------------------------------------------------------------------
Commands Ctrl-Break
conditional execution of, at file processing prompt,
257 51
external, 19, 153, 290 at page prompt, 50
and /? help, 49 checking, 177, 288
exit codes for, 102 during DELAY, 200
format of, 155 during INKEY, 259, 262, 293
help for, 48, 248 during SELECT, 314
internal, 19, 153 in batch files, 85, 288
disabling, 159, 324 in external programs, 102
length of, 35, 48, 50 Ctrl-C, see Ctrl-Break
list of, 159 Ctrl-X, see Escape character
new, 155 Ctrl-Z end of file mark, and
order of execution, 122 COPY, 191
types of, 155 CTTY, 54, 194
unknown, handling, 171 Current drive and directory, 16
Comments changing, see Changing
in .INI file, 127 directories
in alias files, 172 retrieving, 104
in batch files, 305 saving temporarily, 299,
in environment variable 329
files, 321 Cursor
Compatibility between 4DOS, positioning, 310, 312, 355
4OS2, and 4DOS/NT, 74 shape, 138, 326
Compound character, see Command
separator D
Compressed drives, 209, 316
COMSPEC environment variable, Daily execution of batch file,
99, 127, 351 120
Conditional commands, 71 DATE, 195
disabling, 327 time format, 137
CONFIG.SYS, 12 Date ranges, 62
Configuration, of 4DOS, 4OS2, Dates, formatting, 117
and 4DOS/NT, 98, 126 Day of week, 105
CONsole device, 194. see also Default directory, see Current
Standard input, Standard drive and directory
output, and Standard error Default drive, see Current
Coprocessor, see Numeric drive and directory
coprocessor DEL, 196
COPY, 187 DELAY, 200
and ctrl-Z end of file DELDIR environment variable,
mark, 191 197, 285
and extended attributes, Delete tracking, 197
190 Deleting files, 196
Country code, 23, 104, 184, 195 DESCRIBE, 144, 201
Critical errors, 51, 102 DESCRIPT.ION, see File
automatic Fail response, descriptions
148 Descriptions, see File
detecting, 288 descriptions
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 397
Index
-------------------------------------------------------------------
DESQview DOS
and 4DOS, 149 commands, help for, 48, 153
and secondary shells, 129 compatibility box, see OS/2
detecting, 105, 108 DOS sessions
DETACH, 203 default command processor,
Detecting 4DOS, 4OS2, or 11
4DOS/NT from a batch file, 86 memory, see Memory
DIR, 204 DOS/V (Japan), 150
and include lists, 68 DPATH, 218
color-coded displays, 30, DPMI (DOS Protected Mode
142, 206 Interface) status, 105
and CTTY, 194 DRAWBOX, 83, 219
and redirection, 206, DRAWHLINE, 83, 221
210 DRAWVLINE, 83, 222
directory size limits, 208 Drive, see Disk drives
displaying file
descriptions, and E
redirection, 207, 212
time format, 137 ECHO, 223
DIRCMD environment variable, 99 ANSI sequences in, 74
Directories, see Subdirectories at command line, 224
Directory history, 45 in batch files, 81, 83, 89,
and secondary shells, 46 305
local and global, 45 default state, 137, 326
size of, 132 inheritance, 179
storing in upper memory, ECHOS, 83, 225
135 Editing aliases and environment
window, 45 variables, 227
Directory stack, 299 ELSE and ELSEIFF, in IFF, 257
clearing, 294 EMS, see Memory
displaying, 214 ENDDO, in DO, 215
Directory tree, 15 ENDIFF, in IFF, 257
DIREXIST test, in IF and IFF, ENDLOCAL, 83, 88, 226, 329, 351
255 ENDTEXT, 84, 342
DIRS, 214, 294, 299 Environment, 21, 96, 319
Disk drives, 14 master, 98, 118, 228, 320,
compressed, 209, 316 351
drive letter, 14 saving temporarily, 329
space on, 112, 242 size of, 97, 132, 320
swapping to, 134, 339 displaying, 280
testing status of, 118 testing, 105
volume label, 117, 354 storing in upper memory,
write verification on, 353 136
Display colors, see Colors Environment variables, 22, 96,
DO, 83, 215 319
and GOTO, 216 and INKEY, 259
and INPUT, 262
characters in name, 97
creating, 319
displaying, 319
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 398
Index
-------------------------------------------------------------------
Environment variables Extended attributes
(continued) and COPY, 190
editing, 227 and MOVE, 283
expansion, 50, 122 Extended key codes, see Keys
and batch file Extended memory, see Memory
debugging, 90 Extended parent directory
disabling, 327 names, 59
nested, 97 Extension, see File names
for current directory, in External commands, see Commands
Windows NT, 100 EXTPROC support, in 4OS2 and
nesting, 97 4DOS/NT, 96
reading from a file, 321
referencing, 96 F
removing, 351
spaces in, 320 FAT file system, 14
ERASE, 196 detecting, 116
Error level, see Exit codes file names, 16
Error messages, 359 path length, 16
ERRORLEVEL test, in IF and IFF, File attributes, 18, 173
254 and COPY, 190, 192
Errors, handling, in batch and DEL, 198
files, 288 and DIR, 204, 209, 212
Escape character, 73, 75, 102, and EXCEPT, 229
138, 324 and FOR, 240
ESET, 98, 144, 227, 320 and GLOBAL, 243
and PATH, 290 and MOVE, 285
EXCEPT, 72, 229 and REN, 307
and DEL /Z, 198 and SELECT, 316
Executable extensions, 20, 68, of subdirectories, 174
123, 290 setting, 173
and filename completion, 42 subdirectory, 174
and Personal REXX, 95 testing, 111
wildcards in, 70 viewing, 173
EXIST test, in IF and IFF, 255 volume label, 174
EXIT, 231 File descriptions, 201
Exit codes, 123 controlling processing of,
and CALL, 179 138, 324
and CANCEL, 180 displaying, and
and conditional commands, redirection, 207, 212
71 file name for, 105, 148,
and DEL, 197 201
and EXIT, 231 length of, 138, 201, 206,
and GLOBAL, 243 315
and IF tests, 254 retrieving, 112
and PROMPT, 295 selecting files by, 205,
and QUIT, 301 210, 316, 317
retrieving, 102 sorting by, 211, 235, 318
Expanded memory, see Memory
Extended ASCII, see ASCII
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 399
Index
-------------------------------------------------------------------
File names, 13, 16, 58 FOR, 72, 84, 237
alternate, under Windows and GOSUB, 239
NT, 111, 213 Form feed character, 74
FAT-compatible, 17 FREE, 242
HPFS and NTFS, 17 Free memory, see Memory
extensions, 18
quoting, 17 G
semicolons in, 17, 62
length of, 16, 58 General Concepts, 10
parts of, 13 GLOBAL, 72, 243
separating, 113, 114, Glossary, 381
116, 118 GOSUB, 83, 245, 309
shorthand for, 58 and FOR, 239
unique, 119 GOTO, 83, 246
File processing prompts, 50 and DO, 216
File system, see FAT file and IFF, 258
system, HPFS file system, and
NTFS file system H
Filename completion, 41
window, 42 HELP, 48, 248
Files, 13 and external commands, 153
adding line numbers to, 348 books to load, in 4OS2, 132
copying, 187 location of files, in 4DOS,
date stamp, 19, 113, 195, 133
204 options, in 4DOS, 132
deleting, 196 Hidden attribute, see File
displaying, 272, 348 attributes
finding, 115 HISTORY, 249
forcing deletion of, 197, History list, 36, 249
285 and secondary shells, 40,
moving, 282, 306 170
processing data from, 114, controlling, 139, 250
117 global, 39, 134
reading, in FOR, 238 storing in upper
renaming, 306 memory, 136
searching for, 118 inheritance, in secondary
selecting, 58, 313 shells, 149
with date, time, and local, 39, 134
size ranges, 62 local and global, 134
with extended parent memory space for, 280
directory names, 59 reading from a file, 250
with include lists, 67 size of, 133
with multiple History windows
filenames, 66 colors of, 139
with wildcards, 59 command line, 40
size of, 115, 204 directory, 45
time stamp, 19, 115, 204, position of, 139, 140
343 size of, 139, 140
true path of, 119, 347 HMA, see Memory
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 400
Index
-------------------------------------------------------------------
HPFS file system, 14 Input and output, commands for,
and 4DOS, 17 154
and DIR, 208, 211, 213 Installable file systems
and file descriptions, 202 (OS/2), 15, 116
and SELECT, 318 INT 2E support (4DOS), 149
detecting, 116 Internal commands, see Commands
file dates and times, 66 Internal variables, 100. see
file names, 17, 58, 326 also Quick Reference on page
path length, 16 407
semicolons in file names, in aliases, 169
17, 62 in batch files, 82, 108
time stamps in, 212 International character sets,
23, 184, 220, 221, 222, 371
I ISALIAS test, in IF and IFF,
255
IF, 72, 84, 251 ISDIR test, in IF and IFF, 255
conditions, 252 ISINTERNAL test, in IF and IFF,
IFF, 84, 257 255
and GOSUB, 245 ISWINDOW test, in IF and IFF,
and GOTO, 258 255
conditions, 252 ITERATE, in DO, 215
Include lists, 67
.INI file, 126 J
advanced directives, 148
and installation, 126 JOIN (DOS command), 347
and SETDOS, 129, 136, 322
changing, for secondary K
shells, 148
color directives, 141 KEYBD, 264
comments in, 127 Keyboard
configuration directives, Caps Lock, Num Lock, and
136 Scroll Lock, 264
directive types, 130 checking buffer, 105, 260,
directives, 127. see also 263
Quick Reference on page clearing buffer, 260, 263,
407 266
errors in, 128, 133, 134 Keys, 265
global section, 128 codes, 22, 375
initialization directives, ASCII, 22, 371
131 extended ASCII, 23
key mapping directives, 143 F11 and F12, using, 32
location of, and mapping, 143
multitaskers, 129 clearing default key
primary section, 128 map, 148
prompts during execution, for all input, 144
133 for command line
secondary section, 128 editing, 145
INKEY, 84, 89, 259 for history windows,
INPUT, 84, 144, 262 146
for LIST, 147
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 401
Index
-------------------------------------------------------------------
Keys (continued) Memory (continued)
names, 31, 165 upper memory blocks (UMBs)
KEYSTACK, 57, 84, 90, 266 and LOADHIGH, 269
Keystroke aliases, see Aliases loading 4DOS in, 136
KSTACK.COM, 57, 266 storing aliases in, 135
storing directory
L history in, 135
storing environment in,
Labels, in batch files, 245, 136
246 storing history in, 136
LEAVE, in DO, 215 Memory resident programs, see
LH, 269 TSRs
LIM EMS, see Memory Messages, displaying, 223, 225
Line feed character, 74 Microsoft SMARTDRV, and 4DOS,
Lines, drawing, on screen, 221, 150
222 Microsoft Windows
LIST, 272 and screen colors, 29
default colors, 142 and secondary shells, 129
keys used with, 144, 147 detecting, 107
print device for, 141 MKDIR, 279
screen size, 141, 326 Monitor, detecting type of, 106
LOADBTM, 80, 84, 276 Monochrome monitor, and colors,
LOADHIGH, 269 27
LOG, 90, 277 MOVE, 282
Log files, time format, 137 and extended attributes,
Lower case, 141, 326 283
and SELECT, 283
M MSGBOX, 287
Multiple commands, 47
Master environment, see disabling, 327
Environment in aliases, 162
MD, 279 separator character, see
Memory, 280 Command separator
base Multiple filenames, 66
amount of, 112
DOS in, 352 N
expanded (EMS)
amount of, 112, 280 Netware, see Novell Netware
swapping to, 134, 339 Networks
extended (XMS) disk swapping on, 151
amount of, 120, 280 drive names on, 14
swapping to, 134, 339 NOT, in IF and IFF, 251, 255,
extended, amount of, 113, 257
280 Novell Netware, and 4DOS, 150,
free, 280 151
high memory area (HMA) NTFS file system, 14
DOS in, 352 and DIR, 208, 211, 213
status of, 280 and file descriptions, 202
and SELECT, 318
detecting, 116
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 402
Index
-------------------------------------------------------------------
NTFS file system (continued) PATH environment variable, 99
file dates and times, 66 "." in, 291
file names, 17, 58, 326 and @SEARCH variable
path length, 16 function, 118
semicolons in file names, changing, 227, 290
17, 62 format of, 290
short file names, 111, 213 invalid directory in, 292
time stamps on, 212 length of, 291
Num Lock key, 264 viewing, 290
Numbers, comparing, 252 Path, of a file, 13, 16
Numeric coprocessor, 106 and aliases, 78
Numeric strings extracting from full file
formatting, 111 name, 118
testing for, 118 finding full path name, 116
finding true path, 119, 347
O if omitted, 16
in executable extensions,
ON, 288 69
Operating system, 10 in include lists, 67
detecting, 105 length of, 16
Options, in commands, 156 PAUSE, 84, 89, 293
Or (||) in conditional Percent sign, see % sign
commands, 71 Personal REXX, 95
.OR., in IF and IFF, 251, 255, Pipes, 55, 340
257 disabling, 327
OS/2 in 4OS2 and 4DOS/NT, 56
and screen colors, 29 nested, 56
commands, help for, 153 testing for, 106
default command processor, POPD, 214, 294, 299
11 Previous working directory,
detecting, 105 saving and restoring, 44,
DOS sessions, 105, 151 182, 183
extended attributes Primary shell, see Shell
and, 190, 283 [Primary], see .INI file
in OS/2 version 2.0, Printer
13, 107 checking status of, 117
sending control codes to,
P 74
sending files to, 187
Paged output, 50, 141 use in LIST, 274
Parameter character, 75 PROMPT command, 295
Parameters ANSI sequences in, 74, 298
expansion, 122 changing for secondary
in aliases, 168, 169 shell, 108
in batch files, 81, 330 PROMPT environment variable, 99
Parent directory, 16, 59, 181, Prompt Solution, The, 6
183, 279 PUSHD, 214, 294, 299
PATH command, 290
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 403
Index
-------------------------------------------------------------------
Q S
Quick reference Scan codes, see Keys
.INI file directives, 410 Screen, 84, 310. see also
internal variables, 407 Colors
variable functions, 409 clearing, 185
QUIT, 84, 179, 180, 301 reading text from, 118
Quoting size, 24, 141, 326
of arguments, 123 detecting, 104, 106
of file names, 17 Scroll Lock key, 264
SCRPUT, 84, 312
R Search path, see PATH
environment variable
RAM, see Memory Secondary shell, see Shell
RAM disk, 14 [Secondary], see .INI file
swapping to, 134 SELECT, 313
Ranges (date, time, and size), and command grouping, 72
62 and include lists, 68
RD, 302 and MOVE, 283
Read-only attribute, see File color-coded displays, 30,
attributes 142, 315, 317
REBOOT, 303 default colors, 142, 315
Redirection, 52 keys used with, 144
alternative methods, 340, screen size, 141, 326
358 time format, 137
and batch files, 53 Semicolon, see ;
and color-coded directory SET, 98, 319
displays, 206 SETDOS, 322
and command grouping, 53, /A(NSI), 137, 185, 186, 323
72 /B(rightBG), 28, 142, 323
and NoClobber, 54, 325 /C(ompound character), 75,
capturing batch file 137, 323
output, 90 /D(escriptions), 138, 324
disabling, 327 /E(scape character), 75,
nested, 54 138, 324
preventing file overwrites, /I(nternal), 159, 255, 324
140 /L(ine), 140, 325
with numeric file handles, /M(ode), 138, 325
54 /N(o clobber), 140, 325
Registration, 6 /P(arameter character), 75,
REM, 84, 305 82, 141, 325
REN, 282, 306 /R(ows), 141, 326
RENAME, 282, 306 /S(hape), 138, 326
RETURN, 83, 245, 309 /U(pper), 107, 141, 210,
REXX support, 95 234, 326
RMDIR, 302 /V(erbose), 81, 137, 326
Root directory, 15 /X (expansion), 48, 93, 97,
111, 123, 125, 327
/Y (single step), 89, 328
and .INI file, 129, 322
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 404
Index
-------------------------------------------------------------------
SETLOCAL, 83, 84, 88, 329, 351 Swapping, 134
Shell, 1 enabling and disabling, 339
level, 106, 296 file names used by, 134,
primary, 12 151
secondary, 12 types of, 134
inheritance, 129, 149, SWAPPING command, 339
322 Switches, in commands, 156
SHIFT, 82, 84, 330 System
SHRALIAS program, 40, 46, 170 attribute, see File
Size ranges, 62 attributes
SMARTDRV, see Microsoft rebooting, 303
SMARTDRV, 392
Sound, see BEEP T
Stack size, in 4DOS, 150
Standard error, 52 Tab character, 74
Standard input, 52, 275, 340, Technical support, 7
358 TEE, 56, 340
Standard output, 52, 340, 358 TEMP environment variable, 100
START, 84, 331 TEMP4DOS environment variable,
Startup command line, viewing, 100
in 4START, 85 TEXT, 84, 342
Status tests, in IF and IFF, THEN, in IFF, 257
254 TIME, 343
Stopwatch, see TIMER Time ranges, 62
Strings Time, format of, 137
comparing, 252 TIMER, 84, 119, 344
formatting, 111, 116 time format, 137
testing for numeric digits, Times, formatting, 117
118 TITLE, 346
Subdirectories, 15 TRUENAME, 347
attributes of, 174 TSRs
changing, see Changing and .BTM files, 276
directories and SETLOCAL, 329
copying, 192 and swapping state, 339
creating, 279 TYPE, 348
deleting files from, 198
descriptions for, 201 U
executing commands in, 243
hidden, 243 UMBs, see Memory
moving, 282, 285 UNALIAS, 88, 350
name, maximum length of, 16 Unknown commands, handling, 171
removing, 198, 285, 302 UNKNOWN_CMD alias, 21, 171
renaming, 306 and IFF, 247
testing for, 255 UNSET, 83, 98, 351
Subdirectory attribute, see UNTIL, in DO, 215
File attributes Upgrades, 6
SUBST (DOS command), 347 Upper case, 141, 326
Support, 7 Upper memory, see Memory
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 405
Index
-------------------------------------------------------------------
V Windows NT
and screen colors, 29
Variable expansion, see default command processor,
Environment variables, 11
expansion detecting, 105
Variable functions, 108. see
also Quick Reference on page X
407
in aliases, 120, 169 XMS, see Memory
in batch files, 82, 120 .XOR., in IF and IFF, 251, 255,
VER, 352 257
VERIFY, 193, 286, 353
Version numbers, 103, 105, 352 Y
Vertical text display, 355
Video hardware, 24. see also Y, 56, 358
Screen
detecting, 106, 107 Z
Virtual disk, see RAM disk
VOL, 354 Zero length files, creating,
Volume, see Disk drives 54, 305
Volume label, see Disk drives
Volume label attribute, see
File attributes
VSCRPUT, 84, 355
W
Warm reboot, 303
Warning mark, see !
WHILE, 215
Wildcards, 59
and @SEARCH variable
function, 118
and filename completion, 42
and renaming
subdirectories, 308
extended, 60
and DEL, 198
in executable extensions,
70
in include lists, 67
in multiple filenames, 66
WINDOW, 357
Windows, see also Microsoft
Windows
controlling state of, 136,
160, 357
size of, 136
title of, 160
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 406
Quick Reference
-------------------------------------------------------------------
Quick Reference
Internal Variables
This table lists the 4DOS, 4OS2, and 4DOS/NT internal variables by
type, with a page reference for each.
Hardware status _DNAME 105 Dates and times
_ENV 105
_APMAC 103 _HLOGFILE 105 _DATE 104
_APMBATT 103 _KSTACK 105 _DAY 104
_APMLIFE 103 _LOGFILE 105 _DOW 105
_CPU 104 _PID 106 _DOY 105
_KBHIT 105 _PIPE 106 _HOUR 105
_MONITOR 106 _PPID 106 _MINUTE 105
_NDP 106 _PTYPE 106 _MONTH 106
_VIDEO 107 _SHELL 106 _SECOND 106
_SID 106 _TIME 107
_SWAPPING 106 _YEAR 107
Operating system _TRANSIENT 107
and software status _WINTITLE 107
_ANSI 103 Error codes
_BOOT 104
_CODEPAGE 104 Screen and colors ? 102
_COUNTRY 104 ?? 102
_DOS 105 _BG 104 _? 102
_DOSVER 105 _COLUMN 104 _SYSERR 107
_DPMI 105 _COLUMNS 104
_DV 105 _FG 105
_MOUSE 106 _ROW 106 Compatibility
_WIN 107 _ROWS 106
_WINDIR 107 = 102
_WINSYSDIR 107 + 102
_WINVER 107 Drives and
directories
Command processor _CWD 104
status _CWDS 104
_CWP 104
_4VER 103 _CWPS 104
_ALIAS 103 _DISK 105
_BATCH 104 _LASTDISK 105
_BATCHLINE 104
_BATCHNAME 104
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 407
Quick Reference
-------------------------------------------------------------------
Variable Functions
This table lists the 4DOS, 4OS2, and 4DOS/NT variable functions by
type, with a page reference for each.
System status @FILETIME 115 Numbers and
@FILEWRITE 115 arithmetic
@DOSMEM 112 @FILEWRITEB 115
@EMS 112 @FINDCLOSE 115 @COMMA 111
@EXTENDED 113 @FINDFIRST 115 @DEC 112
@MASTER 118 @FINDNEXT 115 @EVAL 112
@READSCR 118 @LINE 117 @INC 116
@XMS 120 @LINES 117 @INT 117
@SEARCH 118 @NUMERIC 118
@TRUENAME 119 @RANDOM 118
Drives and devices @UNIQUE 119
@CDROM 111 Dates and times
@DEVICE 112 File names
@DISKFREE 112 @DATE 112
@DISKTOTAL 112 @EXT 113 @MAKEAGE 117
@DISKUSED 112 @FILENAME 114 @MAKEDATE 117
@FSTYPE 116 @FULL 116 @MAKETIME 117
@LABEL 117 @NAME 118 @TIME 119
@LPT 117 @PATH 118
@READY 118
@REMOTE 118 Utility
@REMOVABLE 118 Strings and
characters @ALIAS 111
@EXEC 113
Files @ASCII 111 @IF 116
@ATTRIB 111 @CHAR 111 @REXX 118
@ALTNAME 111 @FORMAT 116 @SELECT 119
@DESCRIPT 112 @INDEX 116 @TIMER 119
@EXETYPE 113 @INSTR 116
@FILEAGE 113 @LEN 117
@FILECLOSE 113 @LOWER 117
@FILEDATE 113 @REPEAT 118
@FILEOPEN 114 @SUBSTR 119
@FILEREAD 114 @TRIM 119
@FILES 114 @UPPER 120
@FILESEEK 114 @WORD 120
@FILESEEKL 114
@FILESIZE 115
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 408
Quick Reference
-------------------------------------------------------------------
.INI File Directives
This table lists the 4DOS, 4OS2, and 4DOS/NT .INI file directives
by type, with a page reference for each.
Initialization CursorOver 138 Advanced
DescriptionMax 138
4StartPath 131 Descriptions 138 All Products
Alias 131 EditMode 138 ClearKeyMap 148
AutoExecPath 131 EscapeChar 138 DescriptionName148
AutoExecParms 132 EvalMax 138 NextINIFile 148
DirHistory 132 EvalMin 139
Environment 132 HistCopy 139 4DOS Only
EnvFree 132 HistLogName 139 CritFail 148
HelpBook 132 HistMin 139 DiskReset 149
HelpOptions 132 HistWinColors 139 DVCleanup 149
HelpPath 133 HistWinHeight 139 FullINT2E 149
History 133 HistWinLeft 139 Inherit 149
INIQuery 133 HistWinTop 140 MessageServer 149
LocalAliases 134 HistWinWidth 140 NetwareNames 150
LocalDirHistory134 LineInput 140 OutputBIOS 150
LocalHistory 134 LogName 140 StackSize 150
PauseOnError 134 NoClobber 140 SwapReopen 151
Swapping 134 ParameterChar 140 UniqueSwapName 151
UMBAlias 135 Printer 141
UMBEnvironment 136 ScreenColumns 141
UMBDirHistory 135 ScreenRows 141 Key Mapping
UMBHistory 136 UpperCase 141
UMBLoad 136 General Input
WindowHeight 136 Backspace 144
WindowState 136 Color BeginLine 144
WindowWidth 136 Del 144
WindowX 136 BrightBG 141 DelToBeginning 144
WindowY 136 ColorDir 142 DelToEnd 144
InputColors 142 DelWordLeft 144
ListColors 142 DelWordRight 144
Configuration ListStatBarColors Down 144
142 EndLine 144
AmPm 137 SelectColors 142 EraseLine 144
ANSI 137 SelectStatBarColors ExecLine 144
BatchEcho 137 142 Ins 144
BeepFreq 137 StdColors 142 Left 144
BeepLength 137 NormalKey 145
CommandSep 137 Right 145
CursorIns 138
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 409
Quick Reference
-------------------------------------------------------------------
Up 145
WordLeft 145
WordRight 145
Command Line
Editing
AddFile 145
CommandEscape 145
DelHistory 146
EndHistory 146
Help 146
NextFile 146
NextHistory 146
NormalEditKey 146
PopFile 146
PrevFile 146
PrevHistory 146
SaveHistory 146
History Window
DirWinOpen 146
HistWinBegin 146
HistWinDel 147
HistWinEdit 147
HistWinEnd 147
HistWinExec 147
HistWinOpen 147
NormalHWinKey 147
LIST
ListFind 147
ListHex 147
ListHighBit 147
ListInfo 147
ListNext 147
ListPrint 147
ListWrap 147
NormalListKey 147
-------------------------------------------------------------------
Copr. 1994, JP Software Inc. 4DOS, 4OS2, 4DOS/NT Reference / 410