Debug

Debug is a byte editor that enables files to be viewed and modified at the byte level. It is generally recommended that this utility is not used by the faint of heart or when under the influence of drugs or alcohol. There is no "undo" command, so make a backup before playing, eh?

Syntax:

DEBUG [filename]

Once Debug has been called, the somewhat cryptic "Debug prompt", a hyphen (-), is displayed. At the prompt, the following "Debug commands" are valid:

Command
Parameters
Action

?
.
This list of Debug commands.

A
[address]
assemble

C
range address
compare

D
[startaddress [endaddress|L range]]
Displays (part of) a segment of memory. By default startaddress is offset 100 of the first free segment of memory, or offset 100 of the segment containing a file loaded by Debug. The default endaddress is 017F (ie. a range of 128 bytes).

E
address [list]
enter

F
range list
fill

G
[=address] [addresses]
go

H
value1 value2
hex

I
port
input

L
-
Loads a previously "named" (see N) file into memory where it can be viewed/edited.

L
number
Used with commands accepting a "range" argument to denote a number of bytes. Typically used in arguments as: startaddress L number. If number should take endaddress past the end of the segment, then number is truncated so the endaddress is the last byte of the segment.

M
range address
move

N
[path] filename [arglist]
"Names" a file for Debug. A file must be "named" before it can be loaded for viewing/editing.

O
port byte
output

P
[=address] [number]
proceed

Q
.
Exit Debug.

R
[register]
register

S
range list
search

T
[=address] [value]
trace

U
[range]
unassemble

W
[address] [drive] [firstsector] [number]
write

XA
[#pages]
allocate expanded memory

XD
[handle]
de-allocate expanded memory

XM
[Lpage] [Ppage] [handle]
map expanded memory pages

XS
.
display expanded memory status

Notes

Debug.exe is one of those little programs that, in the hands of a skilled user, is an amazingly powerful tool with which one can view and edit the contents of memory both short term (RAM) and long term (hard/floppy/tape media). One can also compile (and, up to a point, decompile) assembly language code.

After struggling for some time to come to grips with the ins and outs of Debug, I have finally decided to leave the explanations to others.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Debug.exe
c:\windows\command
7.0
Win95
20 522
11/07/95
win95_02.cab

7.1
Win95 (OSR2.x)
20 554¹
24/08/96
win95_02.cab

Win98
20 554¹
11/05/98
win98_40.cab

Win98 SE
20 554¹
23/04/99
win98_45.cab

Superscripts denote which same size files, if any, are identical (using FC).

Further Reference

DOS Debug Tutorial - Fran Golden
A comprehensive guide to Debug that starts with an introduction to machine code, moves on to assembly language

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

MS-Dos7 Commands

Frames Version(index in side panel)
No Frames Version

Introduction to what these pages are all about.

The Commands:

Accdate
Attrib
Break
Buffers
Call
CD/ChDir
CHCP
ChkDsk

Choice
Cls
Command
Copy
Country
CTTY
Date
Del

DelTree
Device
Dir
DiskCopy
Dos
DrivParm
Echo
Erase

Exit
FC
FCBS
Files
Find
For
Format
GoTo

If
Install
Label
LastDrive
LfnFor
Lock
MD / MkDir
Mem

Mode
More
Move
Mscdex
Nlsfunc
NumLock
Path
Pause

Prompt
RD / RmDir
Rem / ;
Ren
Set
SetVer
Share
Shell

Shift
Sort
Stacks
Start
Subst
Switches
Sys
Time

Truename
Type
Unlock
Ver
Verify
Vol
Xcopy
`

The Utilities

Debug
DosKey
DrvSpace
Edit
Extract
Fdisk
Scandisk
SmartDrv

The Device Drivers

Ansi.sys
Display.sys
DblBuff.sys
DblSpace.sys
DrvSpace.sys

Emm386.exe
Himem.sys
RamDrive.sys
Setver.exe
`

And...

File Specification Shortcuts
( . .. ... \ )
Wildcards
( * ? )
Redirection
( > >> < | )

Links to important and useful Dos related sites on the Web.

Download these pages.

Bob Watson's Home Page

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
September 2, 2000.

Links to Other Dos Sources

Command Lists

Build Your Own DOS 7 Manual - Walter Zackery (1998)
A lead in to a downloadable batch file that compiles all the inbuilt help (as given by Command /?) for the various Dos 7 commands into a Wordpad document.

MS-DOS 7 Reference Manual
- (New York Medical College)
An HTML version of the results of running Walter Zackery's batch file (see above)

MS-DOS Reference
- Marcus Houlden (1999)
This site includes a listing of all Dos commands from all versions along with syntax and brief notes. There is also a history of the Dos versions with comments on the major features included with each upgrade.

MSDOS help and commands
- Computer Hope
This site covers a wide range of Dos subjects ranging from a brief description of the commands (including undocumented switches), error codes, an introduction to batch files, some Debug scripts, and an FAQ covering miscellaneous DOS related hardware and software issues.

Help
- Benny Pedersen
A comprehensive listing of MS-Dos 6.22 commands along with syntax, notes, and examples.

(Untitled)
- Kevin Tekel
A comprehensive list of undocumented Dos commands and switches in easily downloadable text format. Covers all versions of Dos.

Using Dos

As far as I have been able to find, there are no comprehensive on-line sources for learning about Dos. Furthermore, I have yet to come across any books on using Dos 7.x (though several books on Win95 discuss how to work with Dos programs under Win95).

Anyone wishing to understand how to use Dos 7 is probably best advised to pick up one of the "heavy" guides to Dos 6.2 (from library or second hand bookstore) and couple this with the Dos chapter of a Win95 guide.

Having said that, there is:

[Dos Tutorial]
- Paul Butterwick (1999)
An excellent beginner's tutorial (complete with examples and questions). It covers most of the standard Dos commands, and how to set up Autoexec. bat and Config.sys - but is geared primarily at users of Dos 6. (There is also a pretty good hardware troubleshooting guide on the same site).

Understanding and Getting Around in DOS
- The AIM Lab (U. of Illinois)(1995)
A very basic introduction to Dos for those who are not just new to Dos but also new to computing. The examples indicate the page's age, but otherwise, just as true now as it was then.

CAMOSUN COLLEGE - ELEX 130
- Suzanne J. Baril (Camosun College)(2000)
Although this site is primarily a college course site, it includes online classnotes including "Dos Tutorial Parts 1 & 2" and "Dos Batch Tutorial Parts 1 & 2".

Guide to CONFIG.SYS & AUTOEXEC.BAT version 3.04
Peter H. S. Madsen (1999)
An excellent page on how to set up Config.sys and Autoexec.bat for running under Win 9x with explanations on all the lines used and their significance. Also has advice on setting up Dosstart.bat and Winstart.bat. A downloadable version of the page is available

Batch Files

DOS Batch Language
- Ted Davis (1998)
Excellent comprehensive site devoted to batch files from introduction to advanced techniques. Easy to read, easy to understand, and easy to follow.

Batfiles - The DOS batch file programming handbook
- Laurence Soucy (1997)
Another excellent comprehensive treatment of batch files. The author has made a point of including numerous examples with detailed explanatory notes.

DOS Batch Files
- Anon
An introduction to batch files covering the basic concepts of putting together a batch file and exploring how some commands can be "stretched" to add to their versatility.

Batch File Contents (Updated, Dec 98)
- Tom Lavedas
This site is devoted to extending the power of batch file programming to its limits. Some of the procedures are convoluted but explanations of some trickier parts are given.

Batch Programming Stuff
- Terry Newton (1998)
Contents page leading to a mass of diverse material on batch files including working batch files, links to other batch file sites, and his Batch Guide (see below).

Batch Guide
- Terry Newton (1998)
Although the first section deals with basic batch file techniques, things quickly move on.
Topics covered include:

Menus

Processing lists of data

Launching programs and retrieving data therefrom.

DOS Batch Programming
- Anon (199?)
Easy-to-read site concentrating on dealing with common batch file problems such as accepting user input and manipulation of numbers/strings. Includes numerous examples of functional batch files that will do everything from shutting down Win95 to "Play all your sounds with just enough delay between sounds to let the cat relax".

DOS Batch Programming Elements
- Dirk van Deun (1997)
A collection of batch routines (along with commentaries) that demonstrate how things that can't be done with batch files can be done.
Topics covered include:

Input

Output

String Manipulation

Mathematical routines

Database management and file processing/parsing

Getting date, time, current drive, directory and version number

General data structures and programming techniques

Generating random values

Object Oriented Programming

Manipulating file date and time

No Title
(The Hidden Strengths of the Dos Batch Language)
- Dirk van Deun (1994)
A remarkable description of the development of a complex batch program. Although a full commentary is given, the logic is enough to make a neophyte's brain sore!

Partitioning Hard Drives

The Partition FAQ
An excellent source on disk partitioning - explains in detail the how's, why's, and what's of partitioning (and boot managers). Discusses the relative merits of FDISK and third party partitioning software.

FDISK.COM - Fdisk Information
Actually, not much about Fdisk.com, but a well annotated selection of links about hard disks including partitioning, boot managers, and disk cloning tools.

Ranish Partition Manager
- Mikhail Ranish (Sept. '99)
Apart from being the source of the Rannish Partion Manager, this site has some detailed information about hard disks, partitions, and how they work. There is also a useful set of related links.

Freeware and Shareware

Simtel.Net MS-DOS Page
A massive collection of Dos programs and utilities.

Free Software For DOS
Richard L. Green (2000)
The title page just about says it all: "Reviews, descriptions, links to over 500 DOS programs (no games). Freeware and free-for-private-use shareware listed (no commercial programs listed)." Good reviews.

Interesting DOS Programs
Dev Anand Teelucksingh (2000)

A comprehensive set of links to commercial and shareware Dos program sites. An excellent starting point for finding a selection of Dos HTML editors or whatever.

Newsgroups

There are a number of newsgroups devoted to MS-Dos questions, answers, and discussion.

alt.msdos.batch
The newsgroup for questions and comments relating to batch files. At the time of writing there are nine or ten very knowledgable people who contribute regularly and virtually no question goes unanswered. Indeed, the speed of response and counter response is quite staggering bearing in mind the subject matter!
Unfortunately, some of these experts don't get on too well with each other and there is an occasional descent to "You're wrong", "No, I'm not", "Yes you are, admit it", which can became a bit embarassing to the onlooker. [c. 50 messages/day]

comp.os.msdos.misc

comp.os.msdos.apps

microsoft.public.win95.msdosapps

It is also possible to browse the Compuserve Dos Forum, though non-subscribers cannot take part in the discussions. Although much slower than browsing the standard newsgroups, topics do seem to be discussed in rather more depth than is typical elsewhere.

Computing.Net - DOS Forum is another newsgroup style Web site. Again, much slower than browsing newsgroups with a reader, but there does seem to be a fair amount of activity.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
October 28, 2000.

FC

Compares two files or sets of files and displays the differences between them.

Syntax:

FC [/Switches] file1 file2

Switches:

/B
Performs a binary comparison.
The two files are compared byte by byte and there is no attempt to resynchronize the files after finding a mismatch. This is the default mode for comparing files when file1 has an extension of .EXE, .COM, .SYS, .OBJ, .LIB, or .BIN.

/L
Compares files as ASCII.
The two files are compared line by line and FC attempts to resynchronize the files after finding a mismatch. This is the default mode for comparing files when file1 does not have an extension of .EXE, .COM, .SYS, .OBJ, .LIB, or .BIN.

/LBn
Sets the number of lines for the internal line buffer.
If the files being compared have more than this number of consecutive differing lines, FC cancels the comparison.
Default value of n: 100

/nn
The number of consecutive lines that must match before the files are declared resynchronized. If the number of matching lines in the files is less than this number, the matching lines are displayed as differences.
Default value of nn: 2.

/N
Displays the line numbers on an ASCII comparison.

/A
Abbreviates the output of an ASCII comparison. Only the first and last line for each set of differences is displayed as opposed to the default of every different line.

/C
Disregards the case of letters.

/T
Does not expand tabs to spaces.
By default, tabs are treated as spaces with 1 tab = 8 spaces.

/W
Compresses tabs and multiple spaces to a single space for the comparison.

Notes:

If file1 includes a wildcard, all applicable files are compared to file2.
If file2 also includes a wildcard, it is compared with the corresponding file1.

If FC can detect no differences between the two files being compared, the result is displayed as:

C:\WINDOWS>fc c:\test1.txt c:\test2.txt
Comparing files c:\test1.txt and c:\test2.txt
FC: no differences encountered

C:\WINDOWS>_

If differences are found in ASCII mode, the last line that is the same in both files is displayed, followed by any lines that are different, and concluding with the next line that is the same.

C:\WINDOWS>fc c:\test1.txt c:\test2.txt /n
Comparing files c:\test1.txt and c:\test2.txt
****** c:\test1.txt
     4:  This is test fourth line
     5:  This is test fifth line
****** c:\test2.txt
     4:  This is test fourth line
     5:  This is an extra line
     6:  This is test fifth line
******

C:\WINDOWS>_

If differences are found in binary mode, no attempt at rematching is made. Instead, once a difference is found, the address is listed followed by the mismatching byte values of the two files:

C:\WINDOWS>fc c:\test1.txt c:\test2.txt /b
Comparing files c:\test1.txt and c:\test2.txt
FFFFFFB0: 6E 23
FFFFFFB1: 65 6E
FC: c:\test2.txt longer than c:\test1.txt

C:\WINDOWS>_

Here, the first difference in the files occurred at the B0th (176th) byte from the start of the files - where the first file had a byte value of 6E (n), the second had 23 (#).
The B1th byte is also different.

In most cases, binary files are compared to see if they are the same or not - knowing the details of exactly what the differences are is seldom useful to the casual user. To simply see if two binary files are identical, it is often quickest to compare them as ASCII files using the /LB1 switch to cut the output to a minimum.

For an example of the significant differences in processing times, just try:

   FC c:\windows\command\xcopy.exe c:\windows\command\attrib.exe
   FC c:\windows\command\xcopy.exe c:\windows\command\attrib.exe /L
   FC c:\windows\command\xcopy.exe c:\windows\command\attrib.exe /L /LB1

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Fc.exe
c:\windows\command
7.0
Win95
20 494
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
20 574¹
24/08/96
win95_14.cab

Win98
20 574¹
11/05/98
win98_41.cab

Win98 SE
20 574¹
23/04/99
win98_45.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
October 17, 2000.

Contacting Me:

These pages have been on the go for three years now and in that time I've received over 500 messages relating to this stuff. Of these:

20 to 30 have given advice on mistakes/omissions and for these I am most grateful;

perhaps 50 have simply said "Thank you", and for these I am also very grateful (makes it all worthwhile!).

most of the remainder have been technical questions on everything from how to set the jumpers on a hard drive to writing Doskey macros for homework.

Now, with some notable exceptions that have stuck in my inbox for longer than I care to think about, I have tried to answer all mail but I feel compelled to point out that I am not any kind of expert and that just about all I know about Dos is in these pages. If you should have some kind of computer related problem that you would like to discuss, I would urge you to post it to a relevant newsgroup (see Links) where you will most likely get a response far more quickly and from someone who knows what they are talking about.

Having said that, if you should have any comments or suggestions about the content of these pages please send them to Bob Watson (rhwatson@sympatico.ca) - I look forward to hearing from you!

This page last revised on February 10, 2000

MS-Dos7 Commands

Bob Watson's Home Page

The following pages list the MS-Dos7 (Win 95) commands along with their syntax and examples of their use.

If you are reading this, your browser does not support frames (or you have them turned off). Either way, you will be wanting to use the no frames version of these pages.

If you do have the choice, I think you would find that using frames will make navigation through these pages rather more straightforward.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Using Dos7 Commands - Introduction

These pages are designed to remind the occasional user of Dos commands just what is on offer. I realize that few people using Windows 95/8 are going to open a DOS window and most of those that do will be pretty familiar with the somewhat similar commands of previous MS-DOS versions. Nevertheless, there are some differences, and Dos can do things that are difficult, if not impossible, in Windows.

The focus of this site is the syntax and use of the commands. Although my initial plans were grandiose, I have found that keeping on top of just this is as much as I can handle. There are several excellent sites covering batch files and a number that offer tutorials/general advice (see links).

I hope to expand this list as time permits, but in the meantime I would be most grateful for any comments, especially with respect to:

Mistakes. If I have got something wrong, or have obviously misunderstood how a command should work, PLEASE tell me!

Omissions. If I have left out a switch (documented or not), again, please let me know.

Mud. I have tried to make these notes make sense to the dabbler/intermediate user. If something doesn't make sense, let me know and I will try to clarify.

Conventions

On the whole I have followed the conventions for command syntax that seem to have been around since Dos began (if not before). However, in an effort to simplify the syntax lines, I have taken a couple of shortcuts:

Where there are two switches for the same function (eg. MEM's /D and /Debug switches are synonymous), I have only referred to the shorter version. This is because I reckon it's hard enough trying to remember some of the switches of some of the commands without unnecessarily adding to their number.

I have used the term [path] as in [path]filename to mean whatever is necessary to define the location of filename. The full path - including the drive - can always be used and will always work. Depending on the current drive, current directory, and what (if anything) is included in the PATH environmental variable, it may be possible to abreviate the full path or even omit it altogether.

"Undocumented" Switches

Some of the command switches listed here are "undocumented" or, more accurately, "unofficial" . This means that they are recognised by the command, but MS does not support them and will not attempt to explain how to use them.

In most cases such commands do not provide the safeguards MS likes to see in the commands available to the general user: for example FORMAT c: /autotest will reformat the C: drive without any further ado - no warnings, nothing.

In other cases the function of the switches appears pretty harmless and it would seem that MS is reserving judgment - maybe the switch will be dropped in the next version of Dos (if there is one) and maybe not. For example, it is hard to see COMMAND's /Z switch (displaying the ERRORLEVEL number returned by external DOS commands) causing much grief.

Finally, it is possible that some of these switches are not 100% reliable on all systems - so: user beware!

However, undocumented commands have been around since the beginning of Dos and are an interesting, albeit minor, part of the game.

To avoid confusion, I have formatted undocumented commands to appear in grey (in those browsers supporting the font-color tags).

Acknowledgements

Many people have, wittingly or not, helped provide the information included in these pages.

First of all there have been the anonymous writers at MicroSoft who wrote the help files of previous versions of Dos. Sometimes the information was applicable and sometimes not, but at least it gave a start.

Secondly there have been the various Dos related newsgroups (not so many posts as there used to be when this site was first put up in early 1997) in which many bugs and workarounds have been discussed.

Finally, there have been the many people who have been kind enough to write directly with relevant information. Wherever possible I have tried to give due credit on the appropriate page. Regrettably, some information has been mislaid over the course of several reinstalls.

Copyright

The information contained within these pages is (as far as I know) "common knowledge" and so not copyright or copyrightable. However, the presentation is mine and that, as such, is copyright. Having made that claim, anyone who wishes to republish, print, or otherwise disseminate all or some of these pages is free to do so (in whole or in part) for private and/or educational purposes.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
September 2, 2000.

Accdate

Enables/disables the recording of the last access date of a file.
The ACCDATE statement is only valid in Config.sys.

Syntax:

ACCDATE=drive1+|- [drive2+|-] ...

+
Enables last access date recording

-
Disables last access date recording

Notes:

Apart from keeping track of exactly where a file is located on disk, the FAT (File Allocation Table) also stores such details as file size, and the date/time the file was created, last modified, and last accessed. Most, if not all(?), programs used to archive files or compile program installation files include the "last modified" date with each file but not record either the creation or last access dates. Thus:

File Creation Date

This is the date the file was created on the current machine. For program files this will typically be the date the program was last installed - i.e. expanded from the packed/zipped/setup files. For data files this will be the date they were first saved (or retrieved from an archive).
The only way I know to display the "file creation date" is via Windows Explorer using the File|Properties - I am not aware of any Dos command that will display it.

File Last Modified Date

This is the date the file was last modified (on any machine). This is the generally accepted file's datestamp.

Last Access Date

The only cases where I have found "Last Access Date" to be shown are with the DIR /V command in Dos and under a file's "Properties" tab in Windows Explorer in Win95/8.

With Windows Explorer, unfortunately, the very act of checking a file's "last access date" is taken as an access and so is always the current date - whether hard or floppy drive, normal or safe mode, and whatever the settings used with ACCDATE in Config.sys.

With DIR /V the dates given make more sense but the "last access date" for directories is always the same as the "creation date".

Some utility programs likely use this information when deciding if a file should be classified as "seldom used" and a candidate for archiving. Tom Gutman suggests:

"I think that the main user of the last accessed date is DriveSpace 3. It has several levels of compression available, and when you use compression agent to change compression modes, some options depend on when a file was last accessed. This is for the high pack option (which apparently takes more time to decompress, as well as to compress) and to use that option only for files that have not been accessed in a while".

In response to a query on Usenet, Charles Dye offered the following:

"..........
INT 21 .AX=5704 Get last access date and time
INT 21 .AX=5705 Set last access date and time
INT 21 .AX=5706 Get creation date and time
INT 21 .AX=5707 Set creation date and time

The values go in previously unused (officially unused!) bytes in the short-name directory entry. Which means that recording this info could screw up other operating systems which use the "unused" bytes for other functions. DR DOS's password scheme springs to mind.
..........."

Other Usenet postings going back to '95 suggest that using ACCDATE drive- will reduce some disk activity and hence could speed up system operation a smidgen.

I am finding it kind of tricky to get a handle on exactly how ACCDATE works and how it might be used. According to the notes in the Config.txt file on the Win95 CD (also available as MS Knowledgebase Q135481) about Win95 Config.sys commands:

"For each hard disk, specifies whether to record the date that files are last accessed. Last access dates are turned off for all drives when your computer is started in safe mode, and are not maintained for floppy disks by default."

and this is supplemented by article Q182465 which says that problems have been found with ACCDATE and that:

"When you edit the Config.sys file to include an ACCDATE command so that the last accessed date for files is not updated, files may still be updated with the current date when you make changes."

I rather get the impression that the business of setting and retrieving a file's last access date was a minor routine that a programmer was playing with before being called off to more pressing things. As it stands, I can see no useful purpose for the statement and, indeed, it seems to be pretty well non functional.

If I'm missing something here, I'd be most grateful for advice on this!

Thanks to Tom Gutman for pointing out the significance of the various dates and to Charles Dye for posting the interrupt information.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
June 2, 2000.

Attrib

The Attrib command is used to display, set, or remove one or more of the four attributes (read-only, archive, system, and hidden) that can be assigned to files and directories. It is typically used to remove read-only, hidden, and system attributes so a file can be moved or deleted -- or to set them so that it can't.

Syntax:

To display the attribute settings of all files in the current directory:
ATTRIB

To display the attributes of a directory:
ATTRIB directoryname

To display the attributes of a file:
ATTRIB filename

To set or remove attributes of a file or directory:
ATTRIB [ + | - R] [ + | - A] [ + | - S] [ + | - H] [directory|filename] [/S]

+ Sets an attribute. - Clears an attribute.

R
Read-only file attribute.

A
Archive file attribute.

S
System file attribute

H
Hidden file attribute.

/S
Processes files in all directories in the specified path.

Notes:

The Archive attribute is automatically set when a file is saved to disk. Backup programs (and XCOPY with the /M switch) target these files as "not backed-up". After the files have been copied, the archive attribute is removed to indicate the file is now "backed-up".

The Read-Only attribute allows a file to be accessed but not modified.

The System attribute is normally reserved for files that are necessary for Dos/Win95 to load properly.

Files and directories with the Hidden attribute set are not normally displayed in directory listings or Open Files dialogue boxes. The usual reason for hiding folders is because they are important to system or program operation and should not be deleted or moved in casual tidy-up operations. Hidden (and System) folders will often also have the Read-Only attribute set.

Multiple attributes can be set/cleared by combining switches (separated by spaces).

Although both files and directories can have attributes assigned and cleared using ATTRIB, there are differences in the way they behave - the most obvious of which is that wildcards (? and *) can be used to display or change the attributes for a group of files whereas directories must be named in full.

Setting a file's System, Hidden, or Read-Only attribute will prevent the file from being deleted or moved using DEL, ERASE, or MOVE commands but will not protect the files from DELTREE or FORMAT.

Although a directory's Read-Only attribute can be set, this seems to serve little purpose. Firstly, the attribute only applies to the directory and NOT the files within it. Furthermore, setting a folder to read-only does not prevent it being deleted using RD (ie in Dos, setting a folder to read-only offers NO protection against deletion) and doesn't stop it being moved with MOVE either. In Win95 Explorer it will cause a warning notice to be displayed before the folder is deleted - which is something, I suppose.

Windows Explorer (Win95) does not show folder attributes in the general listings, but they can be viewed (and changed) via the File|Properties menu when a particular folder is selected.

File Manager (from Win3.1) does show file archive and read-only attributes but hidden files are, indeed, hidden. The attributes of selected files or directories can be changed via the File|Properties dialogue.

Win95 offers limited support to the attribute concept: An extra warning message is given when attempting to move or delete a file with the Read-Only attribute set, and Windows Explorer can be set to show or ignore Hidden files as the user wishes.

Examples:

To display the attributes of a file named "news86":
ATTRIB news86

To assign the Read-Only attribute to the file "report.txt", use:
ATTRIB +R report.txt

To remove the System and Hidden attributes from "record.txt":
ATTRIB -S -H record.txt

To hide the directory "c:\secret:"
ATTRIB +H c:\secret

To hide the files (but not the directories) in the C:\ directory:
ATTRIB +H c:*.*

In Addition ...

ATTRIB can be used to find/list files in much the same way as DIR but in a rather different format. For example, to list all files named "Readme.txt" on the c: drive:
ATTRIB c:\readme.txt /s
will display:

C:\WINDOWS>ATTRIB c:\readme.txt /s
  A          README.TXT    c:\WINDOWS\HELP\README.TXT
  A          README.TXT    c:\PROGRA~1\NETSCAPE\README.TXT
  A          README.TXT    c:\PROGRA~1\PPP-BO~1\readme.txt
  A          README.TXT    c:\PROGRA~1\SBCD\README.TXT
  A          README.TXT    c:\PROGRA~1\NORTON~1\README.TXT
  A          README.TXT    c:\PROGRA~1\MICROS~3\POWERT~1\README.TXT
  A          README.TXT    c:\SCSI\README.TXT

C:\WINDOWS>

The output is in the following format:
Column 3: Archive attribute: "A" indicates set, space indicates not set.
Column 6: System attribute: "S": set; space: not set
Column 7: Hidden attribute: "H": set; space: not set
Column 8: Read-only attribute: "R": set; space: not set
Column 14: Filename plus extension in Dos short form.
Column 28: Full path.

It is interesting to note that full path name is in mixed long- and short-filename formats. It would seem that long-filenames are used for the actual file and any specified directories (with or without wildcards). Sub-directories included through using the /s switch are in short-filename format.

Exit Codes:

0
No errors occured.

1
The source file couldn't be opened/located.

2
?

3
Execution was terminated by Ctrl-C before the operation was complete.

File Details:

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Attrib.exe
c:\windows\command
7.0
Win95
15 252¹
11/07/95
win95_02.cab

7.1
Win95 (OSR2.x)
15 252²
24/08/96
win95_02.cab

Win98
15 252²
11/05/98
win98_40.cab

Win98 SE
15 252²
23/04/99
win98_44.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 24, 2000

Break

Sets or clears extended Ctrl-C checking.

Syntax:

To set extended Ctrl-C checking:
BREAK On

To clear extended Ctrl-C checking:
BREAK Off

To display the current BREAK setting:
BREAK

Notes:

By default, whenever Dos accepts input from the keyboard or writes to the screen or printer, the keyboard buffer is checked for the Ctrl-C and Ctrl-Break combinations. If found, the current Dos command is terminated. In some cases, especially in batch programs, it is useful to have extra checks for Ctrl-C.

If BREAK is Off (default), Ctrl-C checking occurs only when Windows reads from the keyboard or writes to the screen or a printer.

If BREAK is set to On, Ctrl-C checking is extended to other functions, such as disk read and write operations and file sorting.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Buffers/BuffersHigh

Used to specify the number of "disk buffers" and "secondary cache buffers" to be made available in memory. The BUFFERS and BUFFERSHIGH commands can only be invoked from Config.sys.

Syntax:

To allocate memory for buffers in conventional memory:
BUFFERS=n [,m]

To allocate memory in upper memory blocks (if available):
BUFFERSHIGH=n [,m]

n
Number of disk buffers to be allocated. n must be from 1 to 99 - default is 30 (or 23, or 21 depending on version of Win95)

m
Number of buffers in the secondary buffer cache. m must be from 0 to 8 (default is 0)

Notes:

Buffers are used to to temporarily store information while it is being moved between disk and memory. "Disk buffers" are used to hold a disk sector's worth of data in memory to facilitate file handling and directory operations. "Secondary cache buffers" act as simple caches and hold unused parts of files in memory in anticipation of their possible use.

If an invalid value is specified for m or n, the default values are used.

If no BUFFERS/BUFFERSHIGH statement is included in Config.sys, IO.sys will load the default number of buffers into Upper Memory.

Even if Buffers are explicitly loaded with the BUFFERSHIGH statement, one Buffer (512 bytes) is still always loaded into Conventional Memory. If there is insufficient room for the specified number of Buffers to be loaded into Upper Memory, then they are ALL loaded into Conventional Memory.

Although Win95 programs do not use Buffers (except during during the loading process) many Dos programs do - and such programs may well modify Config.sys accordingly. More sophisticated disk cache utilities are available and may be a better choice in some cases. The MS Knowledge Base article Q78434 compares the merits of Buffers and the Smartdrv utility.

Newsgroup discussion seemed to confirm that setting Buffers to 13 (as suggested in Knowledge Base article Q156332) saves some memory and causes no untoward problems. (Works for me!)

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Call

Invokes a batch file, executable program, or Dos command.

Syntax:

CALL batchfilename [batchfileparameters]

Notes:

CALL is used in batch files to invoke a second batch file as a sub-routine. When the sub-routine finishes, control returns to the parent batch file. This is in contrast to simply invoking a secondary batch file by name, in which case control does not return to the primary batch file.

CALL will also work with Dos commands and programs. However, there is little point in doing this as in both cases these can be invoked directly from the batch file and control will be returned on completion.

Parameters and switches (except /?) can be passed on to the secondary batch file, either explicitly, as variables generated by the primary file, or as replaceable variables holding data entered on the original command line.

CALL does not start a secondary command processor (c.f. START) and so any environmental variables set in the secondary batch file will be valid when control is returned to the primary.

Because CALL is internal, it does not generate an Exit Code on completion. However, Exit Codes generated by (external) commands/programs within the secondary batch file will be available for use by the primary when control is returned to it.

Pipes ( | ) and redirection symbols (<<,<,>, and >>) should not be used with the CALL command.

Examples:

To run "checknew.bat" from within another batch program:
CALL checknew

If the parent batch program accepts two replaceable parameters and these are to be passed on to "checknew.bat":
CALL checknew %1 %2

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

CD (or ChDir)

Changes (or displays) the current directory on the specified drive.

Syntax:

To display the current directory:
CD [drive:]

To change the current directory:
CD path

path
Changes the current directory to path. (If path includes a drive that is not the current drive, see notes below) CD recognizes the \ and .. shortcuts for root and parent directories respectively.

Notes:

At any time, each drive (real and/or virtual - see SUBST) has its own "current directory" which remains "current" until it is changed - ie. changing the current directory of drive c: will not affect the current directory status of any other drive. However, there can, of course, only be one current drive at any one time.

To change to the current directory on a different drive, just enter the drive letter (+ colon). Using CD with a drive letter merely displays the current directory on the other drive without switching to it. The CD command can be used to change the current directory on a "non-current" drive, but will not switch to that directory.

Examples:

If the current drive is c:, to make "c:\docs\data" the current directory:
CD \docs\data

However, if the current directory is "c:\docs", all that is necessary is:
CD data

To change the current directory "c:\docs\data" to the parent directory "c:\docs":
CD..

If the current directory on the c: drive is "c:\data\docs" and the current directory on the e: drive is "e:\downloads", then to copy all files from "e:\downloads" to "c\data\docs":
COPY e:*.* c:

To copy all files from "e:\downloads" to the root directory of c:
COPY e:*.* c:\

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

CHCP

The CHCP command is used to display and change the active Code Page (character set).

Syntax:

To display the active Code Page:
CHCP

To change the active Code Page:
CHCP nnn

nnn
The Code Page number. See "Mode - Set Device Code Page" for a list.

Notes:

Before the CHCP command can be used, the NLSFUNC program must be loaded and the location of the COUNTRY.SYS file must be specified using the COUNTRY command.

For an introduction to using character sets and the CHCP command, see the chapter "Customizing For International Use" in the MS-Dos 6 User's Guide. Tables of the character sets included with MS-Dos are shown in the appendix "Keyboard Layouts and Character Sets".

Programs loaded after a new character set is assigned will use that character set; however, programs already loaded (except COMMAND.COM) will probably attempt to use the original character set.

Examples:

To view the active Code Page setting:
CHCP
which will display something like:

C:\WINDOWS>CHCP
Active code page: 850

C:\WINDOWS>_

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

ChkDsk

Chkdsk is used to check the status of a disk, fix some disk errors, and display a status report showing any errors found in the file allocation table (FAT) and directory structure. CHKDSK also displays a summary of disk usage. If errors are found on the disk, CHKDSK displays a warning message.

Syntax:

CHKDSK [path] [/F] [/V]

path
Specifies the drive and directory to check.

/F
Fixes errors on the disk.

/V
Displays the full path and name of every file on the disk.

Notes:

SCANDISK can reliably detect and fix a much wider range of disk problems and is generally preferred to the somewhat dated CHKDSK.

The /F switch (for fixing any errors found) should not be used while any program is running other than Dos and CHKDSK itself.

CHKDSK cannot be used on drives created using SUBST, nor can it be used on network drives. In win98, CHKDSK does not check the disk, though still provides some basic data:

C:\WINDOWS>chkdsk d: CHKDSK has NOT checked this drive for errors. You must use SCANDISK to detect and fix errors on this drive. Volume DATA created 21/01/2000 5:20 Volume Serial Number is 1A69-0CE4 6,132,824 kilobytes total disk space 4,140,316 kilobytes free 4,096 bytes in each allocation unit 1,533,206 total allocation units on disk 1,035,079 available allocation units on disk 655,360 total bytes memory 566,288 bytes free Instead of using CHKDSK, try using SCANDISK. SCANDISK can reliably detect and fix a much wider range of disk problems. C:\WINDOWS>

A typical CHKDSK status report might be:

Volume Serial Number is B1AF-AFBF

72,214,528 bytes total disk space
73,728 bytes in 3 hidden files
30,720 bytes in 12 directories
11,493,376 bytes in 386 user files
61,440 bytes in bad sectors
6,055,264 bytes available on disk

2,048 bytes in each allocation unit
35,261 total allocation units on disk
29,568 available allocation units on disk

655,360 total bytes memory
493,456 bytes free

Exit Codes:

0
No errors were found

255
One or more errors were found

File Details:

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Chkdsk.exe
c:\windows\command
7.0
Win95
27 248
11/07/95
win95_02.cab

7.1
Win95 (OSR2.x)
28 096¹
24/08/96
win95_02.cab

Win98
28 096¹
11/05/98
win98_40.cab

Win98 SE
28 096¹
23/04/99
win98_44.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 26, 2000.

Choice

CHOICE prompts the user to select one of a specified set of keys in a batch program. It is the only Dos command that allows for controlled user input to a batch file.

Syntax:

CHOICE [text] [/C[:]choices] [/N] [/S] [/T[:]c,nn]

/C[:]choices
The prompt - comprising a series of single alphanumeric characters corresponding to valid choices. The prompt is displayed as the characters, separated by commas, enclosed in brackets, and followed by a question mark. Default is YN

/N
Stops the prompt from being displayed, although text is still shown and the choices keys are still valid.

/S
Forces the choice keys to be case sensitive. By default they are not.

/T[:]c,nn
Defaults choice to c after nn seconds.
c must exist; nn must be in the range 0 to 99.

text
Text displayed before the prompt. Typically, text is used to expand on the subsequent prompt.

Notes:

The CHOICE command works by assigning an errorlevel value (exit code) to each entry under choices (see "Exit Codes" below) and is almost always immediately followed by one or more IF (NOT) ERRORLEVEL statements.

Although text can be up to 120 characters in length, it doesn't wrap well. For menus or, indeed, anything more than the simplest of prompts, it is usual to preceed the CHOICE command with a series of ECHO statements or insert a text file using TYPE. Either of these methods can be used to lay out a formatted screen and the CHOICE command would probably not need to display anything but the flashing cursor.

If the /S switch is used to render the choices case specific, the number of possible choices is limited only by the number of single alpha-numeric characters available in the extended ASCII character set (excluding <, >, and |) - over 200 and enough to make for a very cumbersome prompt!

Any keystroke apart from those specified in choices (and Ctrl-C which gives the option of terminating the batch file) is ignored. However, if the /T switch is used in order to default to a particular choice after a specified time, pressing an invalid key will disable the timer. This is, apparently, a long standing bug in the CHOICE command.

Tricks

The CHOICE command can be used to introduce a timed delay in a batch file. For this purpose, there are no prompts, one choice and, because of the abovementioned bug, there should be no possibility of user intervention. A typical syntax for a timed delay might be:

TYPE NUL|CHOICE /C:Y /T:Y,nn > NUL

where the TYPE NUL part pipes nothing to the CHOICE command that has one choice ("Y") to which it defaults after nn seconds (1-99), and the output is redirected to NUL.

A very basic password protection for a batchfile could be introduced using CHOICE and not displaying the prompt. For example:

CHOICE Enter password to continue: /C:>> /N

would halt the batch file until Alt-175 (>>) was pressed. Not exactly unbreakable!

Exit Codes:

0
CHOICE was terminated by Ctrl-C before a choice was entered.

1
The key corresponding to the first choice was pressed.

n
The key corresponding to the nth choice was pressed.

255
An error occurred.

Examples:

Some examples of CHOICE command formats and the corresponding display:

CHOICE

[Y,N]?

Completely unadorned, Choice will stop processing a batch file until the user presses either Y or N (upper or lower case) at which point the batch file will resume. Pressing "Y" or "y" will return an errorlevel of 1, "N" or "n" will return an errorlevel of 2 and any other key will be ignored. Usually the next line(s) of the batch file will include a test to determine the current errorlevel value along with instructions on what should be done if the errorlevel is greater than or equal to some particular value.

CHOICE /C:ync

[Y,N,Q]?

A third option has been added and pressing "Q" or "q" will return an errorlevel of 3.

CHOICE Run Scandisk: Yes, Skip, Quit /C:ysq

Run Scandisk: Yes, Skip, Quit [Y,S,Q]?

Including some text ("Run Scandisk: Yes, Skip, Quit") can clarify the prompt.

CHOICE Press "F" to format the disk or "Q" to quit: /C:fq /n

Press "F" to format the disk or "Q" to quit:

The prompt [F,Q]? that would normally follow the text (Press "F" to format the disk or "Q" to quit:) has here been suppressed.

CHOICE /C:yq /T:q,5

[Y,Q]?

The prompt is displayed for 5 seconds; if no key has been pressed by then, Q is chosen returning an ErrorLevel value of 2.

To have the option of running SCANDISK on drive C when the computer is turned on, the following lines could be added to "autoexec.bat":

CHOICE Run Scandisk /ty,5
IF errorlevel 2 GOTO SkipScan
Scandisk c:
:SkipScan

Bearing in mind that as no choices were specified, the defaults of Y and N were used. If N is pressed within 5 seconds, SCANDISK will not run and CHOICE returns an ERRORLEVEL value of 2. If N is not pressed within 5 seconds, or if you choose Y, SCANDISK runs on drive C.

The following batch program uses the CHOICE option to select one of three Dos utilities: Scandisk, Microsoft Backup, or Debug. Notice that the IF ERRORLEVEL statements are listed in decreasing order. MS-Dos will consider the IF statement true if the ERRORLEVEL parameter returned by CHOICE is greater than or equal to the parameter specified in the IF command.

@ECHO off
ECHO A Scandisk
ECHO B Microsoft Backup
ECHO C Debug
CHOICE Choose an option /C:abc
IF errorlevel 3 GOTO Dbug
IF errorlevel 2 GOTO MsBack
IF errorlevel 1 GOTO Scan
:Dbug
Debug
GOTO End
:Scan
Scandisk
GOTO End
:Msbackup
msbackup
GOTO End
:End

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Choice.com
c:\windows\command
7.0
Win95
5 175¹
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
5 175¹
24/08/96
win95_13.cab

Win98
5 239²
11/05/98
win95_28.cab

Win98 SE
5 239²
23/04/99
win98_25.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
November 1, 2000.

Cls

Clears the screen leaving only the command prompt and cursor.

Syntax:.

CLS

Notes:

The CLS command is usually used in batch files so that the screen only displays useful output from the file without any extraneous commands from previous commands.

File Details:

Internal.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Command (& Exit)

Starts a new copy of the Command Interpreter.

Syntax:

COMMAND [path] [device] [/Switches]

path
Directory (and drive) containing command.com. This must be specified unless command.com is in the root directory.

device
Device to use for command input and output. By default this is the keyboard and monitor.

/P
Makes the new Command Interpreter permanent.

/E:x
Sets the initial environment size [bytes]. x should be set between 256 and 32,768 bytes. The default is: 256 bytes.

/L:y
Internal buffers length [bytes]. y should be set between 128 and 1,024 bytes. The default is: ? This switch is only accepted if the Command Interpreter is permanent - ie. the /P switch must also be set.

/U:z
Input buffer length [bytes]. z should be set between 128 and 255 bytes. The default is: ? This switch is only accepted if the Command Interpreter is permanent - ie. the /P switch must also be set.

/MSG
Stores all error messages in memory. This switch is only accepted if the Command Interpreter is permanent - ie. the /P switch must also be set.

/LOW
Forces COMMAND to keep in low memory

/Y
Steps through the batch program specified by /C or /K

/C command
Executes command and exits. This must be the last switch on the command line.

/K command
Executes command and continues running. This must be the last switch on the command line.

/F
Forces a "Fail" response to the Command Interpreter's error handling routine query: "Abort, Retry, Fail?".

/Z
Causes the ERRORLEVEL number returned by external DOS commands to be appended to the command's output.

Notes:

Every time a Dos window is opened in Windows95, a new (non-permanent) instance of the Command Interpreter is run. Thus several instances of Command.com can be running independently at the same time.

The EXIT command is used to quit any non-permanent instances of Command.com.

Under normal circumstances, the only occasion when the /P switch need or should be specified is when Command.com is used within a Shell statement.

The /MSG switch is quoted as forcing all of Command.com's messages to be loaded into memory on startup. This could save a bit of disk swapping if the machine is running from floppies However, as Dos7 only runs on machines with lots of memory it would seem to be natural for this to be the default. Indeed, when I tried loading Command /p with and without the /MSG switch, both versions were reported to be using exactly the same amount of memory implying that this switch is now redundant.

The /Y and /Z switches can be particularly useful in helping to debug macros and would typically be used in conjunction with the /C switch. Once the macro was working, the /Y and /Z switches would probably be dropped and the command line assigned its own shortcut.

The /Y switch steps through the macro line by line and gives the choice of processing the line or skipping it. This example is from a fragment of a batch file. The operator is escaping from a loop by not processing a GOTO instruction:

........
C:\WINDOWS>shift
shift [Enter=Y,Esc=N]?Y

C:\WINDOWS>goto start
goto start [Enter=Y,Esc=N]?N
C:\WINDOWS>
C:\WINDOWS>

C:\WINDOWS>_

When Command is started with the /Z switch, the initial display on loading is:

C:\WINDOWS>command /z

Microsoft(R) Windows 95
   (C)Copyright Microsoft Corp 1981-1996.
Return code (ERRORLEVEL):   0
WARNING: Reloaded COMMAND.COM transient

C:\WINDOWS>_

Thereafter, the exit code (ERRORLEVEL number) returned by a program will be appended to any output from that program.
For example, attempting to using XCOPY to transfer files from drive a: to c: when there is no disk in a: will result in an error and XCOPY will quit leaving an exit code of 4. This will display as:

C:\WINDOWS>xcopy a:\*.* c:\
Invalid path - a:\
The device is not ready.
        0 File(s) copied
Return code (ERRORLEVEL):   4

C:\WINDOWS>_

COMMAND contains an error handling routine that is used by a number of internal commands. If a command cannot be carried out because of a hardware/operator malfunction, the error message "Abort, Retry, Fail?" is displayed. For example, if the command "DIR a:" is entered and there is no disk in drive a:

C:\> dir a:

Not ready reading drive A
Abort, Retry, Fail?_

The only accepted responses to this are:

A
("Abort") The command is terminated and you are returned to the prompt.

R
("Retry") The command is run again - hopefully the problem has been corrected - eg a disk has been put into drive a:

F
("Fail") This accepts that the command could not be executed for whatever reason and you are returned to the prompt (though it sometimes takes 2 or 3 F's to get there).

Ctrl-C
The command is cancelled and you are returned to the prompt.

There is a difference between the ways A, F, and Ctrl-C are handled but, after much experimenting, I still cannot see any real pattern. In both cases, the command terminates and the user is returned to the prompt. This is true whether the command was issued from the command line or from within a batch file - in the latter case, the batch file also terminates. However, whilst the end result is very similar, it would seem that the F response causes a more orderly closure.

For example: if dir a: is entered and there is no disk in drive a:, A will return you directly to the command prompt whereas F repeats the question. Pressing F a second time, gives the message that the disk in a: has no label and repeats the question. Pressing F a third time gives the message "Fail on interrupt 24", and then returns to the prompt:

C:\WINDOWS> dir a:

Not ready reading drive A
Abort, Retry, Fail?
Abort, Retry, Fail?f

Not ready reading drive A
Abort, Retry, Fail?f
Volume in drive A has no label

Not ready reading drive A
Abort, Retry, Fail?f
Fail on INT 24

C:\WINDOWS>_

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Command.com
c:\

c:\windows
7.0
Win95
92 870
11/07/95
Precopy1.cab

7.1
Win95 (OSR2.x)
93 812
24/08/96
Precopy1.cab

Win98
93 880
?
Precopy1.cab

Win98 SE
93 890
23/04/99
Precopy1.cab

Thanks to Lawrence R. Steeger for his advice on the "/Z" switch.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Copy

The prime use of COPY is to copy one or more files to another location but it can also be used to combine (concatenate) files and to type directly to a file, printer, or other device.

Copy - Copying Files

To copy one or more files:

Syntax:

COPY source [destination] [/V] [/Y | /-Y]

source
The file(s) to be copied. Although this must be a single parameter, it may include multiple files specified using wildcards (* or ?). It may also be a valid device (eg. CON)

destination
The directory and/or filename for the new file(s).
If destination...

is not specified

source is copied to the current directory with the same name and creation date as the original. If source is in the current directory, an error message is displayed stating that the "file cannot be copied to itself" .

is a valid directory name

the source file(s) are copied to the directory so named with their original names and creation dates.

is not a valid directory name but is an acceptable filename

source is copied and renamed to that filename with the original creation date. If source comprises multiple files, these are concatenated (see below) and renamed to that filename with the current date.

is unambiguously a directory name (eg. it concludes with a backslash (\)), but is not valid for some reason

an error message is displayed ("Invalid directory") and no files are copied.

a valid device (eg LPT1, COM1, etc.)

source is sent to that device.

file /A
Forces COPY to treat the file as an ASCII test file (see Notes below).

file /B
Forces COPY to treat the file as a binary file (see Notes below).

/V
Verifies that new files can be read (does not compare with the original - see VERIFY).

/Y
No warning prompt before overwriting a file (default when COPY is used in a batch file).

/-Y
Displays a warning and requires confirmation before overwriting a file (default when COPY is used from the command line).

Notes:

When used from the command line, if a file specified in destination already exists in the specified location, COPY will, by default, display a warning message and require confirmation before overwriting the old file. On the other hand, when COPY is used in a batch file, any existing files will be overwritten without warning.
This default behaviour can be modified by presetting the /Y | /-Y switch in the COPYCMD environment variable and overruled by using the /Y | /-Y switch on the command line.

COPY does not copy files that are 0 bytes long; instead, it deletes such files. Use XCOPY to copy these files.

Source and/or Destination may be an appropriate device (such as CON, COMx or LPTx) rather than a file.

Depending on context, Copy treats files as binaries or ASCII text files.
By default:

When copying files from one location to another (ASCII or not), COPY assumes binary mode;

When concatenating files, COPY assumes ASCII mode;

When source or destination is a device (other than a disk), copy assumes ASCII mode.

When operating in binary mode, COPY determines the file's starting location from the File Allocation Table and copies the number of bytes allocated to that file from that point. When in ASCII mode, data is copied until an End-Of-File ASCII #026; Ctrl-Z) character is reached. This character is NOT copied, but COPY adds an EOF character before closing the new file. This convoluted procedure enables COPY to concatenate files (see below) and to work with non-file input (the keyboard, for example). On the few occasions that the default mode is inappropriate, it may be over-ridden by adding the /A or /B switch to source and/or destination files as required.

The COPY command is neat, simple, (and internal) but XCOPY is far more powerful and flexible.

Examples

To copy "note.txt" in the current drive and directory to the directory "mynotes":
COPY note.txt c:\mynotes
or
COPY note.txt c:\mynotes\
(In the first case, if the "mynotes" directory doesn't exist, "note.txt" is copied to a file named "mynotes" in the root directory of drive C. In the second case, an "invalid Directory" error message will be displayed).

To copy all the files in the "mynotes" directory to a directory named "mynotes backup" on drive D:
COPY c:\mynotes\*.* d:\mynotes backup\

To make a copy of "note.txt" in the current drive and directory and call it "program note.txt"
COPY note.txt "program note.txt"

Copy - Concatenating Files

Syntax:

COPY source1 + source2 + ... destination [/V] [/Y | /-Y]

Notes:

When concatenating files, COPY reads the first source file and writes this to destination. COPY then reads the next source file and appends this to destination, and so on.
A ramification of this is that if destination has the same name and location as any source file (except the first) the data in that source file will be overwritten before it is read. This data would be very difficult to recover. By default, a warning message is displayed before the file is overwritten.

If destination is not specified, the combined files are saved under the name of the first source file (source1). By default, a warning will be displayed asking for confirmation that source1 is to be overwritten. This can be averted by adding the /Y switch to the command.

If source is specified with wildcards and destination is unambiguously a filename rather than a directory, COPY combines all files matching the filename in source and creates a single file named destination.

By default, both source and destination files are assumed to be ASCII format - binary files can seldom be usefully concatenated.

When files are combined, the destination file is created with the current date and time.

Examples:

To combine "mar89.rpt", "apr89.rpt" and "may.rpt" into one file named "report.rpt" in the current directory:
COPY mar89.rpt + apr89.rpt + may89.rpt report.rpt

To combine all files in the current directory on the current drive that have the extension ".rpt" into one file named "combined.rpt":
COPY *.rpt combined.rpt

To combine a series of files that have ".txt" extensions with their corresponding ".ref" files to make new files with the same file names but with ".doc" extensions (ie "file1.txt" is combined with "file1.ref" to form "file1.doc", and so on).
COPY *.txt + *.ref *.doc

To combine first all files with the ".txt" extension, then all files with the ".ref" extension into one file named "combin.doc":
COPY *.txt + *.ref combin.doc

Tricks

To "touch" a file (ie. assign the current time and date without any other modification), concatenate it with nothing and save it to itself:
COPY /b source + ,, /Y
Note the use of the /b switch to force COPY treat the file as binary rather than an ASCII text file. The /Y switch prevents the display of the usual warning message.
Note also that this will not work with zero-length files (which will be deleted - see above).

Using the CON(sole) device as source it is possible to create a text file directly from the keyboard. Thus to create a file called (say) "output.txt", first enter:
COPY CON output.txt
then type the text for the file followed by a Ctrl-Z. The file is saved as "output.txt."

On the same lines, text can be sent directly to the printer on LPT1. First enter:
COPY CON LPT1
followed by whatever text you wish to print. Type Ctrl-Z (^Z or F6) to stop the process.

To add text to the beginning or end of a file, concatenate the file with con. This presents a hyphen prompt at which text can be entered from the keyboard. When done, press "Ctrl-Z" then "Enter". Thus to append text to the end of Test.txt, (and avoid the warning about overwriting Test.txt) enter:
COPY Test.txt + CON /Y
This will display:

C:\WINDOWS>copy Test.txt + CON /Y
test.txt
CON
_

Now type in (say) "This is an extra line" followed by Ctrl-Z and [ENTER]. The file Test.txt will be now comprise the contents of the original Test.txt followed by This is an extra line.

Text can similarly be added to the beginning of a file except that a Destination must be specified (or else the amended file is simply copied to the screen (CON)). Furthermore, Destination cannot be the same as source (Test.txt). To add text to the beginning of a file, use the form:
COPY CON + Test.txt Test2.txt /Y

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Country

Enables MS-DOS to use country-specific conventions for displaying times, dates, and currency; for determining the order by which characters are sorted; and for determining which characters can be used in filenames.

The COUNTRY command can only be invoked from Config.sys and requires the presence of a configuration file containing the country information.

Syntax:

COUNTRY=xxx[,yyy][,filename]

xxx
The country code.

yyy
A character set applicable to the country specified by xxx.

filename
The file containing country information. filename should be specified unless it is Country.sys and in the root directory.

Notes:

Examples:

To use French conventions for international currency, time, date and alphanumeric sorting order:
COUNTRY=033

To specify the appropriate character set for the French country code:
COUNTRY=033,850

If Country.sys is kept in the 'c:\windows\command' directory:
COUNTRY=033,,c:\windows\command\country.sys

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

CTTY

CTTY is used to change the port for the input device used to give commands to the computer.

Syntax:

CTTY device

device
The port used by the terminal device.
Valid ports are: CON, AUX, COM1-4, LPT1-3, and NUL.

Notes:

If a serial port is to be used for an input device, the baud rate, parity, bits, and stop bit must be established with the MODE-Serial Port Configuration command before using the CTTY command.

Many programs do not use MS-Dos for input or output but send input directly to the hardware on your computer and the CTTY command has no effect on these programs.

As an alternative to the CTTY command, the device parameter of the COMMAND command can be used to specify the input device.

Some batch files have been published in which all output to the screen is prevented by using the CTTY command coupled with the NUL port. This also disables the keyboard. It is therefore imperative to include a line at the end of the batch file returning control to the CON port. If the batch file should quit before the end for any reason, the only way to regain control is to reboot. It is not wise to include such commands in "autoexec.bat"!

Examples

To change control of all input and output from the monitor and keyboard to a remote terminal device connected to the AUX port:
CTTY aux

To transfer input and output back to the monitor and keyboard, at the remote terminal
CTTY con

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Date

Displays and/or sets the date on the computer's clock.

Syntax:

To display the current system date and prompt for a new one (default is the date displayed):
DATE

To set the system date without a prompt:
DATE date

Notes:

The default format for date is: mm-dd-[yy]yy

mm
1 to 12

dd
1 to 31 - so long as the number is appropriate for the month and year.

yy
80 to 99 or 1980 to 2099

Valid separators between mm,dd, and yy, include periods (.), hyphens (-), and slashmarks (/).

The date format depends on the international settings established during set-up of Windows95

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Del (or Erase)

Deletes named files. DEL and ERASE are synonymous.

Syntax:

To delete a file:
DEL [path] filename [/P]

To delete all files in a directory (with confirmation):
DEL path or
DEL path \*.*

To delete all files in a directory (without confirmation):
DEL path \?*.*
DEL path \** (in Dos7.0 - confirmation is required in Dos7.1)

filename
The file to delete.

/P
Forces confirmation before deleting each file.

Notes:

DEL only accepts one parameter specifying what is to be deleted - though this parameter can be written (using wildcards) so that multiple files are deleted. If more than one parameters is detected, the command aborts and an error message is displayed. DEL will interpreted a long-file-name-with-spaces as multiple parameters, causing an error. Enclosing the long-file-name-with-spaces in inverted commas solves the problem.

D:\>del test 2.txt
Too many parameters - 2.txt

D:\>del "test 2.txt"

D:\>_

DEL will not delete files that have "read-only", "hidden", and/or "system" attributes set. To delete such files, one can use DELTREE or modify the necessary attributes with ATTRIB.

Using either DEL path \*.* or DEL path will delete all files in a directory, but both forms first give a warning that all files in the directory will be deleted and ask for confirmation before proceeding. To avoid this message and the request for confirmation (which can be trying in batch files) there are a number of alternatives:

DEL [path] \?*.*

DEL [path] \** (in Dos7.0 - confirmation required in Dos7.1)

ECHO Y | DEL [path] \*.*

DELTREE /Y [path] \*.*

On the other hand, to require confirmation before each file in a group is deleted, use:

DEL /P [path] \*.* or

DELTREE [path] \*.*

There is no easy way to delete a specific file or group of files from all branches of a directory. Although a list of such files is easy to obtain (using DIR /S filespec), it has been found extraordinarily difficult to persuade DEL to use such a list to delete these files. In a series of newsgroup postings sparked by Ray Woodcock¹, the general consensus was that such an operation was best left to a third-party utility (SWEEP - an old PC Magazine utility was mentioned).

References

Ref.#
From
Title
Newsgroup
Date

1
Ray Woodcock
Pipes and Redirects for DEL
alt.msdos.batch
15 Feb 2000

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
June 5, 2000.

Deltree

Deletes a directory and all the subdirectories and files in it.

Syntax:

To delete a directory and all the subdirectories and files contained therein:
DELTREE [/Y] directory

To delete all the files and subdirectories but leave the directory itself:
DELTREE [/Y] directory\*.*

To delete a file:
DELTREE [/Y] filename

directory
The directory to be deleted.

/Y
Suppresses prompts for confirmation before deleting.

Notes:

The DELTREE command deletes all files contained in a directory or subdirectory, regardless of whether files are marked as hidden, system, or read-only.

Unlike the typical syntax order for most Dos commands, if the /Y switch is used, it must precede the directory parameters.

The DELTREE command supports wildcards, but they should be used with some caution. If you specify a wildcard that matches both directory names and filenames, both the directories and files will be deleted. Before specifying wildcards with the DELTREE command, use the DIR /A command to view the files and directories you will delete. It is also safest to specify the full path to avoid any surprises from ambiguous specification.

Only the files in the top directory deleted with DELTREE can be recovered using UNDELETE. Files in subdirectories are lost forever - as far as Dos is concerned, anyway.

Examples:

To delete the TEMP directory on drive C, including all files and subdirectories of the TEMP directory:
DELTREE c:\temp

To delete all the files and subdirectories in the "temp" directory leaving an empty "temp" directory for future use, and avoiding the prompt for confirmation:
DELTREE /Y c:\temp\*.*

To delete the read-only file text.doc in the c:\data directory (without resetting the attributes):
DELTREE /Y c:\data\text.doc

Exit Codes:

0
It would appear that Deltree returns this code whatever happens.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Deltree.exe
c:\windows\command
7.0
Win95
19 019¹
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
19 019¹
24/08/96
win95_13.cab

Win98
19 083²
11/05/98
win98_40.cab

Win98 SE
19 083²
23/04/99
win98_45.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Device/DeviceHigh

Used to load device drivers into conventional and upper memory respectively.
The DEVICE and DEVICEHIGH commands can only be invoked from within Config.sys.

Syntax:

To load a device driver into conventional memory:
DEVICE=filename [dd-parameters]

To load a device driver into upper memory:
DEVICEHIGH [/Switches] = filename [dd-parameters]

filename
The device driver to be installed

dd-parameters
Any command-line information required by the device driver.

Switches
Optionally used to define the location of device drivers in upper memory.

/L:region1[,minsize1]...
One (or more) regions of memory into which the device driver should be loaded. By default, MS-DOS loads the driver into the largest free upper memory block (UMB) and makes all other UMBs available for the driver's use.

/S
Shrinks the UMB to its minimum size while the driver is loading. Using this switch makes the most efficient use of memory. This switch is generally used only by the MemMaker program, which can analyze a device driver's memory use to determine whether the /S switch can safely be used when loading that driver. This switch can be used only in conjunction with the /L switch and affects only UMBs for which a minimum size was specified.

Notes:

Before using DEVICEHIGH to load device drivers into the upper memory area, Himem.sys and a UMB provider, such as Emm386.sys, must be loaded in conventional memory (using DEVICE=himem.sys and DEVICE=emm386.exe commands). The DOS=umb command must also be included in Config.sys.

If DEVICEHIGH is used but there is insufficient upper memory area available to load the specified device driver (or if the DOS=umb command is missing), the driver will be loaded into conventional memory instead.

By default, if a region is specified, DEVICEHIGH will load a driver into the largest UMB in that region so long as that UMB is larger than the driver's load size (usually equal to the size of the file).

Some drivers require extra memory when running and it is for these that minsize can be used to ensure that the driver will not be loaded into a UMB that is too small for it. If minsize is specified, the driver is loaded into that region only if it contains a UMB that is larger than both the driver's load size and the minsize value.

If a device drivers requires the use of more than one area of memory, these can be specified by separating the block numbers with a semicolon.

To determine how a particular device driver uses memory, and to list the free areas of memory, see the MEM command.

Examples:

To load the device driver Ctmmsys.sys into region 2 of upper memory, and noting that it requires 10416 bytes to run although its file size is only 10350 bytes:
DEVICEHIGH /L:2,10416 =c:\sb16\drv\ctmmsys.sys

To load the driver Pts.sys in blocks 2 and 3:
DEVICEHIGH /L:2;3 = c:\drv\pts.sys

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Dir

Displays a list of files and subdirectories in a directory.

Syntax:

DIR [drive:] [path] [filename] [/Switches]

Switches:

none
By default, DIR displays:

a header comprising the disk's volume label and serial number;

a list of all files and subdirectories in the current directory in the order they are listed in the FAT (except those marked 'hidden' and/or 'system' - see ATTRIB for an explanation of these terms). Along with each file/directory is its size, date/time of last modification, and long file name;

a footer comprising the total number of files listed, their cumulative size, and the free space (in bytes) remaining on the disk.

/A [attributes]
Displays files with/without specified attributes.
If attributes is not specified, all (including hidden and system) files and subdirectories in the specified directory are displayed.
Multiple attributes can be specified (don't separate with spaces) but only those files with all the specified attributes will be displayed, ie. works as AND rather than OR.

attributes (Using the "-" as a prefix specifies "not")

D
Directories

R
Read-only files

H
Hidden files

A
Files modified since last back-up

S
System files

/O [sortorder]
List files in sorted order.
If sortorder is not specified, directories are listed alphabetically followed by files, also listed alphabetically.
Any combination of sortorder keys can be specified and files will be sorted in the order of the keys.

sortorder (Using "-" as a prefix reverses the order)

N
By name (alphabetic)

S
By size (smallest first)

E
By extension (alphabetic)

D
By date & time (earliest first)

G
Group directories first

A
By Last Access Date (earliest first)

/S
Displays files in the specified directory and all its subdirectories

/W
Wide list format. File and directory names are listed in 5 columns

/B
Bare format. Files and directories are listed in a single column without header, summary, or any details.

/L
Output is in lowercase.

/P
Pauses with each screenful of information. Press any key to see the next screen.

/V
Verbose mode. This displays attributes, date last accessed, and disk space allocated for each file, in addition to the standard information.

/Z
Long file names are not displayed in the file listing - but see "Limitations" below.

/C[H]
This switch is documented in MSDos 6.2 Technical Reference as:

"Displays the compression ratio of files compressed using DoubleSpace, based on an 8K cluster size. The optional H switch displays the compression ratio of files compressed using DoubleSpace, based on the cluster size of the host drive. The /C[H] switch is ignored when used with the /W or /B switch".

(Presumably these switches are still valid in Dos 7.x when used on a FAT16 drive with DoubleSpace/DriveSpace, but I have been unable to test this).

/4
Displays the date as four digits rather than two.
This switch is available in Y2K ready versions of Dos 7.x - ie. in Win95 after installing the Y2K update patch available from Microsoft's Y2K Web site and in Win98 as shipped.

Notes:

DIR will only accept one path as a parameter - long file/directory names that include a space must be enclosed in inverted commas.

Wildcards (* and ?) can be used to display a listing of a subset of files and subdirectories.

DIR (without the /a switch) will not display files which have system or hidden attributes set even if the file is specifically entered as a parameter. However, if a directory is hidden and specified as a parameter, DIR displays all.

DIR can be used with the standard period (.) shortcuts to show higher level directories. If more periods are used than are required to show the root directory, the directories and files without extensions for the current directory are listed - except that if the current directory is the root directory, a double period gives the message "Invalid Directory", but three periods will give such a listing. Exactly the same listing can be obtained using "DIR *.".

When using redirection to send DIR output to a file or another command, it is often useful to use /A:-D (to list only files), and /B (to avoid extraneous information such as files sizes, headers and summary information).

To find all instances of a particular file in a directory branch or drive, specify the starting directory pathname and the file as the parameter and use the /S switch (to include subdirectories). This gives full details of each file - size, date, long and short name.

A rather more compact list - certainly more amenable to being redirected - will result from including the /B switch. This list will contain the full path and filename only.

A similar list but with short filenames (and attributes) can be had using ATTRIB /S filename.

When the output of a DIR command is redirected via a pipe, a temporary file is created which is automatically deleted once the operation is completed. By default, this temporary file is located in the directory specified by the "TEMP" environmental variable but, if this is not specified or cannot be found, it will be created in the current directory of the current drive. If the DIR command also refers to the current directory, any such temporary files will be picked up and included in the listing. Note that the "TEMP" environmental variable is normally created as Win9.x loads and would only not exist if specifically removed.

DIR switches can be preset using SET with the DIRCMD environment. When thus set, any switch can be temporarily reset on the command line by prefixing the switch with a "-" (minus sign).

Limitations

The undocumented /Z switch (no long names) would appear to have been not fully developed and has a couple of problems:

It will only work if:

There is no path specified (ie. for the current directory in the current drive)

The path is specified as the root directory of any drive (eg. C:\, D:\, etc.)

The path is specified as the current directory of any drive by using the drive letter only (eg. C:, D:, etc.)

The path is specified as the parent directory using the .. notation (eg. DIR .. /Z)

Any other syntax results in a "File Not Found" error message.

The /Z switch is compatable with the /S switch to show subdirectories (as long as the above rules are followed) and all the files are shown with short names only. The subdirectories are also shown with short names only. However, the header for each subdirectory after the first level gives the subdirectory's long name.

The /Z switch is also compatable with the /B switch to give a simple list of files with short names only. When used with the /S switch as well, all files are listed with their full paths. The file names themselves are all in short form, and the path of those files in the current directory are in short form, but the paths of any files in subdirectories are in long filename form.

Examples:

To display all files and directories in the current directory, including hidden or system files:
dir /a

To display the files in the data directory and its subdirectories in wide format:
dir /w/s

To print a directory listing, using the redirection symbol:
dir > lpt1

To redirect output of the DIR command to the file in the "records" directory:
dir > \records\dir.doc
(If "dir.doc" does not exist, it is created.)

To list the directories and any files without extensions in c:/data (the current directory):
dir... or
dir *.

File Details:

Internal

Thanks to Gerard Schildberger for: the information regarding the /4 switch; pointing out the function of the /Z switch; the existence of the /C[H] switches; and adding to the information about pipes (Note #6).

Thanks to David Lobbestael for the notes on the /C[H] switch.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
June 6, 2000

Diskcopy

DISKCOPY is used to duplicate floppy disks. Any data on the destination disk is overwritten.

Syntax:

DISKCOPY drive1: [drive2:] [/1] [/V] [/M]

drive1
Drive containing disk to be copied from (and to, if the computer has only one floppy drive) .

drive2
Drive containing disk to be copied to (if different from drive1.

/1
Copies only the first side of the disk.

/V
Verifies that the information is copied correctly.

/M
Force multi-pass copy using memory only.

Notes:

DISKCOPY is designed to duplicate standard floppy disks by making a byte-by-byte copy of the source disk to the destination disk.
It follows that:

It will not work with hard drives, CDs, network drives, or Zip, Jazz, etc. type drives;

Source and destination disks must be of the same type, size, and capacity. If they are not, an error message is displayed:

C:\WINDOWS>diskcopy a: a:
Insert SOURCE diskette in drive A:
Press any key to continue . . .

Copying 80 tracks, 18 sectors per track, 2 side(s)
Reading from source diskette . . .

Insert TARGET diskette in drive A:
Press any key to continue . . .
Writing to target diskette . . .

Drive types or diskette types not compatible
Copy process ended
Copy another diskette (Y/N)?

(BUT see "Tricks" below...)

If the source disk is a system disk (i.e. bootable), the destination disk will be too. Conversely, if the source is not a system disk, the destination disk won't be either. This is so however the destination disk was originally formatted.

Once the DISKCOPY command has been entered, prompts to insert source and destination disks are displayed as the process requires. When a single drive is used for both the source and destination disks, an image of the source disk is stored in the directory specified by the TEMP environmental variable. How much disk swapping is required depends on the capacity of the disks and the free space in TEMP.

If the destination disk is not formatted, it is automatically formatted appropriately before the copying process begins.

Exit Codes:

0
The copy operation was successful

1
A non-fatal read/write error occurred

2
Copying was terminated by Ctrl-C before it was complete.

3
A critical error occurred.

4
An initialization error occurred. Most often caused by the two floppy disks being of different types (1.44M and 720K perhaps?)

Tricks

As mentioned in "Note #1" above, DISKCOPY is designed to make identical copies of floppies and it is generally understood that it cannot be used to copy the contents of a 1.2Mb 5.25" floppy onto a 1.4Mb 3.5" floppy (or even a 720Kb 3.5" floppy to a 1.4Mb floppy). In most cases the simple workaround is to use COPY or XCOPY to copy the files from the one disk to the other. However, there are occasions when the "simple" workaround is not appropriate for one reason or another and alternative measures are called for.

In a newsgroup discussion (Ref.1) Kevin G. Rhoads described a way to make DISKCOPY work between disks of different formats by modifying the boot sector of the destination disk to match that of the source.

Yes, you CAN diskcopy a 1.2M onto a 1.44M floppy -- BUT you need to be tricky.

The easiest way to do it, is to use DEBUG or a disk editor and copy the boot sector of the 1.2M onto the boot sector of the 1.44M.

Then remove the 1.44M and access the 3.5" drive, abort at the error message. This forces DOS to recognize the floppy ain't there no more. When you re-insert the 1.44M with the 1.2M boot sector, DOS will read the boot sector and "recognize" the disk as a 1.2M formatted disk. NOW you can diskcopy from the 1.2M 5.25" floppy onto the "1.2M" 3.5" floppy.

This trick is useful when migrating old software's install disks to a machine with only a 3.5" drive. I have used it with several versions of DOS on several machines -- I only saw it fail once, on a machine with a strange BIOS that had lots of other compatibility problems.

The "hybrid" disk will still be formatted to 18 sectors/track, but DOS will recognize the existence of only the first 15 sectors on each track. Similar tricks can be used to place a 720k disk image on a 1.2M disk; or a 360k disk image on any of the other standard disk types.

The hybrid disk will work with DOS 3.2 and later, Win95 (original), probably with Win95 OSR2 and Win98, and probably NOT with NT.

The "trick" to all these sub-formatted hybrid disks, is to recognize that DOS loads the info. on the disk layout from the boot sector when it first recognizes there is a new disk in the drive. To change what DOS thinks the disk layout is, you change what is in the boot sector THEN force DOS to re-register the disk.

Several things can get DOS to re-register the disk, but the only way that works reliably under all DOS versions in all cases seems to be taking the disk out of the drive and trying to access it, then aborting the access. Then when the disk is re-inserted, DOS will treat it as a new floppy and register the disk parameters from the boot sector.

Kevin G. Rhoads, Ph.D. (The Cheshire Cat for official Internet mascot.)

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Diskcopy.com
c:\windows\command
7.0
Win95
21 959
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
21 975¹
24/08/96
win95_13.cab

Win98
21 975¹
11/05/98
win98_28.cab

Win98 SE
21 975¹
23/04/99
win98_25.cab

Superscripts denote which same size files, if any, are identical (using FC).

References

Ref.#
From
Title
Newsgroup
Date

1
Kevin G. Rhoads
Re: diskcopy
comp.os.msdos.misc
08 Jan 2000

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Dos

Allocates portions of the high memory area (HMA) and Upper Memory Blocks (UMBs) to hold parts of the operating system. The UMBs are unused parts of upper memory (between 640K and 1MB) and HMA is the first 64K of extended memory (above 1MB). The DOS commands establish the necessary links between Command.com and the programs/device drivers held in these areas.

The DOS command can only be invoked from Config.sys.

Syntax:

DOS=[high|low] [,umb|,noumb] [,auto|,noauto]
DOS=Single

umb|noumb
umb specifies that DOS should manage UMBs, if they exist. noumb (default) specifies that DOS should not manage UMBs.

high|low
high forces MS-DOS to load a part of itself into the HMA if space is available. low (default) specifies that all MS-DOS is to be kept in conventional memory.

auto|noauto
auto (default) causes DOS to automatically load Himem.sys, Ifshlp.sys, Dblbuff.sys, and Setver.exe unless they are otherwise explicitly loaded in Config.sys. AUTO also forces BUFFERS, FILES, FCBS, LASTDRIVE, and STACKS to load high (if space is available).

Single
Boot to MS-DOS mode.

Notes:

Whilst DOS is used to manage UMBs, these have to be first defined using a UMB provider such as Emm386.exe.

Using DOS to load parts of the operating system, device drivers, and so on into UMBs and HMA, frees space in conventional memory for programs that require it - especially the more complex games.

If Config.sys contain a DOS=SINGLE statement, the computer will display the following on start-up:

You are currently running in MS-DOS mode. Do you want to
return to normal mode, to run Windows applications again [Enter=Y, Esc=N]?

Pressing "Enter" or "Y" causes a reboot which brings you back to the same message.

Pressing "ESC" or "N" results in the message:

You are still running in MS-DOS mode. To return to normal
mode, exit the application you are running, or type WIN again.

C:\>

You can now work in DOS, but if you type WIN, the first message repeats.

Examples:

DOS=high,umb

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
November 13, 2000.

DrivParm

Defines parameters for devices such as disk and tape drives on startup.

The DRIVPARM command can only be invoked through Config.sys. The DRIVPARM command modifies the parameters of an existing physical drive. It does not create a new logical drive. The settings specified in the DRIVPARM command override the driver definitions for any previous block device.

Syntax:

DRIVPARM=/D:number [/C] [/F:factor] [/H:heads] [/I] [/N] [/S:sectors] [/T:tracks]

/D:number
Specifies the physical drive number. number can be range from 0 to 255.
Drive number 0 corresponds with drive a:,
Drive number 1 corresponds with drive b:, and so on.

/C
Specifies that the drive can detect whether the drive door is closed. (see Notes).

/H:heads
The maximum number of drive heads. The value of heads can be from 1 to 99 and the default depends on the value specified for factor.

/I
Specifies an electronically compatible 3.5-inch floppy disk drive. Electronically compatible drives are something other than the above but use a floppy disk drive controller.

/N
Specifies a nonremovable block device.

/S:sectors
The number of sectors per track that the block device supports. Sectors can be in the range 1 through 99 and the default depends on the value you specify for factor.

/T:tracks
The number of tracks per side that the block device supports. The default value depends on the value you specify for factor.

/F:factor
The drive type:

factor
Default
Drive type

heads
sectors
tracks

0
.
.
.
Floppy drive: 160K/180K or 320K/360K (5.25 inch)

1
.
.
.
Floppy drive: 1.2 MB (5.25 inch)

2
.
.
.
Floppy drive: 720 K (3.5 inch)

5
.
.
.
Hard drive

6
.
.
.
Tape drive

7
.
.
.
Floppy drive: 1.44 MB (3.5 inch)

8
.
.
.
Read/write optical disk

9
.
.
.
Floppy drive: 2.88 MB (3.5 inch)

Notes:

The function of the /C switch is the subject of some dispute. The official (DRIVPARM/?) explanation is that this switch tells Dos that the hardware is set up to "detect whether the drive door has been opened since last access". Other commentators have suggested that the /C switch forces Dos to check whether the contents of the drive have been changed since it was last accessed. (Further investigation is required).

Examples:

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Echo

ECHO is primarily used in batch files both to display messages and to prevent the display of commands. It is also used to feed characters to other commands using redirection.

Syntax:

To display the current echo setting:
ECHO

To turn command echoing on or off:
ECHO [ON | OFF]

To display a message:
ECHO message

To force a blank line:
ECHO. or ECHO, or ECHO"

To sound a beep:
ECHO ^G (Ctrl+G)

Notes:

By default, as a batch file runs, each command is displayed on the screen just as if it had been entered from the keyboard. The ECHO command is typically used to control this often unnecessary and distracting output.

The maximum length of message is 122 characters. If message is too long to fit on one line, it will wrap - but not necessarily neatly! For multi-line messages it is better to use a series of ECHO commands with each message less than 75 characters. Actually, 30 to 40 characters probably makes for better readability. For long messages containing instructions perhaps, it may be preferable to prepare a separate text file which can be displayed using the TYPE command.

If ECHO OFF is entered on the command line, not even the command prompt is displayed. However, commands can be entered and error/warning messages are displayed as normal. To redisplay the command prompt, type ECHO ON.

In a batch file, prefixing a command with @ will stop that particular line being displayed.

ECHO can be used with redirection to send a character string (message) to a command, file or device. This can be very handy in batch files using commands requiring predictable user input.

To include a redirection character (<, >, >>, or pipe ( | )) in an ECHO message, it must be enclosed in inverted commas to prevent redirection (or attempted redirection) actually occurring.

Examples:

The following batch program fragment includes a two-line message preceded by a blank line:
ECHO off
ECHO.
ECHO This batch program formats new disks
This would display as:

ECHO off

This batch program formats new disks

In the above example, to stop the ECHO command being displayed, use the @ prefix. Thus:
@ECHO off
ECHO.
ECHO This batch program formats new disks
Would display as:

This batch program formats new disks

To automatically feed a "Y" in response to DEL's "are you sure" warning before deleting all files in a directory:
ECHO y | DEL c:\data\*.*
Note that the warning message is still displayed, but the response is supplied by the "ECHO y"

Similarly, to display the date without having to press [Enter] in response to the prompt:
ECHO. | DATE
Again, the prompt is still displayed, but this time the response is supplied by the "ECHO."

To display the instruction: Enter a number >10:
ECHO "Enter a number >10"
Omitting the inverted commas would cause a file called "10" to be created in the current directory containing the text "Enter a number".

Tricks

As mentioned in the "Notes" above, if you wish to include any of the redirection symbols (<, >, >>, or pipe ( | )) in message, they must be enclosed in inverted commas. These inverted commas are, of course, displayed in the ECHOed message. In a message to the news:alt.msdos.batch, Tom Lavedas pointed out a way to avoid the quotation marks being displayed by following each mark with a backspace character (ASCII 8, Ctrl-H). To include such a character you have to be writing the batch file with a text editor such as EDIT that allows the entry of such "special" characters - in the case of EDIT, you would enter Ctrl-P, Ctrl-H.
For some reason, the backspace does not work if it is the last character on the line - it must be followed by something - even a space.
Tom Lavedas also points out that this technique could cause problems when printing out the batch file on some printers.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

FCBS

Used to set the number of file control blocks (FCBs) that can be open at any time. A file control block is a data structure that stores information about a file enabling programs to access it.

The FCBS statement is only valid in Config.sys.

Syntax:

FCBS=x, [y] FCBSHIGH=x, [y]

x
The number of FCBs to be open at any time. x must be in the range 1 to 255 and the default is 4

y
The number of FCBs that cannot be closed automatically. This parameter is not required in Dos 7 and is ignored.

Notes:

The use of File Control Blocks to open files is a hangover from the very early days of computing and was superseded by File Handles (see FILES) with the introduction of DOS 2. It is very unlikely that any program in use today would use File Control Blocks.

Each FCB specified requires 60 bytes of memory.

If the DOS command is used to manage the upper memory blocks (it usually is), the default values for FCBS are automatically loaded into the HMA. ie. the line
FCBSHIGH=4,0
is invoked without needing to be explicitly stated. If an FCBS or FCBSHIGH statement is included in Config.sys, this will take precedence over the default values.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Files/FilesHigh

Specifies the number of files that MS-DOS can access at one time.

The FILES and FILESHIGH commands can only be invoked from Config.sys.

Syntax:

FILES=x
FILESHIGH=x

x
The number of files that can be accessed at one time. x can be from 8 to 255, with a default value of 8.

Notes:

Although the default value for FILES is 8, some programs such as compilers and databases may require several hundred files to be open at any time. A value of 30 has been recommended as a good general purpose figure.

The value set for FILES may not be the only determining factor in how many files a program can have open at a time, and the design of the programs being used may be a limiting factor.

Each FILE specified requires about 50 bytes of memory.

If the DOS command is used to manage the upper memory blocks (it usually is), the default value for FILES are automatically loaded into the HMA. ie. the line
FILESHIGH=8
is invoked without needing to be explicitly stated.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Find

The FIND command is used to search for a text string in a file or files. After searching the specified files, FIND displays any lines of text that contain the string.

Syntax:

FIND [/V] [/C] [/N] [/I] "string" "filename1" "filename2" "filename ..."

/V
Displays all lines NOT containing the specified string.

/C
Displays only a count of lines containing the string.
If used with /V, FIND displays a count of the lines that do not contain the specified string.

/N
Displays line numbers with the lines. If /C and /N are used together, /N is ignored.

/I
Ignores the case of characters in string. By default FIND is case sensitive and searches for an exact character match.

string
The text string to be found. String must be in inverted commas.

filename
The file(s) to be searched. If filename does not contain spaces, it does not need to be enclosed in inverted commas.

Notes:

If filename is not specified, FIND searches the text input from the "standard" source (usually the keyboard), a pipe, or a redirected file.

Wildcards (* and ?) are not accepted in filename. However, to search for string in a set of files, it is often possible to use the FIND command within a FOR loop structure.

If a DIR command output is piped to FIND, a list of files/directories whose names contain string will be displayed. There is no straightforward way to use DIR to make a list of files within which FIND will search for string.

Because inverted commas are used to delimit string, they cannot be used within string as part of the search pattern. To include inverted commas within string, it is necessary to use the "special character" of double inverted commas ("") which FIND interprets as inverted commas in the search string.

The FIND command does not accept carriage returns in the search string - nor will it recognise a string that has a carriage return embedded in it. For example, FIND does not report a match for the string "tax file" if "tax" and "file" happen to be on different lines because of word wrapping.

Exit Codes:

0
The search was completed successfully and at least one match was found.

1
The search was completed successfully, but no matches were found.

2
The search was not completed successfully. In this case, an error occurred during the search, and FIND cannot report whether any matches were found.

Examples:

To display all lines from the file "pencil.ad" that contain the string "Pencil Sharpener":
FIND "Pencil Sharpener" pencil.ad

If the string contains quotation marks, these must be doubled:
FIND "This paper is ""for discussion only."" It is not a final report." report.doc

To search the current directory for the string "PROMPT" in all .BAT files:
FOR %f in (*.bat) DO FIND "PROMPT" %f

To search your hard disk to find and display the filenames on drive C that contain the string "CPU", you can use the pipe "|" to direct the results of a DIR command to FIND:
DIR c:\ /s /b | FIND "CPU"
Remember, the default output from DIR can be upper and/or lower case depending on how a file was saved. To catch all instances of "CPU", "cpu". etc. either use the /L switch with DIR (to force lower case output), or the /I switch with FIND (to ignore case in string).

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Find.exe
c:\windows\command
7.0
Win95
6 658¹
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
6 658²
24/08/96
win95_14.cab

Win98
6 658²
11/05/98
win98_41.cab

Win98 SE
6 658²
23/04/99
win98_45.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

For

The FOR command is used to run a specified command or series of commands for each file in a set of files. FOR is usually used in batch programs but can also be used at the command prompt.

Syntax:

FOR %variable IN (set) DO command

%variable
A single character that acts as a replaceable marker parameter. When used in batch files, %variable must be preceded by a second % sign (to become %%variable).
To avoid confusion with the batch file parameters %0 - %9, variable can be any character except the numerals 0 - 9.
%variable is replaced with each member of set until command has processed all them all.

set
A list of text strings (eg. file names), separated by spaces, to be processed by command. Wildcards for filenames are recognized (but see notes below). set must be enclosed in parentheses.

command
The command, complete with any required parameters and/or switches, to carry out for each file. Often one of the parameters will be variable - being the file in set to be operated on.

Notes:

In complex batch programs, multiple values for variable can be used to distinguish different replaceable variables.

FOR commands can contain IF clauses but not a second FOR.

It is not hard to construct a complex FOR statement that is virtually impossible for normal mortals to decipher (even if it does work).

By default, FOR only recognises short (8.3) filenames in set unless a long filename is explicitly stated (no wildcards). However, if a FOR operation produces a long filename, these are handled without difficulty.
The LFNFOR command can be used to enable full long file name support - BUT see "Bug Warning" below.

Examples:

To display the contents of all the files in the current directory that have the extension ".doc" or ".txt":
FOR %v IN (*.doc *.txt) DO TYPE %v
Each file that has the ".doc" or ".txt" extension in the current directory is substituted for the %v variable until the contents of every such file are displayed.

To use this command in a batch file, it would be written:
FOR %%v IN (*doc *txt) DO TYPE %%v
If the double % sign is not used, the variable is not recognised and an error message is displayed.

Note, however, that
FOR %v IN (lettershome*.doc notestotheboss*.txt) DO TYPE %v
will find no matches unless there is a previous LFNFOR On command.

Bug Warning

When:

LFNFOR is On, and

FOR is used to process a set of files in which the set description includes a path,

then that path is only passed to the first member of the set. Subsequent members of the set do not include the specified path!

To demonstrate the way this bug works, issue the following commands:

LFNFOR On
Echo Off
FOR %v IN (C:\*.*) DO echo %v
Echo On

The output on the screen is a list of the files in the root directory of the C: drive showing their long filenames only. Note that only the first file in the list includes the full path (i.e. "C:\MSDOS.SYS, perhaps) and all the rest are bare filenames.

When LFNFOR is OFF, the same FOR command as above produces a list of the 8.3 filenames all of which include the path (as would be expected).

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 28, 1999

Format

Formats a disk for use with MS-Dos.

Syntax:

FORMAT drive: [/Switches]

Switches

/V[:label]
Specifies a volume label. If the /V switch is omitted, or label is not specified, a prompt for a volume label is displayed after formatting is completed.
If no volume label is required, the prompt can be avoided by specifying: /V:""
If a label is specified and more than one disk is formatted in a session, all of the disks will be given the same volume label.

/Q
"Quick" format of a previously formatted disk.
The disk's file allocation table (FAT) and root directory are deleted but it is not scanned for bad areas.

/S
Copies system files to the formatted disk (to make a boot disk).

/B
Allocates space on the formatted disk for system files.

/F:size
Formats a disk to a capacity other than that for which the drive was designed.
size can be: 360, 720, 1.2, 1.44, 2.88.

/T:tracks
Specifies the number of tracks per disk side.

/N:sectors
Specifies the number of sectors per track.

/1
Formats a single side of a floppy disk.

/4
Formats a 5.25-inch 360K floppy disk in a high-density drive.

/8
Formats eight sectors per track

/C
Tests clusters that are currently marked "bad." By default, if a disk contains clusters that have been marked as "bad", FORMAT does not retest the clusters; it simply leaves them marked "bad".

/U
Unconditional format. This switch was instituted in Dos 5 along with the "Unformat" command. In Dos 7.x the Unformat command has been dropped and all formatting is unconditional. This switch is therefore redundant but presumably maintained so that batch files written with it will not fail.

/AUTOTEST
Formatting proceeds without further user input or warning messages. As this will also work with hard drives, it is probably advisable to preconfigure the command in a batch file rather than using it directly from the command line. The AUTOEST switch can be used in conjunction with the /U, /S, and /F switches. It is not compatible with /Q (causing an error message) and /V is ignored.

/BACKUP
Not sure what this does. Seems to be similar to /AUTOTEST except that it asks for a Volume label, and displays data on number of bytes available, etc. Haven't tried it with c: drive so don't know whether it warns before formatting a hard drive.

/SELECT
Not sure what this does - but it seems to "unformat" a disk. Anyway, it renders the disk a "non-system disk" (which can be reformatted).

/Z:n
Specifies the cluster size in multiples of 512 bytes. Valid values of n are:

n
Cluster size
n
Cluster size

1
512 bytes
16
8K

2
1K
32
16K

4
2K
64
32K

8
4K

Notes:

Unless used with the /Q switch, FORMAT assumes that a floppy disk in a 3.5" drive is to be formatted at 1.44Mb. If the disk is 720 Kb, the /F:720 switch must be used or an error message results. If the /Q switch is used, FORMAT checks the existing format and will detect a disk formatted at 720 Kb.

By default, and unless the /Q switch is used, each sector on the disk is checked during the formatting process to ensure that the sector can properly store data. If a bad sector is located, it is marked and is not used.

When formatting is complete, a message is displayed showing the total disk space, any space marked as defective, the space used by the operating system (if any), and the space available for files.

When formatting a hard disk, a warning is first displayed:

C:\WINDOWS>Format c:

WARNING, ALL DATA ON NON-REMOVABLE DISK DRIVE x: WILL BE LOST!
Proceed with Format (Y/N)?

Although disks can be formatted in "non-standard" ways, this is not advised. Both disks and drives are designed for operation at their specified formats and faults will occur if used at other formats.

FORMAT cannot be used on a virtual drive created using the SUBST command.

Tricks

A fast way to reformat a floppy is:
ren /? | format /q/v:"" > nul
The ren /? part feeds, along with a load of redundant material, an "enter", followed by a "n, enter" in response to FORMAT's prompts. The >nul prevents the display of the somewhat messy mixed up output of the two commands.

Exit Codes:

0
The format operation was successful.

3
FORMAT was terminated by Ctrl-C before completion

4
A fatal error occurred (any error other than 0, 3, or 5).

5
The user pressed N in response to the prompt "Proceed with Format (Y/N)?" to stop the process.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Format.com
c:\windows\command
7.0
Win95
40 135
11/07/95
win95_02.cab

7.1
Win95 (OSR2.x)
49 543
24/08/96
win95_02.cab

Win98
49 575¹
11/05/98
win98_28.cab

Win98 SE
49 575¹
23/04/99
win98_25.cab

Superscripts denote which same size files, if any, are identical (using FC).

Thanks to Dewey Chan and Bob Ennis for their comments on the /U switch.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000

GoTo

Directs Windows to a labelled line in a batch program.

Syntax:

GOTO label
GOTO:label

label
The line in a batch file to which execution should branch.
label must match a label in the batch program or the batch program stops and an error message is displayed.

Notes:

A batch file label is a text string, on a line of its own and beginning with a colon.

Although there are few restrictions on the make up of a label, GOTO is the only command to use labels and imposes its own rules:

GOTO only recognises the first 8 characters in the first word of the label. Subsequent characters and/or words are ignored. Thus, the labels "hithere01" and "hithere02" are both equivalent to "hithere0".

GOTO looks for the first instance of a label to match label starting from the beginning of the batch file - NOT from where it is called. Thus, using the above example, "hithere02" will never be called.

GOTO treats a colon (:) as a space. Thus "GOTO step1", "GOTO:step1", "GOTO: step1" and "GOTO :step1" are all treated as equivalent. This can be useful when passing a GOTO command as an arguement in a batchfile: GOTO:step1 would be passed as a single arguement whereas GOTO step1 would have to be passed as two.

Example:

To format a disk in drive A and display an appropriate message of success or failure:

@ ECHO off
FORMAT a: /s
IF NOT errorlevel 1 GOTO end
ECHO An error occurred during formatting.
:end
ECHO Successfully formatted the disk in drive A.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
February 14, 2000.

If

The IF command is used to provide conditional processing in batch programs.

Syntax:

IF condition command

IF NOT condition command

condition
IF will test for any of three conditions:

string1==string2

EXIST filename

ERRORLEVEL x

IF tests condition and determines whether it is True or False.
For: IF condition command
   command is executed should condition be TRUE and skipped if FALSE.
For: IF NOT condition command
   command is executed should condition be FALSE and skipped if TRUE.

command
Any Dos command or executable program along with parameters and/or switches as required. Only one command can be specified.
To have more than one command dependent on the result of condition, it is necessary to branch to a label or second batch file and have the series there .

Although IF works in the same way for each of the above conditions, they are used in such different circumstances that they could almost be considered three separate commands:

1. Comparing Strings

Syntax:

IF [NOT] string1==string2 command

Notes:

When comparing strings, note the use of the double equal signs!
(Why it was considered that a single equal sign was insufficient is beyond me).

String1 and/or string2 can be literal strings, batch variables (eg. %1), or environmental variables (eg. %windir%).

The comparison is case sensitive
ie.

IF %windir% == C:\WINDOWS
IF %windir% == c:\windows
will be seen as True
will be seen as False

An error occurs if either string doesn't have at least one character. This can happen if one of the strings is a variable, and very likely will happen should the IF statement be contained within a loop in which the variable is changed in each cycle.
To avoid this error arising it is typical to add dummy character(s) to both sides as:

IF [NOT] "string1"=="string2" command
or
IF [NOT] string1x==string2x command

Any character can be used as the dummy but it makes for simplicity to use the same character consistently. Indeed, the dummy can often be used as one of the trademarks of some batch file authors.

Neither literal nor variable strings may contain = ; | < >.

The parsing mechanism in IF seems to be able to handle embedded spaces in either string (literal or variable) but does not recognise quotes as special characters holding such strings together. Should the test result require command to be carried out, and string2 contains embedded spaces IF takes the second word as the command - typically resulting in a "Bad command" error message (see Examples below).
I'm sure there is a good reason for IF's aversion to spaces - but it's a right nuisance!

Examples

to determine whether all command line parameters have been processed in a loop containing a SHIFT command:

	.....
	:Step1
	IF %1"==" GOTO Step2
	SHIFT
	COPY %1 a:
	GOTO Step1
	:Step2
	.....

Say the environmental variable "Name" could contain information in the form Fred Smith and "Name1" is Fred Smith (ie. with embedded spaces), then:

Command
If condition is True
If condition is False

IF %Name%"==" GOTO CreateName

OK - branch to label CreateName
OK - command not executed

IF NOT %Name%"==" GOTO Step2

OK - command not executed
OK - branch to label Part2

IF %Name%"==%Name1%" GOTO Part2

Error - "Bad command"
OK - command not executed

IF Fred Smith"==%Name%" GOTO Step2

Error - "Bad command"
OK - command not executed

2. Checking for the existence of a file (or directory)

Syntax:

IF [NOT] EXIST [path]filename command

filename
A file or Dos device

Notes:

path must be included unless filename is in the current drive and directory. Entries in any Dos PATH statement are not recognised.

[path]filename can use either short or long filename form (or a mixture) - but long names must be enclosed in quotes if they include spaces.

Directories cannot be detected directly. However, the Dos devices (NUL, AUX, CON, COM1-4, LPT1-3, and PRN) are accessible from every directory and it follows that if directoryname\device exists, then so does the directory. Conversely, if directoryname\device doesn't exist, then nor does the directory.

Although, theoretically, any of the above devices can be used for the test, every reference I have seen uses the NUL device. A quick test on my machine indicated that all devices were recognised except for LPT1/PRN which resulted in an error message:

	General failure reading device
	Abort, Retry, Fail?

For reliability, NUL is probably the best choice.

As well as the essential Dos devices (listed above) being accessible from any existing directory, any installed Dos devices (as recorded in an MEM /D display) are also so available and are recognised by IF [NOT] EXIST. Note that the names by which these devices are recognised is not the same as that of the device driver loaded in Config.sys and seem to be generally of the form:

Device Driver filename
Installed Device Name

HIMEM.SYS
XMSXXXX0

EMM386.EXE
EMMXXXX0

Display.sys
CON

Dblbuff.sys
DblBuff$

Ifshlp.sys
IFS$HLP$

Examples

To copy a font to c:\windows\fonts from a CD-ROM (drive x:) only if it isn't already installed:

  IF NOT EXIST c:\windows\fonts\maxi.ttf COPY x:\maxi.ttf c:\windows\fonts

To create the directory "tests" if it doesn't already exist:

  IF NOT EXIST c:\tests\NUL MD c:\tests

To check that Himem.sys is currently installed:

  IF EXIST XMSXXXX0 echo Himem installed

Oddities

In Eric's "webspace" there is a description of distinctly bizarre behaviour when the output of IF EXIST filename is redirected to a file. Essentially:

the file is created;

Should the condition be True, when executed in a batch file, the entire next line (including prompt and [Enter]) is copied to the file. When working from the command line, the prompt along with any text entered from the keyboard up to and including [Enter] is put into the file. (Text entered is not displayed).

Should the condition be False, a zero byte file is created.

I cannot see any use for this strange behaviour - but then I am not a batch file programmer!

3. Checking the exit code of a previous command

Syntax:

IF [NOT] ERRORLEVEL x command

Notes:

When external Dos commands terminate, an exit code is returned to MS-Dos. For example, a value of 0 is typically used to indicate that a program was successfully executed. IF [NOT] ERRORLEVEL x tests the exit code returned by the last command and returns True when the exit code is greater than or equal to x and False when the exit code is less than x.

Should, say, the exit code from the last command be 2 then:

IF ERRORLEVEL 0 command0
IF ERRORLEVEL 1 command1
IF ERRORLEVEL 2 command2
IF ERRORLEVEL 3 command3
(True)
(True)
(True)
(False)
command0 is executed
command1 is executed
command2 is executed
command3 is skipped

IF NOT ERRORLEVEL 0 command0
IF NOT ERRORLEVEL 1 command1
IF NOT ERRORLEVEL 2 command2
IF NOT ERRORLEVEL 3 command3
(True)
(True)
(True)
(False)
command0 is skipped
command1 is skipped
command2 is skipped
command3 is executed

To associate a particular command with an exit code, it is necessary to use one of two constructions:

Arrange the IF commands to test for exit codes in descending order.
However, note that, unless commandx dictates otherwise, each IF line will be acted on in sequence. There are three ways to prevent valid, but irrelevant, commands being processed:

Have the batch file branch to a label (using GOTO label);

Irreversibly branch to a new batch file (by simply naming the file);

Stopping the batch file with EXIT.

Use a nested construction: IF ERRORLEVEL x IF NOT ERRORLEVEL x+1 commandx (where x is the exit code). The logic here is that commandx is only executed when x is True and any number larger than x is False. This structure is useful when each exit code is to result in a single command and a series of GOTOs would be cumbersome.

Examples

A series of IF commands is to follow a CHOICE command to display the key that was pressed in response to the prompt:

   CHOICE /C:ABC Press A, B, or C:
   IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 ECHO You pressed "A"
   IF ERRORLEVEL 3 IF NOT ERRORLEVEL 4 ECHO You pressed "C"
   IF ERRORLEVEL 2 IF NOT ERRORLEVEL 3 ECHO You pressed "B"

Note: that the order of IF commands is not important.

XCOPY is used in a batch file to back up any new or modified spreadsheet files. A series of IF commands are used to display various status message at the conclusion of the copying process.

   XCOPY d:\spreadsheets\*.* f:\spreadsheets\ /s/m
   IF ERRORLEVEL 3 GOTO Problems
   IF ERRORLEVEL 2 GOTO Cancel
   IF ERRORLEVEL 1 GOTO NoFiles
   IF ERRORLEVEL 0 GOTO OK

   :Problems
   ECHO You have problems!
   ECHO Modified/New files have not been backed up.
   GOTO end

   :Cancel
   ECHO Copying process terminated.
   GOTO end

   :NoFiles
   ECHO No files found to copy.
   GOTO continue

   :OK
   ECHO All new/modified files backed up.
   GOTO continue

   :continue
   ........

   :end

Note: that the order of IF commands is most important!

Oh yes, the (apparent) exception. To set an environmental variable according to a keypress (say), either of the above approaches will work just fine. However, simply to use

   CHOICE /C:ABC Press A, B, or C:
   IF ERRORLEVEL 3 SET key=C
   IF ERRORLEVEL 2 SET key=B
   IF ERRORLEVEL 1 SET key=A

is tempting - but doesn't work! Instead the order should be reversed as:

   CHOICE /C:ABC Press A, B, or C:
   IF ERRORLEVEL 1 SET key=A
   IF ERRORLEVEL 2 SET key=B
   IF ERRORLEVEL 3 SET key=C

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
October 17, 2000.

Install/InstallHigh

Loads a memory-resident program into memory when you start MS-DOS.

The INSTALL and INSTALLHIGH commands can only be invoked from Config.sys.

Syntax:

To install a memory resident program into conventional memory:
INSTALL=filename

To install a memory resident program into upper memory:
INSTALLHIGH=filename

filename
The memory-resident program to be installed. filename must include the full path name (unless in the root directory) and the extension (.exe, .com, or whatever). It should also include any command-line switches that are required.

Notes:

Memory-resident programs stay in memory as long as the computer is on and can be used even when other programs are active.

All INSTALL commands are processed after any DEVICE commands and before the command interpreter is loaded - hence the need to specify the file extension.

INSTALL does not create an environment for programs it loads. This means that the programs take up slightly less memory than if loaded in Autoexec.bat (or from the command line). INSTALL is not appropriate for programs that use environment variable, shortcut keys, or that require the command interpreter to handle critical errors.

INSTALL is typically used with such MS-DOS memory-resident programs as KEYB, NLSFUNC, and SHARE.

Examples:

To install Fastopen.exe from the windows/olddos directory on c:, and to specify that Fastopen is to track the opening of up to 100 files and directories on drive c:
INSTALL=c:\windows\olddos\fastopen.exe c:=100

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Label

The LABEL command is used to create, change, or delete the volume label (name) of a disk. The volume label of a disk is displayed as part of the directory listing along with the volume serial number, it it exists.

Syntax:

LABEL [drive:][label]

drive:
The location of the disk to be named.

label
The new volume label.

none
Displays current disk label, if they exist. Prompts to enter a new label or delete the existing one.

Notes:

If label is not specified, the following prompt is displayed:

C:\WINDOWS>Label
Volume in drive A is xxxxxxxxxxx
Volume Serial Number is xxxx-xxxx
Volume label (11 characters, ENTER for none)?

A volume label can contain up to 11 characters and can include spaces but not:

* ? / \ | . , ; : + = [ ] ( ) & ^ < > "

Volume labels are displayed in uppercase letters only.

LABEL does not work with a virtual drive created with the SUBST command.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Label.exe
c:\windows\command
7.0
Win95
9 260
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
9 324¹
24/08/96
win95_14.cab

Win98
9 324¹
11/05/98
win98_41.cab

Win98 SE
9 324¹
23/04/99
win98_45.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 28, 2000.

LastDrive/LastDriveHigh

Used to designate the maximum number of drives (real and virtual) recognized by the operating system.

The LASTDRIVE command can only be invoked from Config.sys.

Syntax:

LASTDRIVE=x

LASTDRIVEHIGH=x

x
A drive letter from A to Z representing the last valid drive that MS-DOS is to recognize.
(Default is Z)

Notes:

If the DOS command is used to manage the upper memory blocks (it usually is), the default values for LASTDRIVE are automatically loaded into the HMA. ie. the line
LASTDRIVEHIGH=z
is invoked without needing to be explicitly stated.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

LFNFOR

Enables/Disables Long file names when processing FOR commands.

Syntax

To enable Long file name support with FOR:
LFNFOR On

To disable Long file name support with FOR (default):
LFNFOR Off

To display the current status of LFNFOR:
LFNFOR

Notes

This is one of those odd commands that has presumably been included to allow batch file programmers when updating complex batch files designed for previous versions of Dos. Nevertheless, being able to specify whether a set of files is to be processed by their short or long filenames does add a new tool to the programmers arsenal.

When LFNFOR is ON, the FOR command demonstrates a nasty bug when processing sets of files that include a path - see FOR for further details.

File Details

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 28, 1999

Lock/Unlock

Locks/unlocks a drive enabling/disabling direct disk access for an application.

Syntax:

To enable direct disk access:
LOCK [drive:]

To disable direct disk access:
UNLOCK [drive:]

Notes:

When the LOCK command is issued, a warning message is displayed and confirmation is required before going any further:

WARNING: The LOCK command enables direct disk access by programs
that can CORRUPT file names and/or DESTROY disk data, resulting in
the loss of files on your disk.

Are you sure (Y/N)?

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

MD (or MkDir)

Creates a directory. MD and MkDir are synonymous.

Syntax:

MD [path] directoryname

Notes:

There does not appear to be any limit to the number of subdirectories or to the length of the path.

Although directories can include an extension, this is seldom done and may even confuse some programs.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Mem

The MEM command is used to display a table showing how memory (RAM) is currently allocated.

Syntax:

MEM [/Switches]

None
Displays the status of the computer's used and free memory

/A
Adds an extra line about available space in the High Memory Area.

/C
Lists the programs that are currently loaded into memory and shows how much conventional and upper memory each program is using.

/D
Lists the programs and internal drivers that are currently loaded into memory.

/F
Lists the free areas of conventional and upper memory.

/M progname  
Shows how the program (progname) is currently using memory.

/P
Pauses after each screenful of information.

/H
Brief help (same as /?)

Notes:

The status of expanded memory is only included if it conforms to version 4.0 of the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS).

The status of the upper memory area is only displayed if a UMB provider such as EMM386 is installed and the command DOS=UMB is included in the "Config.sys" file.

Examples:

C:\WINDOWS>MEM

	Memory Type        Total       Used       Free
	----------------  --------   --------   --------
	Conventional          636K        70K       566K
	Upper                 195K       195K         0K
	Reserved                0K         0K         0K
	Extended (XMS)     15,165K       169K    14,996K
	----------------  --------   --------   --------
	Total memory       15,996K       434K    15,562K

	Total under 1 MB      831K       264K       566K

	Largest executable program size       566K (579,888 bytes)
	Largest free upper memory block         0K       (0 bytes)
	MS-DOS is resident in the high memory area.

C:\WINDOWS>_

C:\WINDOWS>MEM /A

	Memory Type        Total       Used       Free
	----------------  --------   --------   --------
	Conventional          636K        70K       566K
	Upper                 195K       195K         0K
	Reserved                0K         0K         0K
	Extended (XMS)     15,165K       169K    14,996K
	----------------  --------   --------   --------
	Total memory       15,996K       434K    15,562K

	Total under 1 MB      831K       264K       566K

	Largest executable program size       566K (579,888 bytes)
	Largest free upper memory block         0K       (0 bytes)
	Available space in High Memory Area     0K     (368 bytes)
	MS-DOS is resident in the high memory area.

C:\WINDOWS>_

C:\WINDOWS>MEM /C

	Modules using memory below 1 MB:

	  Name           Total           Conventional       Upper Memory
	  --------  ----------------   ----------------   ----------------
	  SYSTEM      38,400   (38K)     13,040   (13K)     25,360   (25K)
	  HIMEM        1,168    (1K)      1,168    (1K)          0    (0K)
	  EMM386       4,320    (4K)      4,320    (4K)          0    (0K)
	  ....           ...    ...         ...    ...         ...     ...
	  SETVER         832    (1K)          0    (0K)        832    (1K)
	  MSCDEX      32,176   (31K)          0    (0K)     32,176   (31K)
	  Free       579,904  (566K)    579,904  (566K)          0    (0K)

	Memory Summary:

	  Type of Memory       Total         Used          Free
	  ----------------  -----------   -----------   -----------
	  Conventional          651,264        71,360       579,904
	  Upper                 199,312       199,312             0
	  Reserved                    0             0             0
	  Extended (XMS)     15,529,328       173,424    15,355,904
	  ----------------  -----------   -----------   -----------
	  Total memory       16,379,904       444,096    15,935,808

	  Total under 1 MB      850,576       270,672       579,904

	  Largest executable program size         579,888   (566K)
	  Largest free upper memory block               0     (0K)
	  MS-DOS is resident in the high memory area.

C:\WINDOWS>_

"Reserved" is the memory located on add-on boards such as video adapter boards.
"Largest executable program size" is the largest contiguous block of conventional memory available for a program.
"Largest free upper memory block" is the largest area of upper memory available for a program.
"MS-Dos is resident in the high memory area" indicates that MS-Dos is running in the first 64K of extended memory rather than in conventional memory.

C:\WINDOWS>MEM /D

Conventional Memory Detail:

  Segment               Total        Name         Type
  -------          ----------------  -----------  --------
   00000              1,024    (1K)               Interrupt Vector
   00040                256    (0K)               ROM Communication Area
   00050                512    (1K)               DOS Communication Area
   00070              1,424    (1K)  IO           System Data
                                        CON       System Device Driver
                                        AUX       System Device Driver
    ....               ...     ...      ....      ......
   0116B             90,400   (88K)  MEM          Program
   0277D            489,504  (478K)  MSDOS        -- Free --
   09EFF              2,992    (3K)  IO           System Data
   09FBA                 80    (0K)  --------     Data

Upper Memory Detail:

  Segment  Region       Total        Name         Type
  -------  ------  ----------------  -----------  --------
   0B15B       1      2,608    (3K)  vmm32        Data

   0C801       2     26,896   (26K)  IO           System Data
                     26,864   (26K)     CTSOUND0  Installed Device=CTSB16
     ...      ..        ...    ...    ....         .....
   0E900       2     32,176   (31K)  MSCDEX       Program
   0F0DB       2     29,264   (29K)  vmm32        Data

Memory Summary:

  Type of Memory       Total         Used          Free
  ----------------  -----------   -----------   -----------
  Conventional          651,264        71,360       579,904
  Upper                 199,312       199,312             0
  Reserved                    0             0             0
  Extended (XMS)     15,529,328       173,424    15,355,904
  ----------------  -----------   -----------   -----------
  Total memory       16,379,904       444,096    15,935,808

  Total under 1 MB      850,576       270,672       579,904

  Memory accessible using Int 15h               0     (0K)
  Largest executable program size         579,888   (566K)
  Largest free upper memory block               0     (0K)
  MS-DOS is resident in the high memory area.

  XMS version  3.00; driver version  3.95

C:\WINDOWS>_

C:\WINDOWS>MEM /F

Free Conventional Memory:

	  Segment         Total
	  -------   -----------------
	   01159          288    (0K)
	   0116B       90,400   (88K)
	   0277D      489,504  (478K)

	  Total Free: 580,192  (567K)

	Free Upper Memory:

	  Region   Largest Free     Total Free      Total Size
	  ------  --------------  --------------  --------------
	      1         0   (0K)        0   (0K)    2,608   (3K)
	      2         0   (0K)        0   (0K)  196,704 (192K)

C:\WINDOWS>_

To find out what memory the 'vmm32' module has been allocated:

C:\WINDOWS>MEM /M vmm32

VMM32 is using the following memory:

	  Segment  Region       Total        Type
	  -------  ------  ----------------  --------
	   00914                 48    (0K)  Data
	   00917              3,728    (4K)  Program
	   0B15B       1      2,608    (3K)  Data
	   0E8ED       2        304    (0K)  Data
	   0F0DB       2     29,264   (29K)  Data
	                   ----------------
	  Total Size:        35,952   (35K)

C:\WINDOWS>_

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Mem.exe
c:\windows\command
7.0
Win95
32 082
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
32 146¹
24/08/96
win95_14.cab

Win98
32 146¹
11/05/98
win98_41.cab

Win98 SE
32 146¹
23/04/99
win98_46.cab

Superscripts denote which same size files, if any, are identical (using FC).

Thanks to Gerard Schildberger for pointing out the /H switch

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 28, 2000.

Mode

The MODE series of commands is used to control the computers links with its peripherals.

Display lines and columns

Display configuration

Printer configuration

Serial port configuration

Device status

Redirect printing from parallel to serial port

Set typematic rate

Set code page (character set) for international use

1. Mode - Display (Lines and Columns):

Sets the number of lines and columns (characters/line) of the display.

Syntax:

MODE CON[:] [COLS=c] [LINES=n]

c
The number of characters per line. c can be 40 or 80 (Default: 80).

n
The number of lines displayed on the screen. n can be 25, 43, or 50 (Default: 25).

Example

To increase the number of lines displayed on the screen from 25 (default) to 50:
MODE CON Lines=50

2. Mode - Display Configuration:

Selects or reconfigures the active display adapter and its display mode.

Syntax:

MODE [display][,n]

display
The type of display adaptor - one of the following:

BW40
BW80
A colour adaptor with colour turned off and 40 characters/line.
A colour adaptor with colour turned off and 80 characters/line.

CO40
CO80
A colour adaptor with colour turned on and 40 characters/line.
A colour adaptor with colour turned on and 80 characters/line.

MONO
A monochrome adaptor (with 80 characters per line).

n
The number of lines displayed on the screen. n can be 25, 43, or 50. Default: 25.

3. Mode: Printer configuration:

This aspect of MODE is used to specify the parallel port (LPT1, LPT2, LPT3 or LPT4) to be used by an IBM/Epson compatible printer. By default, Dos output to a printer is 80 characters/line and 6 lines/inch. MODE can be used to specify 132 characters/inch and/or 8 lines/inch as long as the printer supports these features (and virtually all do - either having a wide carriage or by printing in "condensed" mode)

Syntax:

MODE LPT n[:] [COLS=c] [LINES=l] [RETRY=r]
or
MODE LPT n [c], [l], [r]

LPT n
The parallel port to which the device is attached. n is 1, 2, 3, or 4

COLS=c
The number of characters (columns) per line. c is 80 or 132 - Default: 80.

LINES=l
The number of lines per inch. l is 6 or 8 - Default: 6.

RETRY=r
the retry action to take if a time-out error occurs when sending output to the specified port. This parameter causes part of MODE to remain resident in memory. r may be:

b
Return "busy" from a status check of a busy port.

e
Return an error from a status check of a busy port.

p
Continue retrying until printer accepts output.

r
Return "ready" from a status check of a busy port.

n
Take no retry action (default value).

Note:

If the COLS, LINES, or RETRY parameters are omitted, the previous values are retained.

4. Mode: Serial Port Configuration:

Sets the parameters for a serial port.

Syntax:

MODE COMm[:] [BAUD=b] [PARITY=p] [DATA=d] [STOP=s] [RETRY=r]
or
MODE COMm[:] [b], [p], [d], [s], [r]

COMm
The serial (Com) port. m is from 1 to 4.

BAUD=b
The first two digits of the transmission rate [bits/sec]:

12
1200 baud
24
2400 baud

48
4800 baud
96
9600 baud

19
19200 baud (not supported on all computers)

PARITY=p
Specifies how the system uses the parity bit to check for transmission errors. p may be:

N
None
M
Mark

E
Even (Default)
S
Space

O
Odd

DATA=d
Specifies the number of data bits per character. d can be from 5 to 8 (default: 7)

STOP=s
Specifies the number of stop bits that define the end of a character. s can be 1, 1.5, or 2 (Default: 1)

RETRY=r
the retry action to take if a time-out error occurs when sending output to the specified port. This parameter causes part of MODE to remain resident in memory. r may be:

b
Return "busy" from a status check of a busy port.

e
Return an error from a status check of a busy port.

p
Continue retrying until printer accepts output.

r
Return "ready" from a status check of a busy port.

n
Take no retry action (default value).

5. Mode - Device Status:

Displays the status of one or all of the devices installed on the system.

Syntax:

MODE [device] [/STATUS]

device
The name of the device. Default: all installed devices.

/STATUS
This switch includes the status of any redirected parallel printers.
Without this switch, the status of all installed devices except redirected parallel printers is displayed.

Example

C:\WINDOWS>MODE /status

Status for device LPT1:
LPT1: not rerouted
Retry=NONE
Code page operation not supported on this device

Status for device LPT2:
LPT2: not rerouted
Retry=NONE
Code page operation not supported on this device

Status for device LPT3:
LPT3: not rerouted

Status for device CON:
Columns=80
Lines=50

No code page has been selected
Prepared code pages:
  code page 850
  code page not prepared
MODE status code page function completed

Status for device COM1:
Retry=NONE

Status for device COM2:
Retry=NONE

Status for device COM3:
Retry=NONE
Return code (ERRORLEVEL):   0

C:\WINDOWS>_

6. Mode - Redirect printing:

Redirects output from a parallel port to a serial port.

Syntax:

MODE LPT n = COM m

LPT n
The parallel port (n can be from 1 to 4)

COM m
The serial port (m can be 1 to 4)

Notes:

To set up a system so that it sends parallel-printer output to a serial printer, the MODE command must be used twice: once to configure the serial port and the second time to redirect output to the serial port specified in the first MODE command.

To return to the standard form of output, use MODE to configure the parallel port in the usual way - ie.
MODE LPTn

7. Mode - Typematic rate:

When a character key on the keyboard is pressed, the character is immediately displayed on the monitor. If the key is held down, after a short interval, the character is repeated until the key is released.
Typematic rate has two components: the "rate" at which the character is repeated, and the "delay" which is the interval between pressing a key and the characters repeating.

Syntax:

MODE CON [RATE=r DELAY=d]

r
The rate at which a character is repeated. r can be from 1 to 32 (equivalent to 2 to 30 characters per second) with a default of 21.

d
The delay before characters are repeated. d can be 1 to 4 (equivalent to 0.25 to 1 second respectively) with a default of 2 (0.5 seconds).

Notes:

Both parameters must be included.

Some keyboards do not recognize this command.

8. Mode - Set Device Code Pages:

This aspect of the MODE command is used when working with code pages (or character sets) for printers, keyboards, and monitors. Alternative character sets are typically used when working with any "non US English" language.

Syntax:

To "prepare" a code page for use with a device:
MODE device CP PREPARE=nnn [...] filename

To select a prepared code page for use with a device:
MODE device CP SELECT=nnn

To refresh a prepared code page that has become corrupted or been lost through some hardware error:
MODE device CP REFRESH

To display the numbers of the current character sets prepared and/or selected for device:
MODE device CP

device
The device to which the Code Page refers. Valid names for device are: CON, LPT1, LPT2, LPT3, and PRN.

nnn
The number of the Code Page (character set ).

filename
The file containing the Code Page Information.

Notes:

A Code Page must be "prepared" before it can be selected.

There are Code Pages for character sets in use in just about every country in the world. Many of the more widely used are built into Windows, and others can be added as required.
Examples include:

United States English
437
Multilingual (Latin 1)
850

Canadian French
865
Slavic (Latin 2)
852

Portuguese
860
Nordic
865

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Mode.com
c:\windows\command
7.0
Win95
29 191
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
29 271¹
24/08/96
win95_13.cab

Win98
29 271¹
11/05/98
win98_28.cab

Win98 SE
29 271¹
23/04/99
win98_25.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 28, 2000.

More

The MORE command reads standard input from a pipe or redirected file and displays one screen of information at a time. This command is commonly used to view long files, directory output, etc.

Syntax:

MORE filename

MORE < filename

command | MORE [path][filename]

command
a command whose output is to be displayed.

filename
file(s) to display one screen at a time

Notes:

MORE filename and MORE < filename are essentially synonymous and equivalent to TYPE filename | MORE. In all these cases filename is displayed a screenful at a time. Pressing "Enter" displays the next screen.

When using the pipe (|), the source can be commands such as DIR and SORT as well as TYPE.

The display can be terminated at any time by pressing Ctrl-C.

MORE automatically wraps text to fit the screen

Example:

To view a long file named "clients.new" on your screen, any of the following commands redirects the file through the MORE command to begin displaying the contents of the file:
MORE clients.new
MORE < clients.new
TYPE clients.new | MORE
The MORE command displays the first screen of information and then prompts you with the following message:

data
data
.........
data
--- More ---

Pressing any key will display the next screenful of information.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

More.com
c:\windows\command
7.0
Win95
10 471¹
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
10 471²
24/08/96
win95_13.cab

Win98
10 471²
11/05/98
win98_28.cab

Win98 SE
10 471²
23/04/99
win98_25.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 28, 2000.

Move

Moves files and directories from one location to another on the same or different drives.

Syntax:

MOVE [/Y | /-Y] [path] filename destinationpath

/Y
Suppresses prompting to confirm creation of a directory or overwriting of the destination.
This is the default when MOVE is used in a batch file.

/-Y
Forces a prompt to confirm creation of a directory or overwriting of the destination.
This is the default when MOVE is used from the command line.

Notes:

If only one file is to be moved, it can be renamed at the same time by including the new filename in destinationpath.

If more than one file is listed to be moved, destinationpath must be a directory and the files will retain their original names.

If a file is moved to a destination where there is already a file with the same name, the moved file overwrites the other (no warnings!).

Using the "Y" switch overrides all defaults and the current setting of the COPYCMD environment variable.

Exit Codes:

0
Successful completion of move.

1
Errors in moving one or more files.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Move.exe
c:\windows\command
7.0
Win95
27 235¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
27 235¹
24/08/96
win95_14.cab

Win98
27 299²
11/05/98
win98_41.cab

Win98 SE
27 299²
23/04/99
win98_46.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 28, 2000.

MSCDEX

Provides access to CD-ROM drives.

Syntax:

MSCDEX [/E/K/S/V] [/D:driver ... ] [/L:letter] [/M:buffers]

/E
Forces the CD-ROM driver to use expanded memory, if available, to store sector buffers.

/K
Forces Dos to recognize CD-ROM discs encoded in Kanji.

/S
Enables sharing of CD-ROM drives on networks

/V
Forces memory statistics to be displayed on start-up

/D:driver
The driver signature of the CD-ROM device driver (assigned when the device is loaded in config.sys).

/L:letter
The drive letter to assign to the first CD-ROM drive. If there is more than one drive, the additional drives are assigned subsequent available drive letters.

M:buffers
The number of sector buffers.

Notes:

The device driver for the CD-ROM drive must be loaded in Config.sys via a DEVICE or DEVICEHIGH command which must include a /D:driver parameter. This parameter assigns a driver name (or 'signature") to the CD-ROM device driver. The driver name is usually something along the lines of MSCD000. Each CD-ROM device driver being used must have a unique driver name.
The device driver is specific to the drive and typically is supplied by the CD-ROM manufacturer on a floppy.

The MSCDEX command must include a /D:driver parameter that matches the corresponding /D:driver parameter on the CD-ROM device driver's command line. MSCDEX uses the /D:driver to identify the correct CD-ROM device driver.

MSCDEX can be run from autoexec.bat or at the command prompt but should not be used after Windows has started. If using SmartDrive, this should be loaded after MSCDEX. SmartDrive can significantly speed up the CD-ROM drive by read-caching it. By default, when SmartDrive loads, it checks for the presence of MSCDEX; if it is found, CD-ROM caching is enabled.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Mscdex.exe
c:\windows\command
7.0
Win95
25 473¹
11/07/95
win95_04.cab

7.1
Win95 (OSR2.x)
25 473¹
24/08/96
win95_06.cab

Win98
25 473¹
11/05/98
Base5.cab

Win98 SE
25 473¹
23/04/99
Base5.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 28, 2000.

NLSFunc

NLSFUNC loads country-specific information for national language support (NLS). NLSFUNC can be used either from the command line or within "config.sys" to support character set (code page) switching.

Syntax:

NLSFUNC [filename]

filename
The file containing country-specific information.

Note:

The default value for filename is defined by the COUNTRY command in config.sys. If no COUNTRY command exists in config.sys, NLSFUNC looks for "country.sys" in the root directory of the startup drive. NLSFUNC does not access "country.sys" until information is actually required from it and, if "country.sys" is not available when NLSFUNC is installed, there will be no error message. However, there will be an error message if you subsequently run a CHCP command.

Examples:

To use the default country-specific information found in "country.sys":
NLSFUNC

If you should have a file called "newcdpg.sys" that contains country-specific information and you want to use that information rather than the default:

NSLFUNC newcdpg.sys

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Nlsfunc.exe
c:\windows\command
7.0
Win95
6 940¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
6 940²
24/08/96
win95_14.cab

Win98
6 940²
11/05/98
win98_41.cab

Win98 SE
6 940²
23/04/99
win98_46.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 29, 2000.

Numlock

Used to set the "Num Lock" key on or off on startup.

The NUMLOCK command can only be invoked from Config.sys.

Syntax:

To ensure the "Num Lock" key is on when the computer starts:
NUMLOCK=on

To ensure the "Num Lock" key is off (the default) when the computer starts:
NUMLOCK=off

Notes:

One of those harmless, almost trivial, options that has caused tremendous irritation ever since the introduction of the first keyboards with the built in numeric keypads. Some machines came with the numeric keys active by default, others with the cursor keys active. MS tried to help by enabling the NUMLOCK command so that the users preference could be set in Config.sys but, as I recall, different versions of DOS have had different defaults - so there you go.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Path

The PATH command is used to view or modify the Path environmental variable and is synonymous with "SET PATH=".

When an executable file is named on the command line (or in a batch file) without an explicit path, Dos will always first search for this file in the current directory on the current drive. If the file is not found there, Dos will then search any paths listed in the Path environmental variable.

Syntax:

To set a path:
PATH path1[;path2...]]
or
PATH=path1[;path2...]]

To add directories to an existing Path environmental variable:
PATH %path%; path3[;path4...]]

To clear all path settings:
PATH ;

To display the current path settings:
PATH

pathx
The full path to be included.
To include a directory name that includes a space, enclose either the whole path or just the directory in inverted commas (see Examples below).
a trailing backslash is optional: both path forms are recognised as valid

Notes:

When Dos searches for a file, after first looking in the current directory, it looks through the directories in the PATH environmental variable in the order they are listed.

If executable files in the same directory have the same name but different extensions, and the name is entered without an extension, Dos will run a ".com" program before an ".exe" and an ".exe" program before a ".bat" file.

When a number of paths are listed, they must be separated by semicolons - but no spaces. If a space is included, a "Too many parameters" error message is displayed.

If the Path environmental variable has been defined, a second instance of the PATH statement overwrites the first. To add a directory to the Path it is necessary to include all paths originally defined along with the new one. The simplest way to do this is to define the new path as "the contents of the Path environmental variable" (%path%) along with the new entries. There is no such shortcut to remove a directory from the path.

Invalid paths can be specified without causing errors. Thus a PATH statement can include reference to removable media or network drives. It also means that the only indication of an invalid path caused by a typo or missing semicolon separator (say) is that the program(s) will not be found.

Actually, PATH will accept just about any character without causing an error.

When Windows95/8 loads, the PATH environmental variable is set, by default, to:
C:\WINDOWS;C:\WINDOWS\COMMAND

The maximum length of the PATH environmental variable is limited only by the available space in the environment - but see "Limitations" below.

Examples:

A typical PATH statement in either Config.sys or Autoexec.bat might be:
PATH c:\windows;c:\windows\command
This would enable any executable file in these two directories to be run by simply naming the command/program whatever the current directory might happen to be.

To add the directory c:\downloads to the regular path, enter
PATH %path%;c:\downloads

To add a directory name that contains a space, enclose the name in inverted commas:
PATH %path%;c:\"program files"\dos
or
PATH %path%;"c:\program files\dos"

Limitations

The maximum length of the Dos command line is restricted to 127 characters.
The workaround to this is to use the PATH=%path%;additionalpath etc. as shown above.

The maximum length of any single path is limited to 127 characters.
Although one can construct a longer path, an executable file more than 127 characters from the root directory will not be found either in Dos or Win95. The SUBST statement can be used to make the program visible to Win95, but not Dos.

Further Comments

If a path statement contains more than four or five paths, I have found there is much to be said for building up the path using the Path=%path%;addnpath syntax. This makes it easy to see exactly what is on the path and to remove individual paths if no longer required.
For example, in Autoexec.bat one might have:
....
PATH=%path%;c:\dos\batchfiles
PATH=%path%;c:\windows\twain\scanwiz
PATH=%path%;d:\downloads\utilities
....

In response to a newsgroup query, Peter Dolman suggested the following:

.
To change the path temporarily, and change it back:

Set oldpath=%path%
creates an environmental variable called "oldpath"

Set path = newpath
where newpath is the new path

.......
run application, do whatever here

Set path = %oldpath%
restores the path to its original configuration

Set oldpath =
removes "oldpath" from the environment

.
To add to the path temporarily, and change it back:

Set oldpath=%path%
creates an environmental variable called "oldpath"

Set path = %path%; addpath
where addpath is the additional path(s)

.......
run application, do whatever here

Set path = %oldpath%
restores the path to its original configuration

Set oldpath =
removes "oldpath" from the environment

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Pause

The PAUSE command suspends processing of a batch program and displays a prompt to press any key to continue.

Syntax:

PAUSE

Notes:

PAUSE displays the following message:

Press any key to continue . . .

Typically, PAUSE is used just before some irrevocable operation are about to take place - eg: file deletions, or disk formats. In such a case, PAUSE would often be preceded by an ECHO statement on the lines of:
ECHO All files on C: drive will be erased.
ECHO Press Ctrl-C to stop or
PAUSE
which would display as:

All files on C: drive will be erased.
Press Ctrl-C to stop or
Press any key to continue . . .

Any text following PAUSE is ignored. If ECHO is on, it will be displayed; if ECHO is off it isn't. Thus:
ECHO On
Pause awhile and be sure understand what you are about to do.
will display as:

Pause awhile and be sure understand what you are about to do.
Press any key to continue . . .

The prompt "Press any key to continue . . ." can be supressed by redirecting the output to NUL:
PAUSE > NUL

The point of the PAUSE command is to allow a certain minimum level of interaction with the user. However, as Larry Weiss pointed out in a newsgroup posting¹, it will react to input from a file by redirection:

Given a zero-length file named FLAG, if you execute
PAUSE < FLAG
the command.com session under Windows 98 in an MSDOS-Prompt box will seem to hangup. But, if you open another MSDOS-Prompt and run anything that writes into that FLAG file, then that will trigger the first session's PAUSE command to complete. Seems a very simple way to get some coordination between batch files running in separate MSDOS-Prompt sessions.
I don't have a practical application for this yet, but it seems an interesting trick. - Larry Weiss

Presumably, this effect would also work with other sources of redirected input such as COM1, etc. (?)

References

Ref.#
From
Title
Newsgroup
Date

1
Larry Weiss
interesting use of PAUSE
alt.msdos.batch
01 Jun 2000

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
June 3, 2000

Prompt

Changes the Windows command prompt.

Syntax:

To change the command prompt:

PROMPT [text]

text
Any series of alphanumeric characters including the following special codes:

 $P
 Current drive and path

 $E
 Escape code (ASCII code 27)

 $N
 Current drive

 $G
 >

 $V
 Windows version number

 $L
 <

 $D
 Current date

 $B
 |

 $T
 Current time

 $Q
 =

 $_
 Carriage return and linefeed

 $$
 $

 $H
 Backspace (erases previous character)

To reset the prompt to its default ($N$G):

PROMPT

Notes:

Apart from being a recognised command, PROMPT is also one of the "Standard" environmental variables (see SET). Issuing a PROMPT command is exactly equivalent to issuing a SET command for the environmental variable prompt. ie.

PROMPT $P$G is exactly equivalent to
SET prompt=$P$G

When Win95 loads, it automatically sets the prompt environment variable to $P$G - ie. Current path and ">" - and this is the prompt that most users will consider the default and expect to see:

C:\WINDOWS>_

HOWEVER, Command.com's default is $N$G - ie. Current drive and ">".
This can cause some confusion with the unwary who might enter PROMPT (equivalent to resetting the environmental variable or entering: SET prompt= ) to reset the prompt after experimenting with different styles and wonder why they not only appear to have been returned to the root directory, but that CD seems not to work any more!

The "$E" code is used with ANSI.SYS escape sequences. These can be used to significantly add to the potential for customising the prompt, change the screen colours, or even remap some of the keys (see "Examples" below)

Although there is a limit of 128 characters for command line entries, long and complex prompts can be prepared by breaking the command into parts and assembling the whole using a series of PROMPT commands. Each instance of PROMPT (after the first) would include %prompt% - the environmental variable containing the current prompt string.

If PROMPT is used with Ansi.sys via the $e special character, changing or resetting the prompt will not reset the Ansi.sys part unless done so explicitly. In other words, colour changes and key reassignments stay in effect until explicitly changed or Dos is closed. It is thus possible to use Prompt to reassign many keys using a series of PROMPT statements.

Examples

As a reminder to occasional users of Dos in Win95, the following statement could be included in Autoexec.bat:

PROMPT Use Alt-Enter to switch from full screen to window$_$P$G

which would display as:

Use Alt-Enter to switch from full screen to window
C:\WINDOWS>_

Using the added enhancements available if ANSI.SYS is loaded, the above prompt can be modified so that the message remains at the top of the screen (As this coding is somewhat tortuous, I have prepared a breakdown):
PROMPT $E[s$E[H$E[30;41m$E[K$E[4CAlt-Enter toggles full screen and window$E[15CType "EXIT" to quit $E[37;40m$E[u$P$G
which would display something like:

   Alt-Enter toggles full screen and window
Type "EXIT" to quit   

C:\WINDOWS>_

The same effect could be achieved using a series of PROMPT statements incorporating %prompt%:
PROMPT $E[s$E[H$E[30;41m$E[K$E[4C
PROMPT %prompt%Alt-Enter toggles full screen and window$E[15C
PROMPT %prompt%Type "EXIT" to quit$E[37;40m$E[u$P$G

If Ansi.sys is loaded, most keys can be "remapped". To assign the text "XCOPY c:\data\*.* a: /s/e/m" to Shift-F1:
PROMPT $E[0;84;"XCOPY c:\data\*.* a: /s/e/m"p$P$G
Note the terminating "$P$G" so that the standard prompt is displayed. If this was omitted the key would be reassigned but the prompt would simply be a flashing cursor.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

RD (or RmDir)

Removes (deletes) an empty directory. RD and RmDir are synonymous.

Syntax:

RD [path] directoryname

Notes:

If there is a backslash ( \ ) before the first directory name in path, that directory is considered a subdirectory of the root directory on the current drive.

If there is no backslash before the first directory name in path, the directory is considered a subdirectory of the current directory.

RD will only delete an empty directory. If RD is used on a directory containing files and/or subdirectories, an error message is displayed:

C:\WINDOWS>RD \test
Invalid path, not directory,
or directory not empty

C:\WINDOWS>_

If this message is received and the directory appears empty, it usually means that there are hidden files still there. These can be seen using the DIR /A command and any such files deleted after removing the necessary attributes with the ATTRIB command. Alternatively the DELTREE command will remove the directory along with all files and subdirectories contained therein.

RD will not delete the current directory on the current drive. However, it will remove the current directory on a different drive.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Rem / ; / ::

Records comments (remarks) in batch files and Config.sys. These are ignored during the execution of the program.

Syntax:

REM [comment]

In Config.sys only:
; [comment]

In batch files (including Autoexec.bat) only:
:: [comment]

Notes:

In Config.sys a semicolon (;) has the same effect as REM. Batch files do not recognise the semicolon and will generally cause an error message about a bad command.

In batch files a double colon (::) has the same effect as REM.
Actually, the double colon creates a label (see GOTO) which has a colon as the first character. Although Command.com recognises this as a label, GOTO doesn't, and so there is no chance of confusing a label and remark.

REM has a major limitation (see below) and, because of this, it is preferable to use the alternatives of a semicolon (;) in Config.sys and double colon (::) in batch files).

Limitations

When parsing a batch file, Command.com does not simply skip any lines beginning with "REM". Instead, it seems to parse the line for recognised commands/files/whatever and then take no action if the line begins with REM. This is not particularly efficient and a large number of REM statements in a batch file can noticeably slow down its execution.

A much more serious problem with REM occurs if the line contains a pipe (|) or redirection (<, >, >>) symbol: everything up to the symbol is ignored BUT the symbol itself and everything following is interpreted as a command line entry - but without the safeguard of syntax checking. This can lead to all sorts of problems - especially when REM is used to temporarily inactivate lines in a batch file. A simple illustration of this can be given by the following:

In a batch file the line:
Echo. | date
pipes an <Enter> to DATE, causing it to display the date and return to the command prompt.
One would expect that preceeding this command with REM whould cause the command to simply be ignored - but only the "Echo." part is. Command.com tries to process the "| date" part and the system hangs waiting for input from a non-existant preceeding command. The only remedy is to close the Dos window or reboot.

Note that having the line:
|date
causes Command.com to simply respond with the message "Syntax error" and return to the prompt.

The way to avoid such problems is to use the double colon (::) rather than REM.

Incidentally, entering either REM echo. | date or :: echo. | date directly on the command line (rather than in a batch file) not only causes Command.com to hang, but the only way to close the Window is with Ctrl-Alt-Del. Not that it makes much sense to enter such a command in the first place.

Tricks

The REM command is widely used to temporarily disable commands in Config.sys and batch files (but better to use :: or ; - see "Limitations" above).

Example:

To include an explanatory comment in Config.sys before the COUNTRY command:
;set country code to France
COUNTRY=033

or (if you must!):
REM set country code to France
COUNTRY=033

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Ren (or Rename)

Renames a file or directory. Ren and Rename are synonymous.

Syntax

REN "name" "newname"

name
The current name of a file or directory

newname
The new name for the file or directory

Notes:

The REN command is for renaming a file or directory, not moving it.

Renaming a folder will not change its creation date.

If a folder already exists with newname, REN quits and displays an error message:

C:\WINDOWS>REN Test2.txt Test.txt
Duplicate file name or file not found

C:\WINDOWS>_

Either REN or MOVE can be used to rename a single file but there are differences in their behaviour:

MOVE asks for confirmation (by default) before renaming a folder with a name already in use whereas REN simply will not do it.

With REN, the second parameter must be a filename - no path names are acceptable. MOVE will require a path name to be specified if the file is in anything but the current directory.

The inverted commas are only required for name and/or newname if they contain a space. Otherwise REN can handle long file names including periods and any other valid characters without difficulty. The inverted commas are required for file names with spaces because these can render the command line ambiguous.

With or without inverted commas, it is assumed that, if the name includes one or more periods, the characters following the last period are an extension.

If the file being renamed has a long filename, name can be specified using either the long or short (8.3) form.

REN will work with files that have their "read-only" and/or "system" attributes set. It will not work if the "hidden" attribute is set (giving a "File not found" error).

REN will accept wildcards (* and ?) but often not in the way that would be expected - see Renaming Multiple Files.

Examples:

To rename "chapter10.doc" to "part10.doc":
REN chapter10.doc part10.doc

To rename "chapter 10.doc" to "part 10.doc":
REN "chapter 10.doc" "part 10.doc"
The inverted commas are necessary because of the spaces in the names.

To rename "chapter10.doc" (on drive B:) to "part10.doc":
REN b:chapter10.doc part10.doc
Note that "part10.doc" remains on drive B's current path.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Set

The Set command is used to display, set, or remove MS-Dos environment variables.

Syntax:

To set an environment variable:
SET envirovariable=string

To remove an environment variable:
SET envirovariable=

To display all current environment variables:
SET

envirovariable
The environment-variable name.

string
A series of characters to assign to the variable.

Notes:

To use an environmental variable either from the command line or in a batch file, it must be enclosed in % signs as in %envirovariable%.

Environment variables are typically used in three ways:

to assign a path to a variable. Many programs will create such a variable during installation to simplify access to temporary, data, and utility files used by the program. Such programs will automatically modify Autoexec.bat or Config.sys to include a SET line defining the variable.

to modify the defaults of a number of Dos commands by assigning the new defaults to Standard Environment Variables (see below).

as variables in batch files. Unlike the numbered variables %0 to %9, environmental variables are stored until they are reset or the command interpreter terminates (Window closed).

If SET is used to assign string to a variable that already exists, the new value replaces the old.

Environmental variables are stored in memory allocated by Command.com. If there is insufficient environment space for a new variable, and error message is displayed. (To increase the environment space, see COMMAND).

The Standard Environment Variables:

TMP and TEMP

Both used by programs to refer to a directory for temporary files.
Default: TMP=c:\windows\temp; TEMP=c:\windows\temp

PROMPT

Used to specify the starting Dos prompt.
Default: PROMPT=$P$G

WINBOOTDIR

Used to specify the directory containing Win.com - the Dos program that starts installing Win95.
Default: WINBOOTDIR=c:\windows

COMSPEC

Used to reference command.com from anywhere.
Default: COMSPEC=c:\windows\command.com

PATH

Used to specify directories to be included in the search path for executable files.
Default: PATH=c:\windows;c:\windows\command

WINDIR

Used to specify the Windows directory.
Default: WINDIR=c:\windows

COPYCMD

Used to specify whether the COPY, MOVE, and XCOPY commands should prompt for confirmation before overwriting a file.
To force a prompt before overwriting, COPYCMD is set to /-Y.
To force overwriting without prompting, COPYCMD is set to /Y.
Default: Empty
Eg. SET COPYCMD=/Y

DIRCMD

Used to change the default listing format by the DIR command by adding the appropriate switches - see DIR for the list.
Default: Empty
Eg. SET DIRCMD=/A/P

In addition to the above, many programs will set environmental variables without checking to see if the names are free. These variables are almost like trade names. I suspect it would be considered bad form (if not worse) to distribute a program that set a variable called "Blaster".

Variable Name
Company

Blaster
Creative Labs Soundblaster

More to be added!

Examples:

To establish an environment variable named INCLUDE so that the string "c:\inc" (the "inc" directory on drive c:) is associated with it:
SET include=c:\inc

Once this command has been issued, the string "c:\inc" can be referenced at any time by using the term %include%.

Now, if several batch files are written to process files in the "c:\inc" directory, each reference to "c:\inc" can be made via the variable %include%.

Should the "inc" directory be moved or renamed, the batch files need not be altered: the INCLUDE variable would simply be reassigned to the new directory.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

SetVer

Reports a Dos version number to programs that were designed for earlier versions of MS-Dos and do not work with the current version.

Syntax:

To display the current version table:
SETVER

To add an entry:
SETVER progname n.nn

To delete an entry:
SETVER progname /D [/Q]

progname
The filename of the program

n.nn
The Dos version to be reported to the program.

/D
Deletes the version-table entry for the specified program.

/Q
Hides the message typically displayed during deletion of version-table entry.

Notes:

Many programs designed to run with a previous version of Dos will run without any problems under MS-Dos 7. In some cases, however, a program will check the system Dos version to confirm that it is the one with which it was designed to work. By including such a program, with its Dos version, in the SETVER table, the program interprets Dos 7 as whatever version is appropriate. Considerable effort has been put into designing each version of Dos to be compatible with its predecessors, but if a program is not compatible with Dos7, using SETVER will not solve the problem.

When an addition is made to the version table, the following message is displayed (as long as no errors are detected):

C:\WINDOWS>setver share.exe 4.0

WARNING - The application you are adding to the Windows version table
may not have been verified by Microsoft on this version of Windows.
Please contact your software vendor for information on whether this
application will operate properly under this version of Windows.
If you execute this application by instructing Windows to report a
different MS-DOS version number, you may lose or corrupt data, or
cause system instabilities.  In that circumstance, Microsoft is not
responsible for any loss or damage.

Version table successfully updated.
The version change will take effect the next time you restart your system.

C:\WINDOWS>_

When a program is removed from the version table, the following message is displayed (as long as no errors are detected):

C:\WINDOWS>setver share.exe /d

Version table successfully updated.
The version change will take effect the next time you restart your system.

C:\WINDOWS>_

When Win'95 is installed, the SETVER table includes the following entries:

 Program       Ver.

 Program       Ver.

 Program           Ver.

KERNEL.EXE      5.00
NETX.COM        5.00
NETX.EXE        5.00
NET5.COM        5.00
BNETX.COM       5.00
BNETX.EXE       5.00
EMSNETX.EXE     5.00
EMSNET5.EXE     5.00
XMSNETX.EXE     5.00
XMSNET5.EXE     5.00
DOSOAD.SYS      5.00
REDIR50.EXE     5.00
REDIR5.EXE      5.00
REDIRALL.EXE    5.00
REDIRNP4.EXE    5.00
EDLIN.EXE       5.00
BACKUP.EXE      5.00
ASSIGN.COM      5.00
EXE2BIN.EXE     5.00

JOIN.EXE        5.00
RECOVER.EXE     5.00
GRAFTABL.COM    5.00
LMSETUP.EXE     5.00
STACKER.COM     5.00
NCACHE.EXE      5.00
NCACHE2.EXE     5.00
IBMCACHE.SYS    5.00
XTRADRV.SYS     5.00
2XON.COM        5.00
WINWORD.EXE     4.10
EXCEL.EXE       4.10
LL3.EXE         4.01
REDIR4.EXE      4.00
REDIR40.EXE     4.00
MSREDIR.EXE     4.00
WIN200.BIN      3.40
METRO.EXE       3.31
DISKFIX.EXE     1.00

10NET.COM       6.20
DBLSPACE.EXE    6.20
APPEND.EXE      6.20/7.10*
BASIC.COM       6.20/7.10*
BASICA.COM      6.20/7.10*
DISKCOMP.EXE    6.20/7.10*
EXTDISK.SYS     6.20/7.10*
GRAPHICS.COM    6.20/7.10*
FASTOPEN.EXE    6.20/7.10*
MODE_DOS.COM    6.20/7.10*
PRINT.EXE       6.20/7.10*
REPLACE.EXE     6.20/7.10*
RESTORE.EXE     6.20/7.10*
SCPLUS.EXE      6.20/7.10*
SCSIC710.SYS    6.20/7.10*
TREE.COM        6.20/7.10*
VDISK.SYS       6.20/7.10*

* Where two values are given, the first refers to the version assigned in W95 Upgrade version, and the second in Win95B OSR2.5. Exactly why it is necessary to report the current Dos version is beyond me.

Exit Codes:

0
The SETVER command was completed without errors.

1
An invalid command switch was specified.

2
An invalid filename was specified.

3
Insufficient system memory to carry out the command.

4
An invalid version-number format was specified.

5
The specified entry in the version table was not found.

6
SETVER could not find "setver.exe" .

7
An invalid drive was specified.

8
There were too many command line parameters.

9
SETVER detected missing command line parameters

10
Error detected while reading "setver.exe".

11
"Setver.exe" is corrupt.

12
The specified "setver.exe" does not support a version table.

13
Insufficient space in the version table for a new entry.

14
Error detected while writing to "setver.exe".

File Details:

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Setver.exe
c:\windows
7.0
Win95
18 939¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
18 939²
24/08/96
win95_14.cab

Win98
18 939*
11/05/98
win98_42.cab

Win98 SE
18 939³
23/04/99
win98_46.cab

Superscripts denote which same size files, if any, are identical (using FC). * not compared.

Further Reference

SETVER.EXE - Help
- Jason Berkan (1998)
An alternative guide to using Setver.exe. Covers much the same ground but in a different way. Also deals with various error messages, and points out how to determine which version Dos needs to be specified for an orphan Dos command.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Share

Installs file-sharing and locking capabilities on your hard disk.

Syntax:

SHARE [/F:space] [/L:locks]

/F:space
Allocates file space (in bytes) for file-sharing information.

/L:locks
Sets the number of files that can be locked at one time.

Notes

Share.exe was a memory resident utility that prevented a file from being modified by two programs (or two instances of the same program) simultaneously. Windows95 includes an alternative system to handle this situation and so Share.exe is no longer required. Furthermore, MS found it impracticable to rewrite Share.exe to work with FAT32 systems and so it has been dropped from Win95-OSR2 onwards (see MS KnowledgeBase Q161619).

This has led to some difficulties for people moving to new Win95/8 platforms with older Dos applications that require Share.exe to load and/or run.

First of all, when running in a Dos Window, no(?) program needs Share.exe - even if it says it does - because Windows can handle all the file sharing problems that Share.exe ever did.

Some programs will simply check to see that the line Share.exe is in Autoexec.bat and some others will look for the file in the root directory.

For these programs, the workaround is to create a dummy Share.exe by opening Notepad (or any other text editor) and saving the empty file as "Share.exe" in the C:\ directory. Note: use Save As *.*(all files) to prevent the .txt extension being added, which would rather spoil the point of the exercise. Autoexec.bat can be modified to include the line "Share". When run with the dummy Share.exe, autoexec will declare there to be an "Error in EXE file" and then move on.

Some programs might actually check to see if Share is installed. To satisfy these programs, it might be possible to copy and rename some small innocuous TSR to substitute for Share.

It would appear that running these programs outside Windows using Dos7 (ie. from a Boot-to-Dos prompt), is a non-starter because the Windows sharing facilities are not available. Note that, according to the above KnowledgeBase article (Q161619), trying to use SetVer will not work (even if working in FAT16).

If the program really needs Share.exe the only solutions I can see are:

to set up a FAT16 partition, install Dos6x (or whatever) and take it from there. Oh, I guess you would also need a boot manager to move between Dos to Win95;

use a second machine for the application;

upgrade the application.

Please note: I do not actually have any applications that use Share.exe and so have not been able to verify/test the above ideas. I'm just passing them along!

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Share.exe
c:\windows\command
7.0
Win95
10 304
11/07/95
win95_09.cab

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Shell

Specifies the command interpreter you want MS-DOS to use.

The SHELL command can only be invoked from Config.sys.

Syntax:

SHELL=filename [path] [parameters]

filename
The full filename and path of the command interpreter to be used

path
The path to the command interpreter. This is required so that the command interpreter can find itself when any transient parts of the program need to be reloaded at any time. The default value of path is the root directory of the startup drive (usually c:)

parameters
Any command-line parameters or switches that can be used with the specified command interpreter.

Notes:

There are three typical reasons for using the SHELL statement:

The command interpreter is not Command.com. Although not encouraged, it is possible to specify a command interpreter from another source (eg. DRDOS, or PCDOS).

Command.com is not in the root directory of the start-up drive. When a disk is formatted as a system disk using FORMAT /S or with the SYS command, a copy of Command.com is put in the root directory. If it is moved for any reason, a SHELL statement is required so that the correct version of Command.com can be located and used.

Command.com is required with one or more of its optional switches. Although the default settings of Command.com suit most situations, some aspects can be modified and, if required at startup, must be introduced within a SHELL statement.

When Command.com is invoked with a SHELL statement, it should be used with the /P switch to make it permanent.

Examples:

If Command.com is in the root directory and is to be loaded with its default values, the following line is optional:
SHELL=c:\command.com c:\ /P

If Command.com is in the c:\windows\command directory, and it is to used with a non-default environment size, then the following line must be included in Config.sys:
SHELL=c:\windows\command\command.com c:\windows\command\ /e:1024 /P

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Shift

Changes the position of replaceable parameters in a batch program.

Syntax:

SHIFT

Notes:

The SHIFT command changes the values of the replaceable batch parameters %0 - %9 by copying each parameter into the previous one. In other words, the value of %1 is copied to %0, the value of %2 is copied to %1, and so on. This is useful for writing a batch file that performs the same operation on any number of parameters.

You can also use the SHIFT command to create a batch file that can accept more than 10 parameters. If you specify more than 10 parameters on the command line, those that appear after the tenth (%9) will be shifted one at a time into %9.

There is no backward SHIFT command. Once you carry out the SHIFT command, you cannot recover the first parameter (%0) that existed before the shift.

Example:

The following batch file, MYCOPY.BAT, shows how to use the SHIFT command with any number of parameters. It copies a list of files to a specific directory. The parameters are the directory name followed by any number of filenames.

@echo off
SET todir=%1
:getfile
SHIFT
IF "%1"=="" GOTO end
COPY %1 %todir%
GOTO getfile
:end
SET todir=
ECHO All done

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Sort

The SORT command is used to read ASCII text input and to sort the lines in alphanumeric order.

Syntax:

To sort a text file:
SORT [/R] [/+n] filename
or
SORT [/R] [/+n] < filename

To sort the output of a Dos command:
command | SORT [/R] [/+n]

To sort keyboard input:
SORT [/R] [/+n] [> outputfile]
keyboard input first line
....
keyboard input last line
^Z

/R
Reverses the sort order; that is, sorts Z to A, then 9 to 0.

/+n
Sorts the file according to characters in column n.

Notes:

The input to SORT should be ASCII text structured so that each line can be considered a record of data. The lines (records) may be broken into fields, each beginning a fixed number of characters from the start of the line (eg. the output from a DIR command). Input in any other form tends to produce nonsense after being sorted (eg the output from a "readme.txt" file).

SORT can handle files up to 64K and is not case sensitive

The output from SORT is, by default, sent to the "Standard Output Device" (usually the screen), but can be redirected to any other device or a file using the redirection symbol (>).

The SORT program uses the collating-sequence table corresponding to the country code and code-page settings. Characters greater than ASCII code 127 are sorted based on information in the COUNTRY.SYS file or in an alternate file specified by the COUNTRY command in your CONFIG.SYS file.

The Dos 7 version of SORT does appear to have a bit of a problem when handling very long lines. When sorting such lines, under certain conditions, some lines break up. An example of this anomalous behaviour has been posted in a newsgroup in which one line of three split when sorted on the 14th character. There were no problems when the sort was based on the first, 16th or 48th characters. Apparently the maximum "safe" line length is 510 characters/columns.

Examples:

To search a file named MailingList.txt for the text "Jones", and then sort the results of the search, use the pipe ( | ) to direct the output of a FIND command to the SORT command:
FIND /I "Jones" MailingList.txt | SORT

If there are too many entries to fit on a screen, add the MORE command:
FIND /I "Jones" MailingList.txt | SORT | MORE

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Sort.exe
c:\windows\command
7.0
Win95
25 802
11/07/95
win95_03.cab

7.1
Win95 (OSR2.x)
25 882¹
24/08/96
win95_03.cab

Win98
25 882¹
11/05/98
win98_42.cab

Win98 SE
25 882¹
23/04/99
win98_46.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 29, 2000.

Stacks/StacksHigh

Sets up areas in memory called "Interrupt Stacks" to store interrupts from hardware to prevent MS-Dos being overwhelmed by multiple devices simultaneously demanding processor action.

The STACKS and STACKSHIGH commands can only be invoked from Config.sys.

Syntax:

To load the interrupt stacks in conventional memory:
STACKS=n,s

To load the interrupt stacks in upper memory:
STACKSHIGH=n,s

n
The number of stacks. n can be from 8 to 64 or 0. The default is 9.

s
The size (in bytes) of each stack. s can be 32 to 512 or 0 (if n is 0). The default is 256.

Notes:

On receiving a hardware interrupt, MS-Dos stores the information in one of the interrupt stacks (if available) until it can be processed by the CPU. Many programs include their own stack areas and do not require those provided in the STACKS command. Often STACKS can be set at 0,0 (saving some memory) without problems. However, if a machine becomes unstable with STACKS=0,0 then the default values should be used.

If STACKS are not set at 0,0 and either "Stack Overflow" or "Exception Error 12" error message is displayed, the number and/or size of the stacks should be increased.

If DOS is used to manage the upper memory blocks (it usually is), the default values for STACKS are automatically loaded into the HMA. ie. the line
STACKSHIGH=9,256
is invoked without needing to be explicitly stated.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Start

Starts a program written for Windows or Dos in a new window.

Syntax:

To run a program:
START [/Switches] programname

To open a data file (in the program associated with its extension):
START [/Switches] document.ext

/M
The specified program is opened in a minimized window.

/MAX
The specified program is opened in a full screen window.

/R
The specified program is opened in its default sized window. [default]

/W
Control does not pass back to the window from which START was invoked until the new window is closed.

Notes:

There is some overlap in the function of START, CALL, and Command /c in that all commands are typically used in batch files to invoke secondary batch files or programs.

A program invoked with START opens under a new, temporary instance of the command interpreter (Command.com) in a new window. This window remains open until closed by the user.

START will run executable programs with .exe, .com, and .bat extensions but not Dos internal commands. In addition, if the parameter following START is a data file that Win95 has associated with a particular program, that program will be run and the data file loaded. (Analogous to double-clicking on a file in Windows Explorer).

START will only accept one parameter (batch file, program, or data file). Any additional parameters entered are assumed to be associated with programname or document.ext and handled accordingly.

If long file names contain spaces, they must be enclosed in inverted commas [""]. Otherwise, the parameter is considered "multiple" - see above.

An observation rather than a note, perhaps: unlike every other command, START/? will not be redirected to a file! The file will be created, but output goes to the screen, not the file (which remains empty).

Exit Codes:

0
The command was executed without errors

255
An error occurred.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Start.exe
c:\windows\command
7.0
Win95
9 216¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
9 216²
24/08/96
win95_14.cab

Win98
28 672³
11/05/98
win95_42.cab

Win98 SE
28 672⁴
23/04/99
win98_46.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 29, 2000.

Subst

The SUBST command designates a virtual drive to represent a path. The drive so assigned and the path represented can be used synonymously.

Syntax:

To assign a virtual drive name to a path:
SUBST drive: path

To cancel a virtual drive designation:
SUBST drive: /D

To display a list of current virtual drives:
SUBST

drive:
The virtual drive to be created/released.

path
The physical path to be assigned to the virtual drive.

Notes:

The SUBST command is typically used in three circumstances:

To simplify referencing commonly used paths. Perhaps all data kept in the c:\program files\myfiles directory would be assigned to M:.

To simplify (and shorten) PATH statements. If several paths to be included in the search path have parts of their structure in common, it can make things simpler if the common part is assigned a substitute drive letter.

Some programs insist on running from a particular drive, even when that drive is not available or inconvenient to use. The path to be actually used can be assigned to the letter of the drive required.

When assigning a path to a drive, the drive letter must be available. If it isn't, an error message is displayed stating that the specified drive is "an invalid parameter".
Reasons for a drive letter not being available include:

The drive letter is already in use by a physical drive, other SUBSTed drive, or a hidden host drive of a compressed disk;

LASTDRIVE has been set before the assigned drive letter. In Win 9x systems, the default setting for LASTDRIVE is z: but this can be modified in config.sys to any letter.

A path that has been assigned to a drive letter via SUBST can still be accessed by its real name - ie. the SUBST command provides an alias, not a new name.

The following commands will not work with virtual drives created using SUBST:

ChkDsk
DiskCopy
Fdisk
Format
Label
Sys

The TRUENAME command can be used to display the real path of a drive that has been reassigned using the SUBST command.

Windows Explorer will show both the virtual drive and the actual path in its file listings. Interestingly, files from the real path can be copied to files in the virtual drive (and vice versa) without problem. However, the same operation in Dos gives the error message that a file cannot be copied onto itself and no files are copied.

If a SUBST drive is listed in a PATH statement, PATH will sometimes display the SUBST path, and sometimes the true path. The rules appear to be:

If the "root" SUBST drive is added to the path, the SUBST drive is shown by PATH.

If the SUBST drive plus a valid subdirectory is added to the path, the true path is shown by PATH.

If the SUBST drive plus an invalid subdirectory is added to the path, PATH shows the SUBST drive.

From time to time the question of whether SUBST should be used with Win 95/8 has been raised in the Dos related newsgroups. From everything I have seen the concensus is that there was (is?) a problem with Windows for Workgoups 3.11 but that's it. I haven't seen any reference to anyone having any problems working with SUBST in Win 95/8.

However, there is the point that the Win 9x registry will not automatically use the truename for a SUBSTed drive. If it were decided to SUBST the drive "P:" for "c:\windows\program files", programs could be installed to drive "P:" and everything would work just fine. But, if, at some time in the future, it was decided to reassign drive P: to, say, "d:\data\pictures", there would be some confusion in the registry - to say the least.

For myself, I have found SUBST to be a very useful way of organising hard drives - it is much more flexible than partitioning (even with tools like Partition Magic). The major inconvenience is that the drive takes the volume name of the host. You can change it in Windows Explorer but that eventually filters back and changes the name of the host - I keep hoping that someone will write a little utility so that SUBSTed drives can somehow be given unique names!

Example:

To create a virtual drive called Z for the path "c:\data\docs\manuals\Dos":
SUBST z: c:\data\docs\manuals\Dos

Now, instead of typing the full path, the files in this directory can be reached simply by prefixing with "z:". A directory listing can be had with DIR z:, and to change the current directory one simply enters "z:" as though moving to a different drive.

Exit Codes:

0
The command was executed without errors

1
An initialization error occurred.
Such an error would generally caused by insufficient memory or disk space, or invalid drive name or syntax).

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Subst.exe
c:\windows\command
7.0
Win95
17 904¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
17 904²
24/08/96
win95_14.cab

Win98
17 904²
11/05/98
win98_42.cab

Win98 SE
17 904²
23/04/99
win98_46.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 29, 2000.

Switches

Specifies a number of special options for starting and running MS-Dos.
The SWITCHES command can only be invoked from Config.sys.

Syntax:

SWITCHES= /F /K /N /E[:n]

/F
Skips the two-second delay after displaying the "Starting MS-DOS . . ." message during startup.

/K
Forces an enhanced keyboard to behave like a conventional keyboard. If Ansi.sys is installed, its K switch should also be used.

/N
Disables the F5 and F8 keys used to bypass commands in Config.sys and Autoexec.bat. It does not disable the Ctrl-F5 and Ctrl-F8 keys which bypass loading Drvspace.bin; to disable these keys, see DRVSPACE.

/E
Suppresses the automatic relocation of EBIOS from conventional to upper memory during the startup process by Io.sys.

/E:n
Forces Io.sys to relocate n bytes of EBIOS to conventional memory during the startup process. n can be from 48 to 1024 and is rounded up to the next multiple of 16.

Notes:

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Sys

Copies MS-Dos system files and "command.com" to a disk, thus making it bootable.

Syntax:

SYS [path] drive:

path
The location of the system files

drive:
The drive containing the disk the files are to be copied to

Notes:

The files copied by the SYS command are:

File
Size (bytes)

Win95 Upgrade
Win95 OSR2.5

io.sys
223,148
214,836

drvspace.bin
71,287
65,271

command.com
92,870
93,812

msdos.sys*
6
6

(Total)
387,311
373,925

* msdos.sys is created as the SYS (or FORMAT/S) command is executed.

The SYS command does not work with virtual drives that have been created using SUBST and does not work with network drives.

Exit Codes:

0
The command was executed without errors

1
An initialization error occurred.
Such an error would generally be caused by insufficient memory or disk space, or invalid drive name or syntax).

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Sys.com
c:\windows\command
7.0
Win95
13 239¹
11/07/95
win95_02.cab

7.1
Win95 (OSR2.x)
13 239¹
24/08/96
win95_02.cab

Win98
18 967²
11/05/98
win98_28.cab

Win98 SE
18 967²
23/04/99
win98_25.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 29, 2000.

Time

Displays or sets the system time.

Syntax:

To display the current system time and prompt for a new one (default is the time displayed)

TIME

To set the system time without a prompt:

TIME hh:mm:ss [A|P]

hh
Hours: valid values: 0-23

mm
Minutes: valid values: 0-59

ss
Seconds: valid values: 0-59

A|P
A.M or P.M. (for 12 hour format).
If a valid 12 hour format is entered but without an A or P, A is assumed.

Notes:

The TIME format can be changed using the International Settings in Windows95.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Truename

Displays the actual path corresponding to virtual drives created using the SUBST command.

Syntax:

To display the full path (in short file name form) of a drive created with SUBST:
TRUENAME path

To display the full path (in short file name form) of the current directory of the current drive:
TRUENAME

To display a file and/or path (in short file name form) assigned to an environmental variable using SET:
TRUENAME %envirovariable%

Notes:

TRUENAME displays the real path corresponding to virtual drives created using the SUBST command in short file name form.

TRUENAME also works with ASSIGN and JOIN in earlier versions of Dos, but does not work with environment variables (assigned with the SET command).

If filename is specified, TRUENAME returns the full "real" path of filename; if only path is specified, TRUENAME returns the real name of the path.

If either path or filename is invalid, TRUENAME returns what the the real path would be if the path/filename did exist.

This command is undocumented and first publicised (as far as I know) in a letter from W. Dnes in PC Magazine (Oct.16, 1990, p491)

Example:

If "c:\data\docs\manuals\Dos" has been assigned to drive Z: using the SUBST command, then
TRUENAME Z:
would display:

C:\WINDOWS>TRUENAME Z:

C:\DATA\DOCS\MANUALS\DOS

C:\WINDOWS>_

and, whether "copy.com" exists on "z:" or not:
TRUENAME Z:\copy.com
would display:

C:\WINDOWS>TRUENAME Z:\copy.com

C:\DATA\DOCS\MANUALS\DOS\COPY.COM

C:\WINDOWS>_

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
October 15, 2000.

Type

The TYPE command is used to display the contents of an ASCII text file on screen.

Syntax:

TYPE filename

Notes:

To display text files one screen at a time, pipe the output from a TYPE command to MORE.

To modify a text file, search for a particular word, or move from one page to another and back, use Notepad in Windows95 or EDIT in Dos.

TYPE is primarily used:

to display formatted text on the screen during the running of a batch file. This could be a menu leading up to a CHOICE command, or a warning/advice before proceeding with some operation. Although slightly slower to display than using ECHO, it is much easier to edit a text file than a series of ECHO statements.

to feed the contents of a text file into a command using redirection.

Examples:

To display the contents of HOLIDAY.MAR:
TYPE holiday.mar

If the file is too long to fit on a single screen:
TYPE holiday.mar | MORE

To pipe the contents of GO.TXT to a DEL command requiring confirmation before deleting all files in a directory.
TYPE go.text | DEL *.*
If the first two characters of GO.TXT contain a "Y" or "y" followed by an [Enter], the files will be deleted. Anything else and the operation will be skipped.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Ver

Displays the MS-Dos version.

Syntax:

VER [/r]

r
Includes the revision letter, and a note of where Dos is located

Notes:

VER displays the following :

C:\WINDOWS>VER

Windows 95. [Version 4.00.950]

C:\WINDOWS>_

VER /r displays

C:\WINDOWS>VER /r

Windows 95. [Version 4.00.950]
Revision A
DOS is in HMA

C:\WINDOWS>_

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Verify

VERIFY is used to ensure that data written to disk is readable.

Syntax:

To turn VERIFY on or off:
VERIFY [ON | OFF]

To display the current VERIFY status:
VERIFY

Notes:

VERIFY is used to ensure that data written to disk by a Dos operation is in a valid form and readable - it does NOT compare the data written to disk with the original (for which you would use the FC command). The most obvious situations when VERIFY would be of use are:

if a disk drive is proving unreliable;

bad sectors are creeping onto a hard disk;

when using nonstandard formatting of floppies.

When VERIFY is on, all disk writing operations are significantly slowed down as data is written and then read-back.

All Dos commands involving disk writing operations (such as COPY, XCOPY) etc. have /V switches that effectively turn VERIFY on while that particular command is running.

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Vol

Displays a disk's volume label and serial number.

Syntax:

VOL [drive:]

Notes:

For hard disks and ZIP drives, VOL displays both volume label and serial number.
For floppy disks and CD-ROMs, VOL displays the volume label only.

The volume label and serial number pertain to the disk, not the drive. Of course, with hard disks this amounts to pretty much the same thing.

The volume label can be changed using the LABEL command.

Examples:

To display the volume name and number of the e:

C:\WINDOWS>VOL E:

Volume in drive E is GRAPHICS
Volume Serial Number is 2F16-19D2

C:\WINDOWS>_

If there is no volume label, VOL displays:

C:\WINDOWS>VOL A:

 Volume in drive A has no label

C:\WINDOWS>_

File Details:

Internal

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

XCopy

Copies files and directory trees. XCOPY is similar to the COPY command except that it has many more switches that allow considerable control over exactly what is copied when using wildcards..

Syntax:

XCOPY source [destination] [/Switches]

Switches:

source
The file(s) to be copied. Although this must be a single parameter, it may include multiple files specified using wildcards (* or ?).

destination
The location and/or name(s) of new files.
If destination is omitted, the files are copied to the current directory.
If destination refers to a directory that does not exist, the directory is created.
If destination is not an existing directory and could be a file or directory (ie. does not end with a backslash (\)), you are prompted to specify whether destination is a file or directory.

Scope:
By default, XCOPY will confine its operation to files in the source directory.

/E
Copies the complete subdirectory structure of source and all files therein.

/S
Copies the complete subdirectory structure of source and all files therein but does not copy empty subdirectories.

/T
Copies the subdirectory structure of source but does not copy any files and does not copy empty subdirectories. To include empty subdirectories, use with the /E switch.

Filters and Attributes:
By default: XCOPY will not copy files which have 'system' or 'hidden' attributes set;
copies of 'read-only' files do not have the read-only attribute set, and
all copied files have their 'archive' attribute set. .

/A
Only copies files with the archive attribute set (ie. files that have not been "archived" using xcopy, msbackup, etc.).

/M
Only copies files with the archive attribute set, turning off the archive attribute of the source files.

/H
Includes files with hidden and system attributes set.

/K
Copies files without resetting the read-only attribute, if set.

/R
Overwrites read-only files.

/U
Only copies files in source that already exist in destination. Can be used with /D to update files with more recent versions. This switch has a bit of a bug - see Note 5 below.

/D:date
Only copies files with a 'last modified date' the same as, or later than, date.
If date is not specified, all files are copied except for same-named files in the destination directory that have a more recent 'last modified date' than the one in source.
Note that dates after 2000 must include the full year (01 is read as 1901, not 2001).
The format for date depends on the COUNTRY setting being used. (For US it is mm/dd/yy(yy))

Prompts
By default, XCOPY prompts before overwriting files in destination with files in source of the same name (note: this default can be modified using the COPYCMD environment variable - see SET). XCOPY also prompts for instructions if there is ambiguity whether destination is a directory or file. An ambiguity is seen when destination does not refer to an existing directory or end in a " \ ". Note that a destination of 'name.ext' could be either a file or a directory.

/I
Forces destination to be treated as a directory. The file/directory prompt is suppressed.

/Y
Overwrites existing files without prompting.

/-Y
Prompts before overwriting existing files.(This is the natural default, and overwrites any changes via the COPYCMD environmental variable

/W
Displays a prompt before starting to copy files.

/P
Prompts for confirmation before creating each destination file.

/F
The /F switch is specified as "Displays full source and destination file names while copying" but actually does nothing.

/Q
Does not display file names or any other messages while copying.

/C
Continues copying even if errors occur.

Miscellaneous

/L
Displays files to be copied but does not actually copy them.

/N
Copy using the generated short names. This is necessary when copying from a VFAT volume to a FAT volume.

/V
Verifies that new files are readable (does not compare with the original - see VERIFY).

Notes:

The /S and /E switches extend the utility of other switches to cover the files in the subdirectories of the source directory.

XCOPY will not copy a folder's attributes (eg. 'hidden'). These have to be set as required using Windows Explorer or ATTRIB.

The /C (don't stop for errors) switch can be useful when backing up a hard drive that includes the Windows swap file. XCOPY will not copy this file but, without the switch, displays an error message and abandons the copying process. If the switch is included, the swap file is still not copied (it would be of no use in a backup anyway) but the rest of the drive can be copied successfully (but see Caveat below).

Unfortunately, the /U switch (to only copy files that already exist in the destination directory) has a rather annoying bug in that, when used with the /S switch (to include all subdirectories), the whole subdirectory tree is copied even if no files are found to copy. If trying to update files on a floppy with files scattered over the C: drive, the directory structure could well fill the floppy before actually getting to the files to be copied.

In the transition from Dos 6.x to Dos 7.x, XCOPY has been significantly enhanced. For reasons I do not understand, in Win 95 (all versions) the new program was not simply named "xcopy.exe" but "xcopy32.exe" and xcopy.exe became simply a pointer to xcopy32.exe. Xcopy32.exe could be invoked directly and would run just fine on its own.

In spite of MS urging to NOT use the XCOPY32 command (rather than sticking with XCOPY) there have been persistant - totally inaccurate - reports in the newsgroups to the effect that using XCOPY32 will work with long filenames when working in a boot-to-Dos environment.

Perhaps in an effort to forestall this apparently harmless practice, in Win98 MS renamed the main file "xcopy32.mod" which is called automatically by both XCOPY and XCOPY32.

In Win98, xcopy.exe and xcopy32.exe are identical and both simply point to xcopy32.mod. Actually, although I certainly don't advocate the practice, it seems that everything works just fine if xcopy.exe and xcopy32.exe are deleted and xcopy32.mod is renamed as xcopy.exe.

If anyone understands the background/reasons for this name dancing, I would be most appreciative of their advice!

Exit Codes:

0
All files were copied without errors

1
No files were found to copy

2
XCOPY was terminated by Ctrl-C before copying was complete

4
An initialization error occurred.
Such an error would generally caused by insufficient memory or disk space, or invalid drive name or syntax).

5
A disk-write error occurred.

Caveat

Whilst XCOPY is usually perfectly sufficient for copying the contents of one disk to another and making backups, it cannot be considered 100% reliable. The problem arises because the relationship between long and short filenames is not necessarily the same in both original and copy and this can cause problems if a program calls a file by its short name.

Although this sounds like a serious flaw in the whole long/short filename concept and it is not difficult to demonstrate the potential diffuculties, the fact is that in real life it is seldom that all the conditions for trouble are met simultaneously. To be specific, these conditions are:

A program or file must be called with its short filename and/or the path must include a short name.

There must be at least two versions of the short name.

At some time, one version of the short name (but not the latest) on the source must have been deleted.

This problem is discussed in some detail (and with evangelical zeal) at PCGuide - Articles - Xcopy Xposed by Charles M. Kozierok and How do I clone/backup a hard disk under Windows? by John Navas.

Examples

To copy all files and subdirectories from the data directory to the disk in drive a:
xcopy c:\data a: /s
or
xcopy c:\data\*.* a: /s

To copy all files and subdirectories from the data directory created/modified since 1st Jan.1997 to the disk in drive a: should be:
xcopy c:\data a: /s /d:1/1/97

To update any files, including those in subdirectories, on the disk in drive a: from everywhere in the data directory on c: should be:
xcopy c: a: /s /u /d
but will copy all subdirectories of c: to a: - in many cases not leaving much room for files!

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Xcopy.exe
c:\windows\command
7.0
Win95
3 878¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
3 878²
24/08/96
win95_14.cab

Win98
3 878³
11/05/98
win98_43.cab

Win98 SE
3 878³
23/04/99
win98_47.cab

Xcopy32.exe
c:\windows\command
7.0
Win95
40 960
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
41 472⁴
24/08/96
win95_14.cab

Win98
3 878³
11/05/98
win98_43.cab

Win98 SE
3 878³
23/04/99
win98_47.cab

Xcopy32.mod
c:\windows\command
7.1
Win98
41 472⁵
11/05/98
win98_45.cab

Win98 SE
41 472⁶
23/04/99
win98_51.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 29, 2000.

Doskey

DosKey is a TSR designed to assist working from the command line by making it easier to edit the command line, by remembering previous commands, and being able to record macros.

Syntax:

To load Doskey:
DOSKEY [/Switches]

/B:xxx
Sets the size of the buffer for macros and commands. The minimum value of xxx is 256 and the default is 512 (bytes). If DOSKEY is already running, it must be reloaded (with /R) when changing the buffer size.

/E:On|Off
Enables|Disables the display of commands when a macro plays. E(cho) is On by default.

/F:filename
Retrieves filename - a text file containing a list of macros in the form Macroname=Text

/H
Displays all commands stored in memory. (This list will not be redirected to a file).

/I|O
Specifies whether text is entered in Insert or Overstrike mode by default. In either case the alternative mode can be selected by using <Insert> but the default is reset as soon as <Enter> is used. The default mode is Overstrike.

/K:xx
Sets the size of the keyboard type-ahead buffer. The default is 15 (characters). If DosKey is already running, it must be reloaded (with /R) when changing the buffer size.

/L
Sets the maximum size of the line edit buffer. The default is 128 (characters).

/M
Displays a list of all DosKey macros currently in the buffer. This list can be redirected to a text file using standard Dos redirection (>)

/R
Installs a new instance of DosKey. If DosKey is already running, the buffer is cleared of both macros and the Command Line history. Note that installing a new instance of DosKey does not remove the previous instance. Thus each use of /R takes another 5K of conventional/upper memory.

To create a Doskey macro:
DOSKEY Macroname=Text

To play a macro:
Macroname

To delete a macro:
DOSKEY Macroname=

Macroname
The name of the macro. This is a string of one or more characters possibly modified by the Ctrl and/or Alt keys.

Text
The text string to be assigned to Macroname. This will typically be one or more Dos commands along with appropriate parameters and/or switches.

DosKey Commands

Left/Right cursor
Moves the cursor back/forward one character.

Ctrl + Left/Right cursor
Moves the cursor back/forward one word.

Home/End
Moves the cursor to beginning/end of line.

Up/Down cursor
To scroll up (and back) through the list of stored commands. Each press of the "up" key recalls the previous command and displays it on the command line.

Page Up/Down
Recalls the oldest/most recent command in the buffer

F1
Copies the next character from the Template to the Command Line

F2 + key
Copies text from the Template up to (but not including) key.

F3
Copies the Template from the present character position to the Command Line.

F4 + key
Deletes the characters from the present character position up to (but not including) key.

F5
Copies the current command to the Template and clears the Command Line.

F6
Places an end-of-file character (^Z) at the current position of the Command Line.

F7
Displays a numbered list of the command history.

Alt-F7
Deletes all commands stored in the buffer.

Chars + F8
Entering one or more characters Chars followed by F8 will display the most recent command beginning with Chars. Pressing F8 again will display the next most recent command beginning with Chars, and so on.

F9 + Command#
Displays the designated command on the command line.

Alt-F10
Deletes all macro definitions.

Doskey Special Characters

The following special characters can be used in macros to control command operations:

$G
Redirects output - equivalent to the redirection symbol >

$G$G
Appends output to the end of a file - equivalent to the append symbol >>

$L
Redirects input - equivalent to the symbol <

$B
Sends macro output to a command - equivalent to the pipe symbol |

$T
Separates commands when creating macros or typing commands on the Doskey command line

$$
Use for the $ sign

$1 to $9
Represents any command-line parameters that can be specified when the macro is run. Comparable with the %1 to %9 characters in batch programs

$*
Represents command-line information that can be specified when macroname is written. $* is similar to the replacable parameters $n except that everything typed on the command line after macroname is substituted for the $* in the macro.

Notes:

See Using DosKey for further information on editing the command line and creating and using macros.

The /E(cho) and /I(nsert)|O(vertype) states can be modified, the /H(istory) and /M(acro) lists displayed, and /F(ile) retrieved even after DosKey is initially loaded by reentering DOSKEY along with the appropriate switch(es). This action does not affect the commands and macros stored in the buffer. However, the /B(ufsize), /L(ine size), and /K(eyboard buffer) cannot be changed without using the /R(einstall) switch which removes all stored commands and macros.

DosKey is a memory resident program that, once loaded, cannot be unloaded. It occupies 4 176 bytes of conventional (or upper, if available) memory, plus the size of the buffer (minimum: 256 bytes; default 512 bytes).

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Doskey.com
c:\windows\command
7.0
Win95
15 431
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
15 495¹
24/08/96
win95_13.cab

Win98
15 495¹
11/05/98
win98_28.cab

Win98 SE
15 495¹
23/04/99
win98_25.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Edit

A simple full-screen Dos-based ASCII text editor.

Syntax

EDIT [/B] [/H] [/R] [/S] [/nnn] [file(s)]

/B
Forces monochrome mode.

/H
Displays the maximum number of lines possible for your hardware.

/R
Load file(s) in read-only mode.

/S
Forces the use of short filenames.

nnn
Load binary file(s), wrapping lines to nnn characters wide.

file
Specifies initial files(s) to load. Wildcards and multiple filespecs can be used.

Note

A list of shortcut keys can be displayed from the "Help" menu.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Edit.com
c:\windows\command
7.0
Win95
69 886¹
11/07/95
win95_02.cab

7.1
Win95 (OSR2.x)
69 886¹
24/08/96
win95_02.cab

Win98
69 902²
11/05/98
win98_28.cab

Win98 SE
69 902²
23/04/99
win98_25.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Extract

This utility is provided to extract one or more files from the "Cabinet" archives on the Win 95 CD-ROM. This would generally only be done if it was suspected that an installed file was corrupted in some way.

Syntax:

EXTRACT [/Y] [/A] [/D | /E] [/L dir] cabinet [filename ...]

EXTRACT [/Y] source [newname]

EXTRACT [/Y] /C source destination

cabinet
Cabinet file (contains two or more files)

filename
Name of the file to extract from the cabinet. Wild cards and multiple filenames (separated by blanks) may be used.

source
Compressed file (a cabinet with only one file).

newname
New filename to give the extracted file. If not supplied, the original name is used.

/A
Process ALL cabinets. Follows cabinet chain starting in first cabinet mentioned.

/C
Copy source file to destination (to copy from DMF disks).

/D
Display cabinet directory (use with filename to avoid extract).

/E
Extract (use instead of *.* to extract all files).

/L dir
Location to place extracted files (default is current directory).

/Y
Do not prompt before overwriting an existing file.

Example

To extract the arial font file from the Win95 CD (on drive X:) to the current directory where the host CAB file is not known:
Extract x:\win95\win95_02.cab arial.ttf /A

Exit Codes:

0
No errors occured.
If the source file was found and there was no file of the same name in destination, it was extracted;
if the source file was found and there was a file of the same name in destination, it was or was not copied as the user required;
no source file was found in the specified CAB file; or
EXTRACT was terminated by Ctrl-C before normal completion.

1
The source CAB file couldn't be opened/located.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Extract.exe
c:\windows\command
7.0
Win95
46 656¹
11/07/95
\win95

7.1
Win95 (OSR2.x)
46 656¹
01/12/97
\win98

Win98
93 242²
11/05/98
\Win98\
Base5.cab

Win98 SE
93 242²
23/04/99

¹ Identical files despite different date stamps: v.1.00.0530  (03/04/95)
² Identical files despite different date stamps: v.1.00.603.0 (14/08/97)

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Fdisk

FDISK is a menu driven utility used to configure and/or display information about the partitions on a hard disk.

Before a hard disk can be recognised by DOS (or any other compatible operating system), a Master Boot Record (MBR) must be established. The MBR defines areas of the disk to be:

a Primary Partition and/or

an Extended Partition.

In turn, an Extended Partition has to be designated as containing one or more Logical Dos Drives.

FDISK is the MS-DOS utility used to create an MBR by defining the size and nature of a hard drive's partitions. See "Using FDISK - the screens" for a screen-by-screen review of the program.

CAUTION: Using FDISK to modify or delete partitions on a hard drive renders all the data associated with that partition unavailable - ie. deleted!

Syntax:

To run the FDISK utility:
FDISK [/X]

To display a summary of the partition structure on all hard drives:
FDISK [/STATUS]

To create partitions without going through the standard FDISK menus:
FDISK [/X] drive [/PRI:size] [/EXT:size] [/LOG:size] [/PRMT | /Q]

To rewrite the Master Boot Record of the primary drive without altering the partition table information:
FDISK /MBR

To rewrite the Master Boot Record of any drive (drive) without altering the partition table information:
FDISK /CMBR drive

/X
Ignores extended disk-access support. This switch may be needed if disk access or stack overflow errors occur

/MBR
Re-writes the Master Boot Record of the primary drive based on the current disk structure. This switch can be used to repair a Master Boot Record that has been corrupted or damaged.

/CMBR drive
Re-writes the Master Boot Record of drive (if present) based on the current disk structure. This switch can be used to repair a Master Boot Record that has been corrupted or damaged. ¹

/PRI: size
Creates a Primary Partition.

/EXT: size
Creates an Extended Partition.

/LOG: size
Creates a Logical DOS Volume in the Extended Partition.

drive
The drive number.

size
The size of the partition (in Mb or as a percentage of the available space).

/PRMT
Prompts for action

/Q
Quiet - no messages displayed during processing

Notes:

FDISK will only allow the creation of one Primary Partition and one Extended Partition. The Extended Partition can contain up to 23 Logical Dos Volumes. Actually, the limit is set by the way that Dos assigns drives letters A: to Z:. Drives A: and B: are reserved for floppy drives, and drive C: for the primary partition on the first hard drive leaving 23 letters for other drives. If the computer has a second hard-drive, CD-ROM, or any other drives, the maximum number of logical drives should be reduced accordingly.

The maximum partition size when using the FAT16 system is 2 Gb. Apparently the maximumum partition size when using the FAT32 system is 2000 Gb (not tested), BUT...

According to MS Knowledge Base article Q246818, no version of Win95 has support for hard disks larger than 32 Gb. I am not clear on where the fractures show but MicroSoft's suggested workaround is to upgrade to Win98 or WinME.

Another Knowledge Base article says that the version of FDISK distributed with Win98 and Win98SE will not correctly report the size of disks larger than 64 Gb. A patch is available for download that corrects this (see Q263044 for details). ²

FDISK does not allow you to change the size of a partition or logical drive directly. Instead it is necessary to delete the partition/logical drive and then create a new one of the required size.

Deleting a partition/logical drive will make all data on that partition/logical drive unavailable. However, data in other partitions/logical drives will not be affected.

If the combined partition sizes are less than the total capacity of the disk, the disk will work just fine - but at the reduced capacity.

If a partition/logical drive is specified that is greater than the available capacity, the size of the last partition/logical drive is automatically reduced to that of the available capacity.

FDISK works only on hard disks physically installed on your computer. Fdisk does not work on a drive formed by using the SUBST command nor does it work on a network or an Interlnk drive.

FDISK does not display information about compressed drives (these being, in reality, somewhat special hidden, read-only, system files). Furthermore, when a drive is compressed (using the Win95 Drivespace utility, at least) typically the compressed drive is given the letter of the old uncompressed drive, and the "host" drive is given a new letter. However, as far as FDISK is concerned, nothing has changed - ie. the new drive letter(s) are not recognised.

FDISK assigns consecutive drive letters (starting with C:) according to the following hierarchy:

Primary Partitions starting with Disk 1 and going down the list;

Logical Dos Drives in Extended Partitions starting with the Drives on Disk 1 and going down the list.

It is not possible to change this.

The undocumented switches (/PRI, /EXT, and /LOG) can be used from the command line or in a batch file and could be useful if a number of new drives are to be prepared similarly.

FDISK is not a particularly powerful utility in that the range of options offered is limited and there is not much scope for innovation. It is powerful in the sense that it can erase a lot of data very quickly!

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Fdisk.exe
c:\windows\command
7.0
Win95
59 128
11/07/95
win95_02.cab

7.1
Win95 (OSR2.x)
63 116
24/08/96
win95_02.cab

Win98
63 900
11/05/98
Base5.cab

Win98 SE
63 916
23/04/99
Base5.cab

Further Reference

Undocumented FDISK - Michael Jacobsen (1999). A good concise list of FDISK switches and how to use them.

Hard Disk Partitioning, Why and How(for MS-DOS/Windows PCs) - Stan Brown (1999). An excellent discussion of the reasons to partition (or not to partition) a hard drive.

See the Links page for leads to more general information on disk structure and partitioning.

¹ Thanks to Douglas Fuller for his advice on the /CMBR switch

² Thanks to Osmo Vuorio for pointing out the KB articles

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
November 1, 2000.

Scandisk

Runs the ScanDisk disk-repair program.

Syntax

To check and repair the current drive:
SCANDISK

To check and repair a drive:
SCANDISK [drive: | /ALL] [/CHECKONLY | /AUTOFIX [/NOSAVE]] [/SURFACE]

To check and repair an unmounted DriveSpace compressed volume file:
SCANDISK drive:\DRVSPACE.nnn [/CHECKONLY | /AUTOFIX[/NOSAVE]]

To examine a file for fragmentation:
SCANDISK /FRAGMENT [drive:]filename

To undo repairs you made previously, use the following syntax:
SCANDISK /UNDO [undodrive:]

/ALL
Checks and repairs all local drives.

/AUTOFIX
Fixes damage without prompting.

/CHECKONLY
Checks a drive, but does not repair any damage.

/CUSTOM
Configures and runs ScanDisk according to SCANDISK.INI settings.

/NOSAVE
With /AUTOFIX, deletes lost clusters rather than saving as files.

/NOSUMMARY
With /CHECKONLY or /AUTOFIX, prevents ScanDisk from stopping at summary screens

/SURFACE
Performs a surface scan after other checks.

/MONO
Configures ScanDisk for use with a monochrome display.

drive
The drive to be worked on (Default is the current drive)

undodrive
The drive containing the Undo disk.

/CLIP
Shortens long file names to regular 8.3 format. (?)

/HELP
Same as /?.

/MOUNT
Mounts DriveSpace volume. Same as using "Mount=Always" in SCANDISK.INI

/NEW
?

/NOLOST
No prompt for surface scan, no check for lost clusters.

/NOUI
Uses normal DOS interface instead of Windows 95 graphical interface.

/TEXT
Same as /NOUI. (?)

/TIME
During surface scan, marks sectors that take longer than usual to read. These sectors may be on their way to failing totally. Same as using "ScanTimeOut=On" in SCANDISK.INI.

Note

The Dos version of Scandisk does not want to run while Win95 is running. Rather than signalling an error, it automatically transfers control to the Windows version of Scandisk.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Scandisk.exe
c:\windows\command
7.0
Win95
134 738
11/07/95
\Win95\

7.1
Win95 (OSR2.x)
142 353
24/08/96
?

Win98
143 818¹
11/05/98
win98_42.cab

Win98 SE
143 818¹
23/04/99
win98_46.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 29, 2000.

Ansi.sys

Entering "Escape Sequences"
The Commands
Keyboard Key Codes
Index

Ansi.sys is an enhancement of the "CON" device driver built into Command.com. It can be used to modify the default display colours, the position of the cursor, and how keystrokes are interpreted. It can also be used to change the video mode.

Syntax

Ansi.sys can only be loaded in Config.sys using a Device or DeviceHigh statement.

Device=[Path]Ansi.sys [/X|/K] [/R] or
DeviceHigh=[Path]Ansi.sys [/X|/K] [/R]

Path
The full path (usually: c:\windows\command). Default is the root directory of the start-up drive (usually C:/)

/X
Enables remapping of the extended keys on a 101-key keyboard.

/K
Causes a 101-key keyboard to behave as an 84-key keyboard.

/R
Invalid switch (?)

/L
Valid but not functional ¹

/S
[/SCREENSIZE] ?

Notes

Once Ansi.sys has been loaded, it's various functions can be accessed at any time by sending one or more "Escape Sequences" to the screen. These are tabulated in Ansi.sys Commands

Unfortunately, Escape Sequences cannot be directly entered at the command line because the first character (ASCII 27 or "ESC") is interpreted as an instruction to "clear the command line" which doesn't get you very far. Fortunately, a number of workarounds have been developed - see "Entering Escape Sequences".

The most common situations in which Ansi.sys is called for are:

The construction of fancy prompts and menus (see PROMPT); and

Remapping little used keys on the keyboard

It should be appreciated that most DOS programs write directly to the screen and bypass Ansi.sys altogether. Thus both colour and keyboard changes will generally only apply when using Dos commands and the supplied utilities such as FDISK and FORMAT.

As far as I can determine, the "extended keys" that can be remapped by including the /X switch are the 10 keys between the main and number keypads on the standard 104 key keyboard - ie. Insert, Home, Page Up, Page Down, Delete, End, and the cursor keys. These keys all have scan codes beginning with 224 and it appears that, without the /X switch, this is read as "0" and become indistinguishable from the equivalent keys on the number keypad.

According to Msdosdrv.txt on the Win98SE CD, the /R switch

"Adjusts line scrolling to improve readability when ANSI.SYS is used with screen-reading programs (which make computers more accessible to people with disabilities)"

However, on my machine Ansi.sys will not load when this switch is specified. Furthermore, scanning through the code with EDIT, I can find /X, /K/, /L, /S and /SCREENSIZE - but no trace of /R. Very odd!

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Ansi.sys
c:\windows\command
7.0
Win95
9 719¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
9 719²
24/08/96
win95_14.cab

Win98
9 719²
11/05/98
win98_46.cab

Win98 SE
9 719²
23/04/99
win98_52.cab

Superscripts denote which same size files, if any, are identical (using FC).

¹ Thanks to Mark Dormer for pointing me to the MS Knowledge Base article Q74182

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 26, 2000.

Display.sys

Enables the display of international character sets.

Syntax

The Display.sys device driver must be loaded in Config.sys using either a Device or DeviceHigh statement in one of the following formats:

Device/DeviceHigh = [Path]Display.sys CON=(type)

Device/DeviceHigh = [Path]Display.sys CON=(type,hwcp)

Device/DeviceHigh = [Path]Display.sys CON=(type,hwcp,n)

Device/DeviceHigh = [Path]Display.sys CON=(type,hwcp,(n,m))

Path
The full path. Default is the root directory of the start-up drive (usually C:/)

type
Specifies the display adapter in use (see table below). If type is omitted, DISPLAY.SYS checks the hardware to determine which display adapter is in use.

hwcp
Specifies the number of the Code Page (character set) hard coded in the display adaptor. If this parameter is included, it is always possible to switch back to it whichever Code Page is specified using the MODE and CHCP commands

Character sets and associated languages

United States English
437
Multilingual (Latin 1)
850

Canadian French
865
Slavic (Latin 2)
852

Portuguese
860
Nordic
865

n
Specifies the number of character sets the hardware can support in addition to the primary character set specified for the hwcp parameter.

m
Specifies the number of subfonts the hardware supports for each code page.

Valid values of type, m and n

Display Adaptor
type
n
m

EGA, VGA, or SVGA
EGA
0 to 6
2

LCD
LCD
0 or 1
1

CGA
CGA
0
0

Monochrome
MONO
0
0

Notes

As far as I can see, the only value of type that is of relevance to Dos 7 users is EGA (which includes SVGA). Even though laptops use LCD displays, I suspect that these are not quite what the original designers of Display.sys had in mind and that EGA would be the appropriate for these machines too.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Display.sys
c:\windows\command
7.0
Win95
17 175¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
17 175²
24/08/96
win95_14.cab

Win98
17 175²
11/05/98
win98_46.cab

Win98 SE
17 175²
23/04/99
win98_52.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 21, 2000.

Dblbuff.sys

The Dblbuff.sys device driver is used to perform double buffering which is required to provide compatibility for certain hard-disk controllers that cannot work with memory provided by EMM386 or Windows running in 386 Enhanced mode.

Syntax

DEVICE=[path] DBLBUFF.SYS [/D+] or
DEVICEHIGH=[path] DBLBUFF.SYS [/D+]

[Path]
The full path. Default is the root directory of the start-up drive (usually C:/)

/D+
Instructs Dblbuff.sys to double-buffer all disk I/O all the time. By default, it will only double-buffer I/O to UMBs, and it will automatically stop double-buffering if it appears to be unnecessary.

Notes

If Windows Setup determined that your system may need double-buffering, it will add a DoubleBuffer=1 entry to the [Options] section of Msdos.sys, which will automatically load Dblbuff.sys. To manually enable double-buffering, the above entry can be added to Msdos.sys or the device driver can be loaded in Config.sys using Device/DeviceHigh.

Examples

To enable double buffering by loading the Dblbuff.sys device driver into upper memory:

DeviceHigh=c:\windows\Dblbuff.sys

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Dblbuff.sys
c:\windows
7.0
Win95
2 100¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
2 100¹
24/08/96
win95_14.cab

Win98
2 614
11/05/98
win98_46.cab

Win98 SE
2 614
23/04/99
win98_52.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Dblspace.sys/Drivspace.sys

Enables the loading of the real-mode DrvSpace driver (DrvSpace.bin) into upper memory blocks.

As far as I can see, in every respect except name, DblSpace and DrvSpace are the same. For brevity, I will use DrvSpace to represent both DrvSpace and DblSpace. If you have DblSpace installed with your version of Win95, substitute accordingly.

Syntax

The DrvSpace.sys device driver can only be loaded using the Device/DeviceHigh statement in Config.sys.

Device=[Path]DrvSpace.sys /Move [/NoHMA] [/Low]

DeviceHigh=[Path]DrvSpace.sys /Move [/NoHMA] [/Low]

Path
The full path. Default is the root directory of the start-up drive (usually C:/)

/Move
Moves DrvSpace.bin to its final location.

/NoHMA
Prevents DrvSpace.sys from moving DrvSpace.bin into the high memory area (HMA).

/Low
Prevents DrvSpace.sys from loading at the top of conventional memory.
The only occasion on which this switch would be required is if some Dos program cannot work with DrvSpace located at the top of conventional memory.

Notes

DblSpace and DrvSpace are essentially two names for one program. Which name is used depends on the version of Win95. Dblspace is used in the earlier versions and DrvSpace for the later ones.

When the computer starts, Dos loads DrvSpace.bin along with various other operating system functions before processing Config.sys and Autoexec.bat. All such files have to be loaded in conventional memory because the device drivers required to manage upper memory have yet to be loaded. When upper memory management is established, some device drivers (such as Ifshlp.sys and Setver.exe) are automatically moved to upper memory. DrvSpace.bin requires the auxiliary device driver DrvSpace.sys to be loaded before DrvSpace.bin can be moved.

When DrvSpace is used to create a compressed drive, a DrvSpace.sys line is automatically added to Config.sys.

Examples

On my system, the amount of free conventional memory rose from 507 Kb to 624 Kb by adding the following line to Config.sys:
DeviceHigh=c:\windows\command\drvspace.sys /move

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Drvspace.sys
c:\windows\command
7.0
Win95
15 831
11/07/95
precopy1.cab

7.1
Win95 (OSR2.x)
2 135¹
24/08/96
precopy1.cab

Win98
2 135¹
11/05/98
precopy2.cab

Win98 SE
2 135¹
23/04/99
precopy2.cab

Drvspace.bin
c:\windows\command
7.0
Win95
71 287
11/07/95
precopy1.cab

7.1
Win95 (OSR2.x)
65 271
24/08/96
precopy1.cab

Win98
68 870²
11/05/98
precopy1.cab

Win98 SE
68 871²
23/04/99
base4.cab

Drvspace.exe
c:\windows
7.0
Win95
336 736
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
395 280
24/08/96
win95_13.cab

Win98
404 880³
11/05/98
win98_40.cab

Win98 SE
404 880³
23/04/99
win98_45.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 21, 2000.

EMM386.exe

Provides access to the upper memory area and uses extended memory to simulate expanded memory.

Syntax

The Emm386.sys device driver must be loaded in Config.sys using a Device statement.

Device=[Path] Emm386 [Switches] [Parameters]

Path
The full path. Default is the root directory of the start-up drive (usually C:/)

Although the EMM386 device driver must be loaded in Config.sys, it need not be activated unless required. Once loaded, the activation status can be modified with the EMM386 command at any time.

ON
EMM386 is activated at startup (Default).

OFF
EMM386 is not activated at startup.

AUTO
EMM386 is not activated at startup but is automatically activated if any program calls for it.

Although few programs these days use expanded memory, EMM386 is still needed to allow access to the upper memory area. If no expanded memory is required, that part of EMM386's job can be disabled.

NOEMS
Provides access to the upper memory area but does not provide any expanded memory.

NOVCPI
Disables support for VCPI programs. This switch must be used with the NOEMS switch otherwise VCPI support is not disabled. If both switches are set, EMM386 disregards the memory parameter and the MIN switch. Disabling support for VCPI programs reduces the amount of extended memory required by EMM386.

Left to itself, EMM386 will allow all extended memory up to 32 Mb to be used as expanded memory if programs require it. Any memory not required is still available as extended memory for other programs. A number of switches allow more precise control over exactly how much of each type of memory is allocated/kept free.

memory
Specifies the maximum amount of extended memory (in Kb) to be provided as expanded/Virtual Control Program Interface (EMS/VCPI) memory. This amount is in addition to the memory used for Upper Memory Blocks (UMBs) and EMM386 itself. Values for memory can be in the range 64 to the lesser of the amount of extended memory available or 32768 (32 Mb) with the value being rounded down to the nearest multiple of 16. (Default: maximum possible).

MIN=size
Specifies a minimum amount of EMS/VCPI memory (in Kb) to be provided by EMM386. Additional expanded memory may be allocated if required (and if available) but the minimum is guaranteed.

size
size must be in the range of 0 to the maximum available. (Default: 256). If size is greater than a value set as memory, EMM386 uses the value specified by size

L=minXMS
Specifies a minimum amount of extended memory (in Kb) that is not to be made available as expanded memory. (Default=0)

By default, once Emm386.sys is installed, it moves part of itself along with the extended BIOS data from conventional memory to upper memory. Should these actions not be desired for any reason, they can be prevented:

NoHi
Emm386.sys remains entirely in conventional memory.

NoMoveXBDA
The extended BIOS data remains in conventional memory.

When EMM386 is configured to provide upper memory blocks (by using the NOEMS or RAM switches), EMM386 will also automatically backfill conventional memory if there is less than 640k, in order to bring total conventional memory up to 640k.

NoBackfill
Because Windows does not support backfilled conventional memory, use the NoBackfill switch if your computer has less than 640K of conventional memory.

Under some circumstances EMM386 will interfere with the function of Ctrl+Alt+Del when used to restart the computer.

AltBoot
Specifies that EMM386 use an alternate handler to restart your computer when you press Ctrl+Alt+Del. Use this switch only if your computer stops responding or exhibits other unusual behavior when EMM386 is loaded and you press Ctrl+Alt+Del.

/V
or
/Verbose

Directs EMM386 to display status and error messages while loading. By default, EMM386 does not display any messages unless it encounters an error. As an alternative to using the switch, status messages can be displayed by holding down the Alt key while EMM386 is loading.

A number of switches allow control over exactly where UMBs and expanded memory page frames are to be located.

RAM=range
Specifies a range of segment addresses to be used for UMBs and also enables EMS support. If =range is omitted, EMM386 uses all available adapter space to create UMBs along with a page frame for EMS.

ROM=range
Specifies a range of segment addresses that EMM386 uses for shadow RAM. Specifying this switch may speed up your system if it does not already have shadow RAM.

X=range
Prevents EMM386 from using a particular range of segment addresses for an EMS page or for UMBs. The X switch takes precedence over the WIN and I switches if the ranges overlap.

I=range
Specifies a range of segment addresses to be used (included) for an EMS page or for UMBs.

WIN=range
Reserves a specified range of segment addresses for Windows instead of for EMM386. The WIN switch takes precedence over the RAM, ROM, and I switches if their ranges overlap.

range
range is specified in the form: mmmm-nnnn where mmmm and nnnn can be from A000h through FFFFh and are rounded down to the nearest 4-kilobyte boundary.

Mx
Specifies the address of the page frame.

x
Valid values are in the range 1 through 14. Values in the range 10 through 14 should be used only on computers that have 512K of memory. The following list shows each value and its associated base address in hexadecimal format:

            1 => C000h     8 => DC00h
            2 => C400h     9 => E000h
            3 => C800h    10 => 8000h
            4 => CC00h    11 => 8400h
            5 => D000h    12 => 8800h
            6 => D400h    13 => 8C00h
            7 => D800h    14 => 9000h

FRAME=address
Specifies the page-frame segment base directly. To specify a specific segment-base address for the page frame, use the FRAME switch, and specify the address you want.

address
Valid values for address are in the ranges 8000h through 9000h and C000h through E000h, in increments of 400h. To provide expanded memory and disable the page frame, you can specify FRAME=NONE; however, this may cause some programs that require expanded memory to work improperly.

/Pmmmm
Specifies the address of the page frame.

mmmm
Valid values for mmmm are in the ranges 8000h through 9000h and C000h through E000h, in increments of 400h.

Pn=address
Specifies the segment address of a specific page, where n is the number of the page you are specifying and address is the segment address you want. The addresses for pages 0 through 3 must be contiguous in order to maintain compatibility with version 3.2 of the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS). If you use the M switch, the FRAME switch, or the /P switch, you cannot specify the addresses for pages 0 through 3 for the /P switch.

n
Valid values are in the range 0 through 255.

address
Valid values are in the ranges 8000h through 9C00h and C000h through EC00h, in increments of 400h.

B=address
Specifies the lowest segment address available for EMS "banking" (swapping of 16KB pages).

address
Valid values are in the range 1000h through 4000h. The default value is 4000h.

A=altregs
Specifies how many fast alternate register sets (used for multitasking) you want to allocate to EMM386. Every alternate register set adds about 200 bytes to the size in memory of EMM386.

altregs
Valid values are in the range 0 through 254. The default value is 7.

H=handles
Specifies how many handles EMM386 can use.

handles
Valid values are in the range 2 through 255. The default value is 64.

D=nnn
Specifies how many kilobytes of memory should be reserved for buffered direct memory access (DMA). Discounting floppy disk DMA, this value should reflect the largest DMA transfer that will occur while EMM386 is active.

nnn
Valid values are in the range 16 through 256. The default value is 32.

The Weitek co-processor apparently requires special provisions with EMM386

W=ON
Enables support for the Weitek co-processor.

W=OFF
Does not provide support for the Weitek co-processor (Default).

HIGHSCAN
Specifies that EMM386 use an additional check to determine the availability of upper memory for use as UMBs or EMS windows. On some computers, specifying this switch may have no effect or cause EMM386 to identify upper memory areas as available when they are not. As a result, your computer might stop responding.

Notes

The significance of a number of the above switches is, I regret, beyond my comprehension. I have included them here for completeness. However, not only have I not tested them, but have no idea on how to go about trying.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Emm386.exe
c:\windows
7.0
Win95
125 495¹
11/07/95
win95_08.cab

7.1
Win95 (OSR2.x)
125 495²
24/08/96
win95_14.cab

Win98
125 495
win98_41.cab
?

Win98 SE
125 495³
23/04/99
win98_45.cab

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 27, 2000.

Himem.sys

Himem.sys is the device driver required by Dos to use extended memory (all installed RAM in excess of 1 Mb) including the free memory in the high memory area (HMA).

Syntax

Device=[Path] Himem.sys [/Switches]

[Path]
The full path. Default is the root directory of the start-up drive (usually C:/).

The A20 handler controls access to extended memory (including the HMA):

/A20Control:ON
HIMEM always takes control of the A20 line (Default).

/A20Control:OFF
HIMEM only takes control of the A20 line if it is off when Himem.sys loads.

On some computers, HIMEM may change the CPU clock speed.

/CPUClock:OFF
Ignores changes (if any) to CPU clock speed arising from loading HIMEM (Default).

/CPUClock:ON
Prevents HIMEM from changing the CPU clock speed. Including this switch may slow down loading of Himem.sys slightly

By default, HIMEM will only recognise the first 16 Mb of RAM on EISA computers:

/EISA
Specifies that HIMEM should allocate all available extended memory.

/NOEISA
Specifies that HIMEM should not do EISA scanning for extended memory.

Only one application can use the High Memory Area (HMA) at one time. By default, HIMEM allocates the HMA to the first program that requests it whatever memory requirements it might have. This switch allows some control over the use of HMA by disqualifying small programs.

/HMAmin=m
Sets the minimum memory requirements of a program before HIMEM will allocate HMA (if available) for its use.

m
The minimum amount of memory to be requested. m must be in the range 0 to 63 (Default: 0).
The prime candidate for HMA is Dos as this will free up 43 Kb of conventional memory. However, HMA is not allocated until all device drivers and programs in Config.sys have been loaded. To improve the chances that Dos is loaded into the HMA, include the switch: HMAmin=40

Some older programs use the Interrupt 15h interface to allocate extended memory rather than using the XMS (eXtended-Memory Specification) method provided by HIMEM.

/INT15=xxxx
Allocates extended memory to be reserved for the Interrupt 15h interface.

xxxx
The amount of memory (in Kb) to be reserved for the Interrupt 15h interface.
64 < xxxx < 65535 (Default: 0). The value specified should be 64K more than the application requires because HMA is allocated from this as well. If xxxx is specified as less than 64, it is taken as 0.

/X
Specifies not to use INT 15h (ax==E820h), the latest extended memory support API.

/NOABOVE16
Specifies not to use INT 15h (ax==E801h) Compaq Bigmem support to scan for extended memory.

HIMEM needs to have an understanding of the computer hardware on which it is installed in order to take control of the A20 address line. In most cases, HIMEM can automatically detect hardware but sometimes it gets confused and needs help.

/MACHINE:xxx
Specifies the computer type.

xxx

Can be either the "Code" or "Number" to match the Computer Type as in:

Code       Number    Computer type
at           1       IBM AT or 100% compatible
ps2          2       IBM PS/2
ptlcascade   3       Phoenix Cascade BIOS
hpvectra     4       HP Vectra (A & A+)
att6300plus  5       AT&T; 6300 Plus
acer1100     6       Acer 1100
toshiba      7       Toshiba 1600 & 1200XE
wyse         8       Wyse 12.5 Mhz 286
tulip        9       Tulip SX
zenith       10      Zenith ZBIOS
at1          11      IBM PC/AT (alternative delay)
at2          12      IBM PC/AT (alternative delay)
css          12      CSS Labs
at3          13      IBM PC/AT (alternative delay)
philips      13      Philips
fasthp       14      HP Vectra
ibm7552      15      IBM 7552 Industrial Computer
bullmicral   16      Bull Micral 60
dell         17      Dell XBIOS

When a program requires extended memory, it is allocated a "handle" to a block by HIMEM. Each available handle takes 6 bytes of conventional memory.

/NUMHANDLES=n
Specifies the number of extended memory handles to be made available.

n
The number of handles. 1 < n < 128 (Default: 32).

Some computers make ROM code run faster by "shadowing" it in RAM - that is, by copying the ROM code into faster RAM memory at startup. This, of course uses some extended memory. If there is less than 2MB of RAM available, HIMEM will attempt to disable Shadow RAM to make available as much extended memory as possible. It is unlikely that any computer running Dos7 will have less than 2 Mb RAM, so this switch is not particularly relevant

/ShadowRAM:OFF
Disables Shadow RAM if there is less than 2 Mb of total RAM available. (Default).

/ShadowRAM:ON
Leaves Shadow RAM on for all machines set up to run it.

The HIMEM memory test is more thorough than the standard power-up memory test performed by most computers and is able to identify unreliable memory.

/TestMem:ON
Memory testing is undertaken at startup (Default).

/TestMem:Off
Memory testing is not undertaken at startup. This option will slightly speed the startup process.

/V
or
/Verbose

Directs HIMEM to display status and error messages while loading. By default, HIMEM does not display any messages unless it encounters an error. As an alternative to using the switch, status messages can be displayed by holding down the Alt key while Himem is loading.

Notes

In most cases, command-line options are not required. The default values for HIMEM.SYS are designed to work with most hardware.

The Device line in Config.sys installing Himem.sys must come before any commands starting programs or devices using extended memory. Specifically, the Device=Himem.sys line must come before the Device=Emm386.exe and DOS=HIGH,UMB lines.

The significance of a number of the above switches is, I regret, beyond my comprehension. I have included them here for completeness. However, not only have I not tested them, but have no idea on how to go about trying.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Himem.sys
c:\windows
7.0
Win95
32 935
11/07/95
win95_03.cab

7.1
Win95 (OSR2.x)
33 191¹
24/08/96
win95_02.cab

Win98
33 191
11/05/98
base5.cab

Win98 SE
33 191²
23/04/99
?

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 28, 2000.

Ramdrive.sys

Uses part of the computer's random-access memory (RAM) to simulate a hard disk drive.

Syntax

Device=[Path]RamDrive.sys [Switches] [Parameters]

[Path]
The full path. Default is the root directory of the start-up drive (usually C:/)

DiskSize
Specifies the size of the RAM drive in Kb. Valid values for DiskSize are from 4 to 32767 or amount of memory available, whichever is less. (Default is 64).

SectorSize
Specifies the disk sector size in bytes. SectorSize can be 128, 256, or 512 bytes (Default: 512). If a value is specified for SectorSize, DiskSize must also be specified.

NumEntries
Specifies the maximum number of files and directories you can create in the RAM drive's root directory. NumEntries can be from 2 to 1024 entries (Default is 64). If specified, NumEntries is rounded up to the nearest sector size boundary.
If NumEntries is specified, DiskSize and SectorSize must also be specified.
If there is not enough memory to create the RAM drive as specified, RAMDrive will try to create it with a limit of 16 directory entries. This may result in a RAM drive with a different limit from the one you specified.

By default, RamDrive.sys will create the RAM Disk in conventional memory. The preferred option is to create the disk(s) in extended memory.

/E
Creates the RAM drive in extended memory. For RAMDrive to use extended memory, the system must be configured so that it provides extended memory via a device driver such as Himem.sys, for example.

/A
Creates the RAM drive in expanded memory. For RAMDrive to use expanded memory, the system must be configured so that it provides expanded memory via an expanded-memory manager such as EMM386.

Notes

This device driver must be loaded by a DEVICE or DEVICEHIGH command in your CONFIG.SYS file.

RAM drives are much faster than hard disk drives because your computer can read information faster from memory than from a hard disk. As far as the computer is concerned, a RAM drive appears to be a normal hard disk drive which can be used as any other hard drive.

The most important difference between a real disk drive and a RAM drive is that all information on a RAM drive is lost when the computer is turned off/restarted. It is thus most important to save any data written to a RAM disk on more permanent media before shutting down.

Ramdrive.sys can create RAM drives with capacities up to 32Mb. Multiple RAM drives can be set up. Each drive must be specified separately.

In a Dos environment, RAM drives can be particularly useful when working with programs that do frequent disk read/write operations - often with temporary files.

In a Win95/8 environment, RAM drives are seldom useful because Windows uses all available memory. Although it may seem a neat idea to use a RAM drive for the Windows swap file, this is very seldom practical. Windows only uses a swap file when it has run out of RAM. Reducing the amount of available RAM by making a RAM drive will mean that a swap file will be required sooner (and it won't be large enough, anyway). In short, creating a RAM drive to use for a swap file is equivalent to specifing a swap file size of 0 without a RAM drive - in both cases most systems will typically give an "out of memory" message sooner or later.

There are alternative RAM drives available that do not need to be loaded in Config.sys and/or do not have the 32Mb limit. I have not used any myself but see: The Simtel.Net MS-DOS Collection - Memory resident disks

Example

To create a RAM Drive of 32 Mb (the maximum possible with RamDrive.sys), include the following lines in Config.sys:

Device=c:\Windows\Himem.sys
Enables access to extended memory

Device=c:\Windows\Emm386.exe NoEms
Provides access to upper memory blocks (UMBs)

Dos=High,UMB
Lets Dos load into high memory and manage the UMBs

DeviceHigh=c:\Windows\RamDrive.sys 32767 /E  
Creates a 32 Mb RAM Drive in extended memory.

File Details

File Name
Default Location
Dos Ver.
Win Ver.
Size
Date
Source

Ramdrive.sys
c:\windows
7.0
Win95
12 663¹
11/07/95
win95_09.cab

7.1
Win95 (OSR2.x)
12 663¹
24/08/96
win95_14.cab

Win98
12 663¹
11/05/98
base5.cab

Win98 SE
12 663¹
23/04/99
?

Superscripts denote which same size files, if any, are identical (using FC).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
August 29, 2000

Shortcuts and Wildcards

Shortcuts

A number of Dos commands recognise certain shortcuts when navigating between directories. The best known of these are:

.
to refer to the current directory

..
to refer to the parent directory

\
to refer to the root directory of the current drive.

drive:
to refer to the current directory on drive

Examples:

If the current directory on the c: drive is c:\data\docs\letters, then:
dir c:
at the a:> prompt will list the files in c:\data\docs\letters

If the current drive and directory is c:\data\docs\letters, then:

Command
.
..
...
\

CD
ChDir
Nothing.
Current directory stays as: c:\data\docs\letters
Change to parent directory: c:\data\docs
Change to parent's parent directory: c:\data
Change to root directory: c:\

DIR
Displays current directory: c:\data\docs\letters
Displays parent directory: c:\data\docs
Displays parent's parent directory: c:\data
Displays root directory: c:\

If the current drive and directory is c:\, then:

Command
.
..
...
\

CD
ChDir
Nothing - current directory stays as: c:\
Error message:
"Invalid Directory"
Error message:
"Invalid Directory"
Nothing.
Current directory stays as: c:\

DIR
Displays current directory: c:\
Error message: "Invalid Directory"
Displays directories and extensionless files of current directory
Displays root directory: c:\

Wildcards

Many Dos commands associated with file handling (eg. ATTRIB, COPY, DEL, DELTREE, etc.) accept the use of the "wildcards" (* and ?).

In general terms, * refers to multiple characters and ? refers to a single character in a file or directory name.

Wildcard
Typical interpretation

*.*
All files with all extensions.

*letter*.*
All files with "letter" anywhere in its name.

*smith.*
All files with names ending with "smith" (or "Smith")

Test?.txt
All files named "test" + one character and with txt extensions (eg test1.txt, but not test-a.txt nor test.txt)

?e*.*
All files with an "e" as second letter in their names

It should be noted that not all commands handle wildcards in exactly the same way. For example DIR * and DIR *.* are considered synonymous but DEL * would delete only files without an extension.

Note also that when using long file names, the concept of "filename + extension" becomes somewhat confused. If a file name contains more than one period, Dos assumes that the last period separates the "filename" and the "extension" - however long that "extension" may be.

Anomolies

In a newsgroup posting, Larry Weiss¹ pointed out that " " (a space enclosed by inverted commas) is accepted as a valid file specification by EDIT and DEL - albeit in rather different ways.

EDIT will open a file using the name of the current directory. Thus if the current directory is D:\data\docs\letters,
EDIT " "
will create a file in that directory called "letters".

Actually, the number of spaces between the inverted commas can be anything from 1 to ? (over 15, anyway). If there are no spaces, EDIT displays an error message saying that it cannot open the file. A similar message is displayed if any path is included in the command.

DEL recognises " " as *.* and will prompt for confirmation before deleting all files in the directory. As with EDIT, the number of spaces between the inverted commas does not seem significant but if there are no spaces an error message is displayed saying that a required parameter missing. Unlike EDIT, a path can be included and, if it is, no spaces between inverted commas are required. i.e. to delete all files in the current directory:
DEL ./"" works, but
DEL "" gives an error message.

COPY also sees " " as *.* and, like DEL, accepts a path with it. Unlike DEL, there must always be a space between the inverted commas, even when a path is included.

References

Ref.#
From
Title
Newsgroup
Date

1
Larry Weiss
edit " " -or- erase " " strangeness?
alt.msdos.batch
01 Jun 2000

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Pipes and Redirection

A number of Dos commands send output to the screen and/or require input from the user. Redirection is a mechanism whereby the output of a command can be fed either to some other device (eg a printer or file) or to another program or command.

There are four redirection functions:

>
Redirect output

>>
Append

<
Redirect input

|
Pipe

>

Redirects a command's output from the "standard output device" (usually the monitor) to another device (eg printer) or a file.

Syntax:

To redirect output to a device:
Command > Device

To redirect output to a file:
Command > Filename

Notes:

Acceptable Device names are: CON (Monitor); PRN (LPT1 - assumed to be the printer); LPT1 - 3 (Parallel Ports - usually connected to a printer); COM 1 - 4 (Serial Ports); and NUL (an electronic void). If anything other than a recognised device is specified, it is assumed to be the name of a file.

If a file already exists with the specified Filename, it is overwritten without any warnings.

Examples:

Probably the most common uses of this redirection function is to send directory listings to the printer or to save them as a file. (One of Windows Explorer's biggest weaknesses is that it does not enable either of these operations).

To print out a sorted directory listing of all files in the Windows directory:
DIR c:\windows /o/a > PRN

To create a file containing the directory listing of the same directory:
DIR c:\windows /o/a > c:\data\directories\windows.txt

>>

Appends the output from a command to the specified file.

Syntax:

Command >> Filename

Note:

If Filename does not exist, it is created. If Filename does exist, the output from the command is added to it (unlike the > function where the original contents are overwritten).

Example:

To add the directory listing of the files in the c:\windows\system directory to that created above:
DIR c:\windows\system /o/a >> c:\data\directories\windows.txt

<

Directs input to a command from a source other than the default (the default source usually being the keyboard).

Syntax:

Command < Datasource

Example:

To sort the lines in a text file (c:\data\address list.txt) on the 12th character, the SORT command is fed input from the file:
SORT /+12 < c:\data\address list.txt

|

The "pipe" redirects the output of a program or command to a second program or command.

Syntax:

Command1 | Command2

Example:

To sort a directory listing based on the time the files were last modified, the output of a directory listing is piped to the SORT filter which sorts on the 39th character of each line:
DIR c:\data\docs | SORT /+39

Note that if the output of the DIR command had been redirected to SORT /+39 using >, Dos would return an "invalid switch" error after attempting to create a file called Sort.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Downloads

To download a zipped single file containing all the Dos7 pages, click on the logo to the right.

I will do my best to keep this file reasonably up to date, but the latest version will always be the one on the Web.

The files are in HTML format which seems to work for most people. If you wish to strip the tags and reformat for your own purposes, feel free! I do recognise that, as they stand, these pages do not print very well - especially the white-on-black "screen shots". In due course, I hope to be able to include a printable version for download.

Finally, note that this compilation simply comprises all files in my "dos7" directory and may include the odd extraneous page that is yet to be completed/discarded.

Almost forgot the bit about: use at your own risk, check for viruses etc., and generally handle as you would any other downloaded file from an unfamiliar source.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
July 23, 2000.

Breakdown of PROMPT Example

The Example

PROMPT $E[s$E[H$E[30;41m$E[K$E[4CAlt-Enter toggles full screen and window$E[15CType "EXIT" to quit $E[37;40m$E[u$P$G

The Result

   Alt-Enter toggles full screen and window
Type "EXIT" to quit   

C:\WINDOWS>_

Analysis

$E[s
Saves current cursor position
Because the cursor is to be moved to write the top line

$E[H
Move cursor to top left hand corner of screen
This could also have been written "$E[0;0H", "$E[f", or "$E[0;0f"

$E[30;41m
Changes background colour to red and text to black
This both clears extraneous characters from the top line of the display and makes the whole line red

$E[K
Clears from the cursor to the end of the line

$E[4C
Moves the cursor 4 spaces to the right
Formatting and displaying the text to be displayed in the top line

Alt ... window
Text to be displayed

$E[15C
Moves the cursor 15 spaces to the right

Type ... quit
More text

$E[37;40m
Changes colour to white text on black
Changes colours back to the default

$E[u
Moves the cursor back to the saved position
Displays the prompt where it is expected

$P
Display current drive and directory
Displays the standard prompt

$G
Display the ">" sign

Note: All those codes beginning with "$E[..." require the Ansi.sys device driver to be loaded.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Renaming Multiple Files

[REN main page]

Renaming multiple files in Dos can be simple or complicated depending on exactly what is you want to do. In ALL cases it is most important to have a good understanding of the logic used by Dos to determine which files are to be renamed and what the end result is to be. Dos's logic is not what I would call intuitive!

Contents

Substituting one or more characters for others

Renaming a set of files that have the same name but different extensions

Changing the extensions of a set of files

Adding a prefix

Adding a suffix

Removing characters from beginning of names

Removing characters from end of names

Adding/Removing characters within names

Renaming files with names already in use

Renaming files as a numbered series

Renaming files with a date stamp

The Fundamental Rules of REN

Long filenames containing spaces must be enclosed in inverted commas.

REN will accept either short or long filenames in the first parameter.

The first parameter selects the files to be copied. It has no effect on the new names to be assigned. Incidentally, it might be worth noting that *.* will not only select all files in the directory, it will also include subdirectories. If subdirectories are not to be renamed, they can be temporarily hidden (using ATTRIB) or, if all the files have extensions and the directories don't, using *.?*" will work.

The second parameter determines the new name to be given to the selected file(s). Unless otherwise specified, characters for the new name are copied character-by-character from the old name. ie. REN works in overwrite mode - there is no insert mode.

If the second parameter is:

*.*
all characters of the selected files will be used for the new name (i.e. the name remains the same).

b*.*
the first character of the name will be changed to a "b"; subsequent characters will remain the same.

" *.*"
the first character will be changed to a space

?b.*
the second character of the name will be changed to a "b"; all other characters will remain the same.

*b.*
same as *.*; the "b" is ignored and not added to the end of the original name.

????.*
The filename will be truncated after the first four characters.

The REN-bug: There is a bug associated with REN that can complicate matters when renaming multiple files. The problem arises when the new names meet the specification of the first parameter - ie. the files to be renamed - and some of them get renamed twice (or even three times). In some cases this behaviour is irrelevant: eg. if the first character of all files is to be changed to "A" then changing it to an "A" again doesn't matter. On the other hand, it is noticeable if an "A" is to be added to the beginning of the filename and some files end up with "AA" or even "AAA". The behaviour does not seem to be particularly consistent but, once aware of the problem, it is usually possible to avoid its effects.

Renaming Procedures

In all the following examples, unless otherwise noted, it is assumed that all files in the current directory are to be renamed - ie. the first parameter is "*.*".
If, in fact, the files to be renamed are not in the current directory, the path must be included as appropriate.
If only some files are to be renamed, the first parameter should, of course, be specified accordingly.

All the following have been tested and seem to work reliably with both Dos7 and Dos7.1 (Win95/Win98SE) but I would suggest keeping a backup of the originals before doing a complex rename of a large number of files!

Substituting character(s)

To change the nth character of all filenames in the specified set, use "?"s for all preceding characters and either "?"s or "*" for following characters.

Note: it is not possible to specify characters counting back from the end of the name.

Examples:

To change the first letter of all files in the current folder beginning with "a" to "A":
REN a*.* A*.*

To rename "abc001.txt ... abc099.txt" to "abc601.txt....abc699.txt"
REN *.* ???6*.*
(or REN abc0??.txt ???6*.*)

Renaming a set of files all with the same name but different extensions

This is a straightforward use of REN with wildcards.

Example:
To change the names of a group of files called "abc" with different extensions to "d" with the same extensions:
REN abc.* d.*

Changing the extensions of a set of files

Again, this is a straightforward use of REN with wildcards.

Example:
To change all ".txt" extensions to "doc":
REN *.txt *.doc

Adding a prefix

Because REN has no "insert" mode, a prefix to a filename cannot be added directly. Theoretically, it should be possible to use the syntax:
LFNFOR On
FOR %v IN (*.*) DO REN %v prefix%v
but this construction is subject to the REN-bug. There are various ways to circumvent this:

When the old filenames are all the same length, the set to be renamed can be specified with "?"s rather than a "*".

Example:
To add the characters "abc" to the beginning of each five character filename in the current directory:
LFNFOR On
FOR %v IN (?????.*) DO REN %v abc%v

If the old filenames all begin with the same character (and this is different from the first character of the prefix), that character can be included in the set to be renamed.

Example:
To add the characters "abc" to the beginning of each filename beginning with "pic...":
LFNFOR On
FOR %v IN (pic*.*) DO REN %v abc%v

If the extensions are all the same, a two stage process may be used.

In the first pass, the prefix is added and the extensions are changed;

In the second pass, the extensions are returned to the original.

Example:
To add the characters "abc" to the beginning of each filename (all having a ".txt" extension) in the current directory:
LFNFOR On
FOR %v IN (*.txt) DO REN %v abc%v.x
REN *.x *

Copy/Rename the files to a new temporary directory, delete the originals, and then move them back.

Example:
To add the characters "abc" to the beginning of each filename in the current directory:
MD TP
LFNFOR On
FOR %v IN (*.*) DO COPY %v TP\abc%v
DEL *.*
MOVE TP\*.*
RD TP

Files can be hidden as they are renamed and then unhidden when the renaming is complete. Unfortunately I cannot see a way of doing this from the command line, but the following batch file (closely based on one published by Tom Lavedas - Ref.1) seems reliable. See RenPrefix Explained for a detailed explanation.

::RenPrefix.bat adds any number of characters
::to the beginning of a filename
::Syntax -
::RENPREFIX files-to-be-renamed prefix-to-be-added
%4
LFNFOR On
FOR %%v IN (%1) DO CALL %0 %1 %2 %%v GOTO:Part2
ATTRIB -h %2%1
LFNFOR Off
GOTO End
:Part2
REN %3 %2%3
ATTRIB +h %2%3
:End

The above lines can be cut-and-pasted into Notepad or Edit and saved as "RenPrefix.bat" (or any other name you like). It is best to avoid saving it in the directory containing the files to be renamed - it stops working if it is renamed itself while it is being used!

Example:
To add "abc" to all filenames in the current folder.
RenPrefix *.* abc

Ignore the bug and repair any misnamed files afterwards. If any double renaming is going to be very obvious, and if the renaming process is not part of some other process/batch file, then checking through the names after a rename process might be the simplest way to go. Not very elegant, and the list must be checked, but there are usually only a few files (maybe 1 to 4) misnamed.

Adding a suffix

The REN-bug makes the procedure for adding a suffix to a filename rather more complicated than it should be. Theoretically, it should be possible to use the syntax:
REN *.* ??????????suffix.*
where: suffix is the suffix to be added, and the number of "?"s equals (or exceeds) the number of characters in the longest of the old filenames. However, although most files are renamed correctly, it is almost inevitable that some of the new names will meet the specification of the files-to-be-renamed and some may end up with a double suffix. Ways to circumvent the problem are:

When the old filenames are all the same length, the new name is specified with "?"s corresponding to the number of characters in the old filenames.

Example:
To add the characters "abc" to the end of each filename (all having just five characters) in the current directory:
REN *.* ?????abc.*

If the extensions are all the same, a two stage process may be used.

In the first pass, the suffix is added and the extensions are changed;

In the second pass, the extensions are returned to the original.

Example:
To add the characters "abc" to the end of each filename (all having a ".txt" extension) in the current directory:
REN *.txt ????????????????abc.txt.x
REN *.x *

Copy/Rename the files to a new temporary directory, delete the originals, and then move them back.

Example:
To add the characters "abc" to the end of each filename in the current directory (where the longest filename to be modified contains 16 characters or less):
MD TP
COPY *.* TP\????????????????abc.*
DEL *.*
MOVE TP\*.*
RD TP

Ignore the bug and repair any misnamed files afterwards. If any double renaming is going to be very obvious, and if the renaming process is not part of some other process/batch file, then checking through the names after a rename process might be the simplest way to go. Not very elegant, and the list must be checked, but there are usually only a few files (maybe 1 to 4) misnamed.

Removing characters from the beginning of a filename

Removing characters from the beginning of a set of filenames can be done using a quirk in the way Dos works with spaces on the command line. The following method is a distillation of several posts to newsgroups by Tom Lavedas (Refs 2 and 3) and works by first replacing the unwanted characters with spaces, and then dropping the spaces using a FOR...IN...DO construction. Whatever the actual length of the filenames, handling of long filenames by FOR must be enabled with LFNFOR On so that the spaces can be accepted as part of the filenames.

Example:

To remove the first two characters from the beginning of all filenames in the current directory:
REN *.* " *.*"
LFNFOR On
FOR %v IN (*.*) DO REN "%v" %v

Removing characters from the end of a filename

It is only possible to remove characters from the end of a filename if all of the new names are to be the same length. In this situation REN is used with the appropriate number of "?" characters.

Example:

To remove "report" from the files named "Jan-report.doc, ..., Dec-report.doc"
REN *.* ???.*

To remove the "l" from files with an ".html" extension to make them ".htm"
REN *.html *.???
(or REN *.html *.htm)

Adding/Removing characters to/from the middle of a filename

This is only possible when all the characters before or after the point of insertion are the same in all the names. The exercise then becomes one of:

Removing characters from the beginning/end of a filename (where this is possible)

Adding a new prefix/suffix as required.

Examples:

To add a "d" after the "c" in "abc1.txt ... abc65.txt":
REN abc*.* " *.*"
LFNFOR On
FOR %v IN (" *.*") DO REN "%v" %v
FOR %v IN (*.txt) DO REN %v abcd%v.x
REN *.x *

To add a "Sales" before the "Report" in "Jan-Report.doc .... Dec-Report.doc":
REN ??????????.doc ????SalesReport.doc

Renaming files with names that are already in use

To rename files when files with the new name already exist in the same directory it is necessary to use the COPY and DEL commands.

Example:
To rename all ".doc" files in the current directory with ".bak" extensions when previous .bak versions already exist:
COPY *.doc *.bak /Y
DEL *.doc
The /Y switch for COPY suppresses the prompt for confirmation before overwriting files. If these lines are part of a batch file, this switch is not necessary.

Renaming files as a numbered series

The following procedure will rename all files in the current directory, whatever their names, in a sequentially numbered list. The order of the files in the list is best described indeterminate and depends on the order in which the files are processed by the REN *.* command. This is (perhaps?) the order the files are stored in the FAT but is unlikely to be anything simple like alphabetical, or even by date of creation.

Prefix all files with 6 filler characters to force DOS to assign each with a short filename with the same initial characters using an appropriate method;

Change the longfilenames to be the same as the short ones by renaming the files to the same name using a FOR...IN...DO REN construction with LFNFOR Off.

Rename the files replacing the "~" with a "0";

Replace the filler characters as required.

Example:
To rename all the 45 graphics files named "dog.gif, cat.gif, etc." in a numbered sequence of "pet001.gif" to "pet045.gif":

LFNFOR On
FOR %v IN (*.gif) DO REN %v xxxxxx%v.x  
REN *.x *
Rename all files with 6 "x"s as a prefix. Note that the short filenames for the files are now "xxxxx~01.gif", "xxxxx~02.gif", etc. The extension had to be changed to avoid problems with the REN-bug.

LFNFOR Off
FOR %v IN (*.*) DO REN %v %v
Without long filename support, FOR renames the files to their same (short) name.

REN *.gif " pet0??.gif
REN " pet0~?.gif" " pet00?.gif"
In two passes renames the files to replace the "x"s with two spaces followed by "pet" followed by the old dos shortname number. The second pass is needed for the numbers 1 to 9. (If there had been 100-999 files, a third pass would have been required, etc.).

LFNFOR On
FOR %v IN (" *.*") DO REN "%v" %v
Drop the leading spaces in the filename (see Removing characters from the beginning of a filename).

Renaming files with a date stamp

This must be one of the most frequently asked questions in the various Dos related newsgroups!

Although I am sure that it is possible to rename files to include either the current date or the file-last-modified date, the only way to do this in pure Dos would be with a complex batch file.

A recent (Feb '00) discussion on this subject in news:alt.msdos.batch generated a consensus that this was simply not a worthwhile exercise. There are a number of freeware/shareware programs (see Links) available that can be used either as standalone utilities or incorporated into a batch file for a custom application. I have no experience in using any of these.

References

Ref.#
From
Title
Newsgroup
Date

1
Tom Lavedas
Re: Renaming multiple files (Dos7)
comp.os.msdos.misc
01/11/99

2
Tom Lavedas
Re: Renaming files
alt.msdos.batch
21 Jan 2000

3
Tom Lavedas
Re: Ren "longfilenames"
alt.msdos.batch
17 Dec 1999

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
February 12, 2000.

Using Doskey

Doskey has 3 main functions:

Editing the Command Line.

Recalling previous Command Line entries.

Creating Macros (assigning Command Line entries to specified keystrokes).

Once Doskey has been loaded, it runs as a TSR program with no distinctive interface. However, it is very useful when doing anything more than the absolute minimum from the Command Prompt.

Editing the Command Line

Plain Dos stores the last command executed and this can be recalled in its entirety using F3 or character by character with the left and right cursor keys. Plain Dos also allows limited command line editing using a simple, if somewhat idiosyncratic, use of the Insert, Delete, and left/right cursor keys.

DOSKEY considerably expands on this capability, allowing the Command Line to be edited in much the same way as with any other simple line editor. The left/right cursor keys move the cursor back and forth along the line and characters can be inserted and deleted using normal keyboard techniques - bearing in mind that DOSKEY is in overstrike mode by default. For those who are accustomed to editing in "Insert" mode by default, the /i switch should be used as a matter of course when invoking or reloading DosKey.

Recalling Previous Commands

As commands are entered on the Command Line, DOSKEY stores them in a buffer as a sequential list. Commands stored in the buffer can be retrieved in several ways:

Use the [Up] cursor key to scroll back through the list and the [Down] key to scroll forward. Each press of the up/down key displays the previous/subsequent command on the Command Line.

F7 will display a numbered list of all the commands stored in the buffer. F9 + the command number will display the specified command on the Command Line.

Entering one or more characters followed by F8 will display the most recent command beginning with those characters. Pressing F8 again will display the next most recent command beginning with the same characters, and so on.

Notes:

The [Esc] key will clear the Command Line at any time.

A command can be added to the list without actually executing it by typing the command followed by F5.

Should the buffer be filled, the oldest command(s) are displaced from the list. This affects the "Command Number" as displayed using F7 and used with F9. The default buffer size is 512 bytes - sufficient for around 10 to 20 commands (depending on their complexity). Whilst this is usually fine for normal use, an alternative buffer size can be specified using the /b:buffersize switch.

Creating and Using Macros

A DosKey macro comprises one or more Dos commands assigned to a name - which can be any series of characters entered from the keyboard. A very simple macro could assign the command XCOPY c:\data\docs\*.* a: /s to X. Entering X would be exactly equivalent to entering XCOPY c:\data\docs\*.*.

A number of special keys have been designated that allow macros to include multiple commands, user input, and generally incorporate much of the power of batch files.

To create a macro, enter DOSKEY Macroname=Text where Macroname is the series of characters used to call the macro (X in the above example) and Text comprises the command(s) to be listed.

To delete a macro, enter DOSKEY Macroname= or use Alt-F10 to delete all macro definitions stored in the buffer. Entering DOSKEY /R will also clear the buffer of all macros and any stored command lines.

To display a list of macros stored in the buffer, use DOSKEY /M.

Macros are stored in the buffer along with the command line history. The default size for the buffer is 512 bytes (enough for some 10-20 commands/macros) which may be insufficient if several complex macros are to be set up. To provide more room, DosKey can be invoked with a buffer of 1K (or whatever) using the /B switch, eg. DOSKEY /B:1024. However, if DosKey is already running, it must be reloaded (with the /R switch) when changing the buffer size - ie. the previous command would be DOSKEY /R /B:1024 and any macros and/or commands in the old buffer will be lost. Note also that memory allocated to the buffer is not available for use by other programs so it is generally advisable not to specify a larger buffer than is actually required.

DosKey Macro Special Characters

For some reason DosKey macros will not interpret the pipe and redirection symbols used by Dos. To include such symbols in a macro, it is necessary to use certain special characters:

DosKey Special Character
Function

$G
Redirect output from a command to a file or device - equivalent to the > command line symbol.

$G$G
Append output from a command to the specified file - equivalent to the >> command line symbol.

$L
Input to the command is from the specified file or device - equivalent to the < command line symbol.

$B
Pipes the output from one command to be used as input to another - equivalent to the | command line symbol.

$T
Used to designate a Carriage Return/Line Feed between commands in a multiple line macro.

$$
Just in case you should ever want to include a $ sign in a macro.

Variables and User Input

Under normal circumstances, entering a macro name displays that name on the command line, and pressing [Enter] causes the macro to run. If a macro called D referred to the command DIR, for example, entering D A: runs DIR not DIR A:. In other words, any added text is ignored.

The DosKey replaceable parameters ($1 to $9) allow a macro to have up to 9 parameters which are used similarly to batch file variables. In the example above, the command assigned to D would be DIR $1 (DOSKEY D=DIR $1). When calling the macro, it would be possible to add a drive letter as a parameter and D A: would be interpreted as DIR A:. If the parameter was omitted, the command would be interpreted simply as DIR.

In another example, illustrating the use of two variables, the command DIR path > file/device is assigned to a macro called D2F:
DOSKEY D2F=DIR $1 $g $2
where $1 corresponds to the path parameter, and $2 is for the file/device parameter. This macro might be invoked something like D2F C:\data dirdata.txt. If the first DIR parameter is not required (because it refers to the current directory), it is necessary to use a comma so that D2F can recognise the dirdata.txt as parameter $2 rather than $1.

Unfortunately, although a parameter can be a long filename, it cannot include spaces, even if enclosed in inverted commas. If a filename includes spaces, it is necessary to use the 8.3 version of the name. I know of no work around to this.

DosKey macros can also use S* which is termed a "global replaceable parameter". This must be the last part of a macro and is replaced by whatever is on the command line that is not the macro name or assigned to numbered parameters. If the above example was rewritten as:
DOSKEY D2F=DIR $1 $g $*
then long filenames-with-spaces could be used as the final parameter - but the path name used as a substitute for $1 still could not contain directory names with spaces.

Naming Macros

A macro name can comprise any one or more of the letters, numbers, or symbols available on a standard keyboard - so long as they display on the screen.

Names are not case sensitive, and cannot include spaces.

Ctrl + a letter key will usually be valid but some combinations have special significance and are not acceptable. Note: before using any Ctrl keys for names, see the caveat below!

It is not uncommon to create macros which include a single Dos command along with a number of almost-always-used switches and then to name the macro with the base command name. For example, if copying lots of disks using DISKCOPY and always use the parameters A: B:, it is quite reasonable to prepare a macro DISKCOPY A: B: and call it DISKCOPY. Entering DISKCOPY would then actually play DISKCOPY A: B:. If you ever need to actually copy from B: to A:, preceding the command with a space negates the macro and allows full control of the Dos command. This technique can be used both as a time saver and to add one more safety net with some commands - FORMAT comes to mind.
Although it is possible to use a macro to "set the switches" on all commands, sometimes this can also be done using environmental variables (eg. with DIR and COPY). This is generally the preferred route as it takes no buffer space.

It is not possible to create a macro in DosKey named "/?", for example, because Doskey reads this as a switch before thinking if it could be a macro name. However, if you really want to name a macro "/?", this can be done in a text editor and retrieved as described below.

Saving Macro Collections

Because macros are stored in the buffer, it follows that they are lost when the Dos session is ended or if Doskey is reloaded with DOSKEY /R. To save macros across sessions, the list of macros can be redirected to a text file which can be retrieved when required. Thus:
DOSKEY /M > macros.txt
will save the current macros to a text file called "macros.txt". In a later session, these macros can be retrieved using:
DOSKEY /F:macros.txt

Using this procedure makes it easy to have several collections of macros that would be used for specific activities - perhaps one "general purpose" set, a "disk maintenance" set, and so on. Each set being stored in a different text file. Note that retrieving a file of macros adds them to whatever is currently in the buffer, so the "disk maintenance" set does not need to duplicate any of the commands in the "general purpose" set - so long as none of the macros have the same name.

It follows that sets of DosKey macros could be created directly with a text editor.

CAVEAT!! Naming a macro using Ctrl-G is no problem and it will be recalled just as one would expect. BUT when the keystroke Ctrl-G is saved to a text file, it is saved as ^G (carat + G). When the file is retrieved, ^G is NOT converted back to Ctrl-G and the macro can no longer be recalled using Ctrl-G. Bit of a nuisance.

Macros V. Batch Files

Although there is considerable overlap in functionality of DosKey macros and batch files, deciding which route to follow is usually based on the following criteria:

Macros are stored in RAM and batch files on disk. It follows that macros will execute faster than batch files.

Even allocating a few Ks of conventional/upper memory to Doskey may adversely affect the operation of other programs.

Batch programs can be much more complex than macros.

Glossary

Buffer

An area of RAM set aside for storing data. A buffer has a fixed size (that can usually be specified) and a fixed location (allocated by Dos).

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.

Using FDISK - The Screens

This (rather long) page is devoted to illustrating the various FDISK screens.

FAT16/FAT32

If your version of Win95 supports FAT32, and if your hard disk is 512 MB or more, the first screen that appears asks:

Your computer has a disk larger than 512 MB. This version of Windows includes improved support for large disks, resulting in more efficient use of disk space on large drives, and allowing disks over 2 GB to be formatted as a single drive.

IMPORTANT: If you enable large disk support and create any new drives on this disk, you will not be able to access the new drive(s) using other operating systems, including some versions of Windows 95 and Windows NT, as well as earlier versions of Windows and MS-DOS. In addition, disk utilities that were not designed explicitly for the FAT32 file system will not be able to work with this disk. If you need to access this disk with other operating systems or older disk utilities, do not enable large drive support.

Do you wish to enable large disk support (Y/N)...........? [N]

This is your only opportunity to create a FAT32 system using the standard Win95 utilities. The relative merits of FAT32 v. FAT16 are discussed in detail by others and I'll not reiterate here. Suffice to say that:

FAT32 makes more efficient use of disk space - especially with larger disks (> 512 MB).

As stated in the warning above, disk utilities not designed explicitly for the FAT32 file system will not work with this disk.

DriveSpace does not work with FAT32.

The Opening Screen: FDISK Options

When FDISK is run (without any switches), the following screen is displayed:

C:\> fdisk

                       Microsoft Windows 95
                     Fixed Disk Setup Program
              (C)Copyright Microsoft Corp. 1983 - 1995

                          FDISK Options

Current fixed disk drive:  1

Choose one of the following:

1. Create DOS partition or Logical DOS Drive
2. Set active partition
3. Delete partition or Logical DOS Drive
4. Display partition information
5. Change current fixed disk drive

Enter choice (1)

Press Esc to exit FDISK

(If the machine has only one hard drive, option 5 is omitted).

1. Create DOS partition or Logical DOS Drive

FDISK requires that Disk 1 contains one Primary Partition and this must be the first partition created. Disk 1 may also contain one Extended Partition. Other disks may contain Primary and/or Extended Partitions. An Extended Partition may contain one or more Logical Dos Drives. FORMAT will not recognised an Extended Partition - only those Logical DOS Drives specified within it.

             Create DOS Partition or Logical DOS Drive

Current fixed disk drive: 1

Choose one of the following:

1. Create Primary DOS Partition
2. Create Extended DOS Partition
3. Create Logical DOS Drive(s) in the Extended DOS Partition

Enter choice (1)

Press Esc to return to FDISK Options

1. Creating a Primary DOS Partition

                      Create Primary DOS Partition

Current fixed disk drive: 1

Do you wish to use the maximum available size for a Primary DOS Partition
and make the partition active (Y/N) ........................[Y]

Press Esc to continue

If you press Enter at this point, FDISK simply creates a single primary active partition the full size of the disk.

On the other hand, if you enter [N], you will be presented with something like:

                      Create Primary DOS Partition

Current fixed disk drive: 1

Total disk space is 1610 Mbytes (1 Mbyte = 1048576 bytes)
Maximum space available for partition is 1610 Mbytes (100%)

Enter partition size in Mbytes or percent of disk space (%) to
create Primary DOS Partition ..................................: [1610]

No partitions defined

Press Esc to return to FDISK Options

To create a partition of 600 MB (for example), enter "600" (or "37%") at the prompt. The next screen will show:

                   Create Primary DOS Partition

Current fixed disk drive: 1

Partition  Status   Type    Volume Label  Mbytes   System   Usage
C: 1               PRI DOS                 600     UNKNOWN    37%

Primary DOS Partition created

Press Esc to continue

Pressing ESC takes you to the main FDISK Options screen which now contains the warning:

WARNING! No partitions are set active - disk1 is not startable unless
a partition is set active

Note: The "System" is "UNKNOWN" until the Partition/Drive is formatted after which it will be listed as "FAT16" (or, presumably, "FAT32" if using the OEM release of Win95).

2. Creating an Extended DOS Partition

                      Create Extended DOS Partition

Current fixed disk drive: 1

Partition  Status   Type    Volume Label  Mbytes   System   Usage
 C: 1              PRI DOS                  600   UNKNOWN     37%

Total disk space is 1610 Mbytes (1 Mbyte = 1048576 bytes)
Maximum space available for partition is 1010 Mbytes ( 63%)

Enter partition size in Mbytes or percent of disk space (%) to
create an Extended DOS Partition .............................: [1010]

Press Esc to return to FDISK Options

Accepting the default (in this case 1010 Mb) leads to:

                      Create Extended DOS Partition

Current fixed disk drive: 1

Partition  Status   Type    Volume Label  Mbytes   System   Usage
 C: 1              PRI DOS                  600   UNKNOWN     37%
    2              EXT DOS                 1010   UNKNOWN     63%

Extended DOS Partition created

Press Esc to continue

Pressing Esc takes you straight to Creating Partitions - section 3 (Creating Logical Drives)

Note: Entering any figure other than the default will lead to wasted space (unless some other operating system can use this) because FDISK only allows one primary and/or one extended partition on a disk. If less than 100% of total disk space is allocated to the primary and extended partition, then that's it as far as DOS is concerned.

3. Creating Logical DOS Drive(s) in the Extended DOS Partition

If the Extended Partition is empty, the following screen is displayed:

     Create Logical DOS Drive(s) in the Extended DOS Partition

No logical drives defined

Total Extended DOS Partition size is 1010 Mbytes (1 Mbyte = 1048576 bytes)
Maximum space available for logical drive is 1010 Mbytes (100%)

Enter logical drive size in Mbytes or percent of disk space (%)...[1010]

Press Esc to return to FDISK Options

Accepting the default results in a single logical drive occupying all the space available in the Extended Partition. On the other hand, entering "262" (for example) results in:

     Create Logical DOS Drive(s) in the Extended DOS Partition

Drv  Volume Label  Mbytes   System   Usage
D:                  260     UNKNOWN    26%

Total Extended DOS Partition size is 1010 Mbytes (1 Mbyte = 1048576 bytes)
Maximum space available for logical drive is 748 Mbytes ( 74%)

Enter logical drive size in Mbytes or percent of disk space (%)... [748]

Logical DOS Drive created, drive letters changed or added

Press Esc to return to FDISK Options

When all the Extended Partition has been assigned to Logical DOS Drives, a screen such as below is displayed:

     Create Logical DOS Drive(s) in the Extended DOS Partition

Drv  Volume Label  Mbytes   System   Usage
D:                  260     UNKNOWN    26%
E:                  250     UNKNOWN    25%
F:                  250     UNKNOWN    25%
G:                  250     UNKNOWN    25%

All available space in the Extended DOS Partition
is assigned to logical drives

Press Esc to continue

Pressing ESC returns you to the main FDISK Options menu (with the warning that no partition has been set active).

2. Set active partition

Although a partition is usually designated active while partitioning a hard disk for the first time, this is not essential and an active partition can be set up or changed at any time.

                       Set Active Partition

Current fixed disk drive: 1

Partition  Status   Type    Volume Label  Mbytes   System   Usage
 C: 1              PRI DOS                  600   UNKNOWN     37%
    2              EXT DOS                 1010   UNKNOWN     63%

Total disk space is 2012 Mbytes

Enter the number of the partition you want to make active...........: [ ]

Press Esc to return to FDISK Options

Although no default is presented, there is only one option: 1. Entering this gives:

                          Set Active Partition

Current fixed disk drive: 1

Partition  Status   Type    Volume Label  Mbytes   System   Usage
 C: 1         A    PRI DOS   PROGRAMS       500   FAT16       25%
    2              EXT DOS                 1514               75%

Total disk space is 2012 Mbytes (1 Mbyte = 1048576 bytes)

Partition 1 made active

Press Esc to continue

Trying to make a partition active on another drive causes an error message:

                          Set Active Partition

Current fixed disk drive: 2

Only partitions on Drive 1 can be made active.

Press Esc to continue

3. Delete partition or Logical DOS Drive

Note: If FDISK is being run from a DOS box in Windows, my experiments indicate that sometimes a partition can be deleted and sometimes it can't. At this stage I would say FDISK's behaviour in this situation is erratic. If you really want to delete a partition, first prepare an emergency startup floppy disk; then boot the computer and run FDISK from this. If you are merely experimenting, don't assume FDISK won't remove the partition from which it was loaded - it probably won't but you could find yourself in a bit of a mess!

               Delete DOS Partition or Logical DOS Drive

Current fixed disk drive: 1

Choose one of the following:

1.  Delete Primary DOS Partition
2.  Delete Extended DOS Partition
3.  Delete Logical DOS Drive(s) in the Extended DOS Partition
4.  Delete Non-DOS Partition

Enter choice: [ ]

Press Esc to return to FDISK Options

1. Deleting a Primary Partition

Note: A Primary Partition cannot be deleted until any Extended Partition has been deleted.

                      Delete Primary DOS Partition

Current fixed disk drive: 1

Partition  Status   Type    Volume Label  Mbytes   System   Usage
 C: 1         A    PRI DOS   PROGRAMS       500   FAT16       25%

Total disk space is 2012 Mbytes (1 Mbyte = 1048576 bytes)

WARNING! Data in the deleted Primary DOS Partition will be lost.
What primary partition do you want to delete..? [1]

Press Esc to return to FDISK Options

As there is only one primary partition permitted on a drive, this would seem to be something of a trick question probably designed to slow you down more than anything else. If an Extended Partition is still present, the same question is asked but any answer results in an error message explaining that the Extended Partition must be deleted before the Primary one.

2. Deleting an Extended Partition

An Extended Partition cannot be deleted until all Logical Drives within it have been deleted (see option 3).

                      Delete Extended DOS Partition

Current fixed disk drive: 1

Partition  Status   Type    Volume Label  Mbytes   System   Usage
 C: 1         A    PRI DOS   PROGRAMS       500   FAT16       25%
    2              EXT DOS                 1514               75%

Total disk space is 2012 Mbytes (1 Mbyte = 1048576 bytes)

Cannot delete Extended DOS Partition while logical drives exist.

Press Esc to continue

3. Deleting Logical DOS Drive(s) in the Extended DOS Partition

       Delete Logical DOS Drive(s) in the Extended DOS Partition

Drv Volume Label  Mbytes  System  Usage
E:  DATA            500  FAT16      33%
F:  COREL           500  FAT16      33%
G:  GRAPHICS        514  FAT16      34%

    Total Extended DOS Partition size is 1514 Mbytes (1 MByte = 1048576 bytes)

    WARNING! Data in a deleted Logical DOS Drive will be lost.
    What drive do you want to delete...............................? [ ]

    Press Esc to return to FDISK Options

After entering the appropriate drive letter, a confirmation line will be displayed asking for the Volume Name. If there is no name displayed, press Enter. A final warning and request for confirmation will be displayed before the drive is actually deleted. Once the drive is gone, the above screen is redisplayed (without the line for the drive that has been deleted) with a note that
"Drive letters have been changed or deleted".

4. Delete Non-DOS Partition

Presumably this option lets one delete partitions created and formatted for other operating systems (such as Unix or OS/2). I have no experience with this.

4. Display partition information

There are two ways to view partition information using FDISK:

1. Selecting option 4 from the opening menu:

                 Display Partition Information

Current fixed disk drive: 1

Partition  Status   Type    Volume Label  Mbytes   System   Usage
 C: 1         A    PRI DOS   PROGRAMS       500   FAT16       25%
    2              EXT DOS                 1514               75%

Total disk space is 2012 Mbytes (1 Mbyte = 1048576 bytes)

The Extended DOS Partition contains Logical DOS Drives.
Do you want to display the logical drive information (Y/N)......?[Y]

Press Esc to return to FDISK Options

The information presented is generally self-explanatory. The above example is for a 2Gb hard drive divided into a primary partition of 500Mb (which is active), and an extended partition of 1500Mb.

Entering "Y" to display logical drive information will display something like:

               Display Logical DOS Drive Information

Drv Volume Label  Mbytes  System  Usage
E:  DATA            500  FAT16      33%
F:  GRAPHICS        500  FAT16      33%
G:  DOWNLOADS       514  FAT16      34%

    Total Extended DOS Partition size is 1514 Mbytes (1 MByte = 1048576 bytes)

    Press Esc to continue

2. Starting FDISK with the /STATUS switch.

C:\> fdisk /status

                 Fixed Disk Drive Status
  Disk   Drv   Mbytes   Free   Usage
    1           2012            100%
          C:     500
          E:     500
          F:     500
          G:     514
    2            204       2     99%
          D:     202

    (1 MByte = 1048576 bytes)

C:\>

In short, the information displayed using FDISK /STATUS is not quite as comprehensive, but covers all drives on one screen.

5. Change current fixed disk drive

If the machine contains more than one physical hard drive, these are numbered accordingly (starting at 1). When FDISK starts, it will, by default, be ready to work with hard drive #1. To work with a different drive, use option 5 in the main FDISK menu and enter the appropriate drive number.
Note: changing the "Current Fixed Disk Drive" does not have anything to do with making drives bootable, active, or anything else - it merely lets you work on the different drives with FDISK.

                       Change Current Fixed Disk Drive

Disk   Drv   Mbytes   Free   Usage
  1           2012            100%
        C:     500
        E:     500
        F:     500
        G:     514
  2            204       2     99%
        D:     202

  (1 MByte = 1048576 bytes)
  Enter Fixed Disk Drive Number (1-2).......................[1]

  Press Esc to return to FDISK Options

Exiting FDISK

Depending on exactly where you are in FDISK, the program can be closed by pressing ESC one or more times which will return you to the DOS prompt. If any changes have been made, FDISK closes with the instruction:

You must restart your system for changes to take effect.
Shut down Windows before restarting.

A:\>_

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
November 1, 2000.

Ansi.sys - Entering "Escape Sequences"

Ansi.sys Main Page
The Commands
Keyboard Key Codes
Index

Once Ansi.sys has been loaded, it's various functions can be accessed at any time by sending one or more "Escape Sequences" to the screen. There are three ways to do this:

Using the PROMPT command along with the "$E" special character.
Although PROMPT can certainly be used from the command line to enter Escape Sequences on the fly, it is most often used in Autoexec.bat to set the screen colours along with the actual Dos prompt. It can also be used in batch files to construct fancy menus in different colours. The syntax is:

PROMPT $E[Code

Multiple sequences can be entered by simply stringing them together (ie. PROMPT will accept any number of parameters):

PROMPT $E[Code1 $E[Code2 $E[Code3
Note: Spaces between the sequences make them easier to decipher but are not required.

If you are using the standard prompt, include $P$G in the PROMPT string or you will be left simply with a flashing cursor. If you are using a non-standard prompt, you might want to save this so that it can be restored when required:

SET PT=%prompt%
PROMPT $E[Code1 $E[Code2 $E[Code3 %PT%

When screen colours, keyboard mappings, etc. are changed in this way, the effects stay in force until changed again (or the system is re-booted). Entering PROMPT $P$G will not restore the default colours/attributes.

ECHO an Escape Sequence to the screen.

The procedures for using ECHO depends on whether you are using a batch file or working directly from the command line. In a batch file, one or more ECHO statements can be compiled into a list using EDIT. The "Escape character" (ASCII 27) is entered by pressing Ctrl+P followed by the "ESC" key and displays as ASCII 27. The codes are set by running the batch file from the command line or calling it from another batch file (eg. Autoexec.bat).

Using the ECHO method from the command line is (slightly) more complicated because the first character (ASCII 27 or "ESC") is interpreted as an instruction to "clear the command line" which doesn't get you very far. This is a real nuisance and seems to be the result of a conflict between two sets of conventions originating way back in history. Along with some other very useful notes, Bob Blackledge wrote:

ANSI.SYS is MicroSoft's implementation of the ANSI X3.64 standard "Control Sequences for Video Terminals and Peripherals" (dating from 1976 or thereabouts, and also defined in ISO DP-6429, ECMA-35 and probably other standards organizations around the world like IEC).

ANSI (and the standard) defining the use of the ESC character as part of a Control Sequence Introducer (CSI) to expand the scope of the originally defined 7-bit ASCII character set (later extended to the 8-bit character set we enjoy today) into multi-character sequences, existed before MicroSoft Corp really did. Microsoft's implementation is a subset of the standard, but well, pretty poor. Most terminals in existence even at that time implemented a more complete subset of the standard (such as DEC's classic VT100).

Several standardized escape sequences are defined (and even more were created for proprietary usage and not standardized) but the sequence ESC followed by [ is the most often defined. Microsoft limited themselves to these commands exclusively.

Anyway, the way round this is to create an environmental variable (say "ESC") comprising just the ASCII 27 character. This is done by creating a batch file (Esc.bat, say) in EDIT that has the one line:

SET ESC=ASCII 27

where ASCII 27 is entered by pressing Ctrl+P followed by the "ESC" key. After running Esc.bat, ASCII 27 can be entered on the command line by entering %ESC% in its place. For example, to assign the character "¼" to Alt-4 one could enter:

ECHO %ESC%[0;123;172p

Sending a text file containing a series of Escape Sequences to the screen.
A file is created in EDIT that contains one or more Ansi.sys commands and this is copied to the screen using the TYPE filename or COPY filename CON commands. As mentioned before, the "Escape character" (ASCII 27) is entered by pressing Ctrl+P followed by the "ESC" key. To assign the character "½" to Alt-2 and "¼" to Alt-4 one could create a text file called "Fraction.ans" containing:

ASCII 27[0;121;171p
ASCII 27[0;123;172p

This assignment would be carried out by entering:

TYPE Fractions.ans

either at the command line or from within a batch file.

Although I have said that the ASCII 27 character should be inserted using EDIT, any text editor that has provision for entering "reserved/special" characters can, of course, be used. However, EDIT is the only one that I know to have this facility - I don't think any of the standard Win95/8 utilities let you do this (eg. Notepad, Sysedit, or the System Configuration Utility). If I hear of others, I will add them to the following table.

Text Editor
To enter the "ESC" character
Displays as:

EDIT
Ctrl-P followed by the "ESC" key
left arrow

Thanks to Bob Blackledge for his information on the "Environmental Variable" technique for entering the ASCII 27 character.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
November 11, 2000.

Ansi.sys - The Commands

Ansi.sys Main Page
Entering "Escape Sequences"
Keyboard Key Codes
Index

Once Ansi.sys has been loaded, it's various functions can be accessed at any time by sending one or more "Escape Sequences" to the screen. An Escape Sequence comprises three parts:

The Prefix
This is the two characters represented by ASCII 27 followed by ASCII 91. ASCII 27 is the character returned by the "ESC" key and is represented in the tables below by ASCII 27. ASCII 91 is the left hand square bracket "[".

The Codes
Depending on the actual command, these will be a series of numbers or characters that define the new screen colour, keyboard key, or whatever. The default code is 0 and, when that value is specified, can be omitted.

The Suffix
A single letter (case sensitive) that defines how Ansi.sys interprets the Codes. ie. whether the cursor is to be moved, a key to be reassigned or whatever.

Note that an "Escape Sequence" cannot be entered directly - see: Entering "Escape Sequences" for further details.

Setting Text and Background Colours

Colour
ANSI Code

Prefix
Text
Background
Suffix

Black
left arrow[
30
40
m

Red
31
41

Green
32
42

Yellow
33
43

Blue
34
44

Magenta
35
45

Cyan
36
46

White
37
47

Attribute
ANSI Code

Prefix
Code
Suffix

All attributes off
left arrow[
0
m

Bright characters
1

Underlined characters
4

Blinking characters
5

Reverse video characters
7

Hidden characters
8

Notes

A series of colour/attribute commands can be combined into one by separating the codes with semicolons.

Colour changes only take effect as each character is written following the Ansi command. To change the whole screen to the new colours, add the "2J" sequence to clear the screen (see under Miscellaneous, below) or simply enter CLS on the next line.

Examples

To change the colours to blinking bright green characters on a cyan background:

ECHO %ESC%[46m %ESC%[32m %ESC[5m %ESC%[1m %ESC%[2J
or, more efficiently:
ECHO %ESC%[46;32;5;1m
CLS

Cursor Positioning

Prefix
Code
Suffix
Cursor Position

left arrow[
r;c
H
Moves the cursor to line r and column c
If omitted, r and c both default to 0 (ie. the cursor moves to the top left corner of the screen)

f

n
A
Moves the cursor up n lines (or top of screen)

n
B
Moves the cursor down n lines (or bottom of screen)

n
C
Moves the cursor right n columns (or right hand side of screen)

n
D
Moves the cursor left n columns (or left hand side of screen)

s
Saves current cursor position

u
Restores cursor to previously saved position

Miscellaneous

Prefix
Code
Suffix
Effect

esc[
2
J
Clears the screen.¹

K
Clears from the cursor to the end of the line

=7
h
Enables line wrap

=7
l
Disables line wrap

Notes

These two groups of commands are primarily used for constructing page headers, footers and menus. See PROMPT for further notes and examples.

¹ Actually, the screen is cleared when the Code value is any integer (or is omitted).

To change the Display Mode:

Prefix
Code
Suffix
Text Mode

left arrow[
=0
h
40 cols
25 lines
Monochrome

=1
Colour

=2
80 cols
25 lines
Monochrome

=3
Colour

Prefix
Code
Suffix
Graphics Mode

left arrow[
=5
h
320 x 200
Monochrome

=4
4 Colour

=13
Colour

=19
256 Colour

=6
640 x 200
Monochrome

=14
16 Colour

=15
640 x 350
2 Colour

=16
16 Colour

=17
640 x 480
2 Colour

=18
16 Colour

Notes

I have no real experience with these modes but they rather look as though they are a hangover from the early days of Dos. I cannot think of any situation where changing display mode to one of the above values would be to any advantage.

Keyboard Layout Codes

Ansi.sys can be used to remap the keys of the keyboard. Any key can be redefined to any one or more characters of the extended ASCII character set.
Typical applications of this facility include:

Assignment of "non-standard" characters to unused keys

Assignment of text phrases to unused keys. This can include DOS commands.

Complete remapping of the keyboard - for special data entry functions or obscure foreign language use, perhaps.

Syntax

left arrow[keycode;stringp

keycode
The code(s) associated with the given key. Many keys use a code of two numbers separated by a semicolon and these must be used in full.

string

This can be:

The ASCII code for a single character;

The code associated with a key; or

a text string (of one or more characters) enclosed in inverted commas.

Notes

Most DOS programs (including EDIT) bypass the standard DOS calls when accepting keyboard input and so will ignore Ansi.sys reassignments.

Have a care when assigning environmental variables to a key as these will be parsed as they are fed to the screen. Thus, assigning "ECHO %ESC%[" to a key leaves you with just "[" as the "ECHO" is cleared from the command line by %ESC%. However, it is possible to assign two keys to this: the first is assigned "ECHO %ESC", and the second is assigned "%[". Pressing the two keys sequentially puts "ECHO %ESC%[" onto the command line.

Examples

To assign á to the Alt-A key:
ESC[0;30;160p

To disable Ctrl-C, assign it to ASCII 255 (Nul)
ESC[3;255p

To re-enable Ctrl-C, assign it back to 3:
ESC[3;3p

To assign "FOR %v IN ( ) DO " to Alt-F and have Alt-D append a directory listing of Drive D: to DirD.txt, you have several options including:

Use EDIT to create a file called "Keys.txt" containing the following lines:

Esc[0;33;"FOR %v IN ( ) DO "p
Esc[0;32;"DIR D: /S >> DirD.txt";13p
(where Esc is inserted using Ctrl-P followed by the "ESC" key).

Copy Keys.txt to the screen using either:
TYPE Keys.txt or
COPY Keys.txt CON

Or

Use EDIT to create "Keys.bat" containing the lines:
ECHO Esc[0;33;"FOR %v IN ( ) DO "p
ECHO Esc[0;32;"DIR D: /S >> DirD.txt";13p

Run the batch file by entering "Keys" at the command line prompt.

Either way, the keys will now be reassigned.

Thanks to Bob Blackledge for his advice on default Code values

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
November 11, 2000.

ANSI Keyboard Key Codes

Ansi.sys Main Page
Entering "Escape Sequences"
The Commands
Index

The following codes are assigned by Ansi.sys to the keys of a standard US layout 104 key PC keyboard in their various shifted states.

It seems that the "Win" key on newer keyboards acts very much as another shift key along with Shift, Alt, and Ctrl. I have no information whether Ansi.sys recognises key codes associated with it.

Much of the data in the following tables was obtained from DOS books of varying vintage. I have tested most of the codes with the Dos 7 version of Ansi.sys and all seem to work just fine.

If anyone can help fill the gaps, information would be much appreciated!

Alpha-numeric Keys

Key  Natural Shift   Ctrl     Alt

Key  Natural Shift   Ctrl     Alt

 A     97      65      1     0;30
 B     98      66      2     0;48
 C     99      67      3     0;46
 D    100      68      4     0;32
 E    101      69      5     0;18
 F    102      70      6     0;33
 G    103      71      7     0;34
 H    104      72      8     0;35
 I    105      73      9     0;23
 J    106      74     10     0;36
 K    107      75     11     0;37
 L    108      76     12     0;38
 M    109      77     13     0;50
 N    110      78     14     0;49
 O    111      79     15     0;24
 P    112      80     16     0;25
 Q    113      81     17     0;16
 R    114      82     18     0;19
 S    115      83     19     0;31
 T    116      84     20     0;20
 U    117      85     21     0;22
 V    118      86     22     0;47
 W    119      87     23     0;17
 X    120      88     24     0;45
 Y    12l      89     25     0;21
 Z    122      90     26     0;44

 0     48      41            0;129
 1     49      33      -     0;120
 2     50      64      0     0;121
 3     51      35      -     0;122
 4     52      36      -     0;123
 5     53      37      -     0;124
 6     54      94     30     0;125
 7     55      38      -     0;126
 8     56      42      -     0;127
 9     57      40      -     0;128

 '     39      34      -     0;40
 ,     44      60      -     0;51
 -     45      95     31     0;130
 .     46      62      -     0;52
 /     47      63      -     0;53
 ;     59      58      -     0;39
 =     61      43      -     0;131
 [     91     123     27     0;26
 \     92     124     28     0;43
 ]     93     125     29     0;27
 `     96     126      -     0;41

Function Keys

Key  Natural Shift  Ctrl    Alt

F1    0;59   0;84   0;94   0;104
F2    0;60   0;85   0;95   0;105
F3    0;61   0;86   0;96   0;106
F4    0;62   0;87   0;97   0;107
F5    0;63   0;88   0;98   0;108
F6    0;64   0;89   0;99   0;109
F7    0;65   0;90   0;100  0;110
F8    0;66   0;91   0;101  0;111
F9    0;67   0;92   0;102  0;112
F10   0;68   0;93   0;103  0;113
F11   0;133  0;135  0;137  0;139
F12   0;134  0;136  0;138  0;140

"Extended" Keys

Key   Natural  Shift    Ctrl      Alt

Ins   224;82  224;82  224;146  224;162
Del   224;83  224;83  224;147  224;163
Home  224;71  224;71  224;119  224;151
End   224;79  224;79  224;117  224;159
PgUp  224;73  224;73  224;132  224;153
PgDn  224;81  224;81  224;118  224;161
Up    224;72  224;72  224;141  224;152
Left  224;75  224;75  224;115  224;155
Right 224;77  224;77  224;116  224;157
Down  224;80  224;80  224;145  224;154

System Keys

Key      Natural  Shift   Ctrl     Alt

Esc         27      27     27       -
Backspace    8       8    127       0
Enter       13       -     10      0;28
Tab          9     0;15   0;148    0;165
Space       32      32     32       32
PrtSc        -       -    0;114     -
Pause/Break  -       -    0;0       -

Number Keypad

Key   Natural   Shift   Ctrl      Alt

1      0;79      49     0;117      -
2      0;80      50     0;145      -
3      0;81      51     0;118      -
4      0;75      52     0;115      -
5      0;76      53     0;143      -
6      0;77      54     0;116      -
7      0;71      55     0;119      -
8      0;72      56     0;141      -
9      0;73      57     0;132      -
.      0;83      46     0;147      -
0      0;82      48     0;146      -

Enter    13      -        10     0;166
/        47     47      0;142    0;74
*        42   0;144     0;78       -
-        45     45      0;149    0;164
+        43     43      0;150    0;55

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
November 18, 2000.

Rename Batch Files Explained

[REN main page] ["Renaming Multiple Files" page]

RenPrefix.bat

Formulating a general procedure for adding a prefix to a number of files in a single directory is made complicated by the REN-bug that allows some files to be renamed more than once if the renamed files meet the specification of the files-to-be-renamed in the REN command.

RenPrefix is a neatly constructed batchfile that sets the hidden attribute of each file in the specified group as it is renamed so that it cannot be re-renamed.

This batch file is slightly modified from the example given by Tom Lavedas in Re: Renaming multiple files (Dos7) from the newsgroup comp.os.msdos.misc dated 01/11/99.

::RenPrefix.bat adds any number of characters

::to the beginning of a filename

::Syntax -

::RENPREFIX files-to-be-renamed prefix-to-be-added

%4

LFNFOR On

FOR %%v IN (%1) DO CALL %0 %1 %2 %%v GOTO:Part2

ATTRIB -h %2%1

LFNFOR Off

GOTO End

:Part2

REN %3 %2%3

ATTRIB +h %2%3

:End

Explanation

Line   
What it does

1 - 4
Preamble

5
%4
Replaced by the 4th arguement of the batch file. When first called there are only two arguements so this line is ignored. When the batch recalls itself (in line 7) the 4th arguement is "GOTO:Part2" and this command is executed - ie. lines 6 to 10 are skipped. Note that the usual syntax for GOTO is GOTO Label without the colon, but this would be parsed as two arguments. The colon is accepted as a separator by GOTO but not when read as an arguement.

6
LFNFOR On
Long filename support for the subsequent FOR command is switched on.

7
FOR %%v IN (%1) DO CALL %0 %1 %2 %%v GOTO:Part2
This FOR...IN...DO construction cycles through the files specified by the "files-to-be-renamed" arguement. For each file it re-CALLs the parent batch file (%0) with four arguements: %1 and %2 are carried through from the arguements supplied initially (files-to-be-renamed and prefix-to-be-added); %3 is the current value of %v (ie. the file currently being processed by FOR); and %4 is the "GOTO:Part2" string.
What happens is that for each file specified in "files-to-be-renamed" a new instance of RenPrefix.bat is run but on reaching Line 5 control skips to Line 11, runs through the remaining commands and then ends. When all files have been processed, the first instance of the batch moves onto Line 8.

8
ATTRIB -h %2%1
After Line 7 has been completed, all specified files (%1) are renamed (to %2%1) and hidden. This line resets the "Hidden" attribute for all the renamed files.

9
LFNFOR Off
Resets long filename support for FOR to Off. This line is optional and depends on whether you prefer to have LFNFOR On or Off as your default.

10
GOTO End
Causes control to skip to :End

11
:Part2
Marks the start of the commands used by the child instances of the batch called in Line 7

12
REN %3 %2%3
Adds the specified prefix (%2) to the current file being processed in the FOR...IN...DO construction on Line 7 (%3 (= %v))

13
ATTRIB +h %2%3
Sets the hidden attribute on the renamed file. This file is now invisible to REN and so cannot be renamed again.

14
:End

Example:

To add "abc" to all filenames in the current folder.
RenPrefix *.* abc

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
February 12, 2000.

Extended ASCII Key Codes

ASCII   Hex  Keyboard   Dos         Dos
value  value  input   Display      Action
 000    00    Ctrl-@    ^C        Cancels current command
 001    01    Ctrl-A    ^A
 002    02    Ctrl-B    ^B
 003    03    Ctrl-C    ^C        Cancels current command
 004    04    Ctrl-D    ^D
 005    05    Ctrl-E    ^E
 006    06    Ctrl-F
 007    07    Ctrl-G    ^G
 008    08    Ctrl-H              Backspace
 009    09    Ctrl-I              Tab
 010    0A    Ctrl-J              Linefeed
 011    0B    Ctrl-K    ^K
 012    0C    Ctrl-L    ^L
 013    0D    Ctrl-M              Enter
 014    0E    Ctrl-N    ^N
 015    0F    Ctrl-O    ^O

ASCII   Hex  Keyboard   Dos         Dos
value  value  input   Display      Action
 016    10    Ctrl-P              Toggle output to PRN
 017    11    Ctrl-Q    ^Q
 018    12    Ctrl-R
 019    13    Ctrl-S
 020    14    Ctrl-T    ¶
 021    15    Ctrl-U    §
 022    16    Ctrl-V    ^V
 023    17    Ctrl-W    ^W
 024    18    Ctrl-X    ^X
 025    19    Ctrl-Y    ^Y
 026    1A    Ctrl-Z    ^Z
 027    1B    Ctrl-[             Esc
 028    1C    Ctrl-\    ^\
 029    1D    Ctrl-]    ^]
 030    1E    Ctrl-^    ^^
 031    1F    Ctrl-_    ^_

ASCII  Hex    Display
value value
 032    20    Space
 033    21    !
 034    22    "
 035    23    #
 036    24    $
 037    25    %
 038    26    &
 039    27    '
 040    28    (
 041    29    )
 042    2A    *
 043    2B    +
 044    2C    ,
 045    2D    -
 046    2E    .
 047    2F    /

ASCII  Hex    Display
value value
 048    30    0
 049    31    1
 050    32    2
 051    33    3
 052    34    4
 053    35    5
 054    36    6
 055    37    7
 056    38    8
 057    39    9
 058    3A    :
 059    3B    ;
 060    3C    <
 061    3D    =
 062    3E    >
 063    3F    ?

ASCII  Hex    Display
value value
 064    40    @
 065    41    A
 066    42    B
 067    43    C
 068    44    D
 069    45    E
 070    46    F
 071    47    G
 072    48    H
 073    49    I
 074    4A    J
 075    4B    K
 076    4C    L
 077    4D    M
 078    4E    N
 079    4F    O

ASCII  Hex    Display
value value
 080    50    P
 081    51    Q
 082    52    R
 083    53    S
 084    54    T
 085    55    U
 086    56    V
 087    57    W
 088    58    X
 089    59    Y
 090    5A    Z
 091    5B    [
 092    5C    \
 093    5D    ]
 094    5E    ^
 095    5F    _

ASCII  Hex    Display
value value
 096    60    `
 097    61    a
 098    62    b
 099    63    c
 100    64    d
 101    65    e
 102    66    f
 103    67    g
 104    68    h
 105    69    i
 106    6A    j
 107    6B    k
 108    6C    l
 109    6D    m
 110    6E    n
 111    6F    o

ASCII  Hex    Display
value value
 112    70    p
 113    71    q
 114    72    r
 115    73    s
 116    74    t
 117    75    u
 118    76    v
 119    77    w
 120    78    x
 121    79    y
 122    7A    z
 123    7B    {
 124    7C    |
 125    7D    }
 126    7E    ~
 127    7F    Del

ASCII  Hex    Display
value value
 128    80    Ç
 129    81    ü
 130    82    é
 131    83    â
 132    84    ä
 133    85    à
 134    86    å
 135    87    ç
 136    88    ê
 137    89    ë
 138    8A    è
 139    8B    ï
 140    8C    î
 141    8D    ì
 142    8E    Ä
 143    8F    Å

ASCII  Hex    Display
value value
 144    90    É
 145    91    æ
 146    92    Æ
 147    93    ô
 148    94    ö
 149    95    ò
 150    96    û
 151    97    ù
 152    98    ÿ
 153    99    Ö
 154    9A    Ü
 155    9B    ¢
 156    9C    £
 157    9D    ¥
 158    9E    Pt
 159    9F    f

ASCII  Hex    Display
value value
 160    A0    á
 161    A1    í
 162    A2    ó
 163    A3    ú
 164    A4    ñ
 165    A5    Ñ
 166    A6    a
 167    A7    o
 168    A8    ¿
 169    A9    ¬
 170    AA    ##
 171    AB    ½
 172    AC    ¼
 173    AD    ¡
 174    AE    «
 175    AF    »

ASCII  Hex    Display
value value
 176    B0    ##
 177    B1    ##
 178    B2    ##
 179    B3    ##
 180    B4    ##
 181    B5    ##
 182    B6    ##
 183    B7    ##
 184    B8    ##
 185    B9    ##
 186    BA    ##
 187    BB    ##
 188    BC    ##
 189    BD    ##
 190    BE    ##
 191    BF    ##

ASCII  Hex    Display
value value
 192    C0    ##
 193    C1    ##
 194    C2    ##
 195    C3    ##
 196    C4    ##
 197    C5    ##
 198    C6    ##
 199    C7    ##
 200    C8    ##
 201    C9    ##
 202    CA    ##
 203    CB    ##
 204    CC    ##
 205    CD    ##
 206    CE    ##
 207    CF    ##

ASCII  Hex    Display
value value
 208    D0    ##
 209    D1    ##
 210    D2    ##
 211    D3    ##
 212    D4    ##
 213    D5    ##
 214    D6    ##
 215    D7    ##
 216    D8    ##
 217    D9    ##
 218    DA    ##
 219    DB    ##
 220    DC    ##
 221    DD    ##
 222    DE    ##
 223    DF    ##

ASCII  Hex    Display
value value
 224    E0    alpha
 225    E1    ß
 226    E2    gamma
 227    E3    pi
 228    E4    SIGMA
 229    E5    sigma
 230    E6    µ
 231    E7    tor
 232    E8    phi
 233    E9    THETA
 234    EA    OMEGA
 235    EB    delta
 236    EC    infinity
 237    ED    ø
 238    EE    Sigma
 239    EF    sigma

ASCII  Hex    Display
value value
 240    F0    =
 241    F1    ±
 242    F2    >
 243    F3    <
 244    F4    ^^
 245    F5    ^^
 246    F6    ÷
 247    F7    ^^
 248    F8    °
 249    F9    lg bullet
 250    FA    sm bullet
 251    FB    sq rt
 252    FC    n
 253    FD    ²
 254    FE    ##
 255    FF

Notes:

Unfortunately some of the symbols I would like to show on this chart cannot be represented using HTML. In due course I will try making the 100 odd gifs required to show them. In the meantime:
## indicates a "line drawing" character
^^ indicates a "mathematical" symbol, and
where practicable I have used the names of the characters in italics.

This list relates to CodePage 437 (United States). Different CodePages will include different characters - especially in the extended area (above ASCII 127). I will add these lists in due course.

If you should have any comments or suggestions,
please contact: Bob Watson.
This page last revised:
December 9, 1999.