ANSI.SYS

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Defines functions that change display graphics, control cursor movement, and reassign keys. The ANSI.SYS device driver supports ANSI terminal emulation of escape sequences to control your system's screen and keyboard. An ANSI escape sequence is a sequence of ASCII characters, the first two of which are the escape character (1Bh) and the left-bracket character (5Bh). The character or characters following the escape and left-bracket characters specify an alphanumeric code that controls a keyboard or display function. ANSI escape sequences distinguish between uppercase and lowercase letters; for example,"A" and "a" have completely different meanings.

This device driver must be loaded by a device or devicehigh command in your CONFIG.SYS file.

Note: In this topic bold letters in syntax and ANSI escape sequences indicate text you must type exactly as it appears.

On This Page

Syntax
Append
Attrib
Break
Buffers
Call
Chcp
Chdir (cd)
CHKSTATE.SYS
Chkdsk
Choice
Cls
Command
Copy
Country
Ctty
Date
Dblspace
Dblspace /Chkdsk
Dblspace /Compress
Dblspace /Create
Dblspace /Defragment
Dblspace /Delete
Dblspace /Info
Dblspace /List
Dblspace /Mount
Dblspace /Ratio
Dblspace /Size
Dblspace /Unmount
DBLSPACE.SYS

Syntax

device=[drive:][path]ANSI.SYS [/x] [/k] [/r]

Parameters

[drive:][path]

Specifies the location of the ANSI.SYS file.

Switches

/x

Remaps extended keys independently on 101-key keyboards.

/k

Causes ANSI.SYS to treat a 101-key keyboard like an 84-key keyboard. This is equivalent to the command SWITCHES=/k. If you usually use the SWITCHES=/k command, you will need to use the /k switch with ANSI.SYS.

/r

Adjusts line scrolling to improve readability when ANSI.SYS is used with screen-reading programs (which make computers more accessible to people with disabilities).

Parameters used in ANSI escape sequences

Pn

Numeric parameter. Specifies a decimal number.

Ps

Selective parameter. Specifies a decimal number that you use to select a function. You can specify more than one function by separating the parameters with semicolons.

PL

Line parameter. Specifies a decimal number that represents one of the lines on your display or on another device.

Pc

Column parameter. Specifies a decimal number that represents one of the columns on your screen or on another device.

ANSI escape sequences for cursor movement, graphics, and keyboard settings

In the following list of ANSI escape sequences, the abbreviation ESC represents the ASCII escape character 27 (1Bh), which appears at the beginning of each escape sequence.

ESC[PL;PcH

Cursor Position: Moves the cursor to the specified position (coordinates). If you do not specify a position, the cursor moves to the home position — the upper-left corner of the screen (line 0, column 0). This escape sequence works the same way as the following Cursor Position escape sequence.

ESC[PL;Pcf

Cursor Position: Works the same way as the preceding Cursor Position escape sequence.

ESC[PnA

Cursor Up: Moves the cursor up by the specified number of lines without changing columns. If the cursor is already on the top line, ANSI.SYS ignores this sequence.

ESC[PnB

Cursor Down: Moves the cursor down by the specified number of lines without changing columns. If the cursor is already on the bottom line, ANSI.SYS ignores this sequence.

ESC[PnC

Cursor Forward: Moves the cursor forward by the specified number of columns without changing lines. If the cursor is already in the rightmost column, ANSI.SYS ignores this sequence.

ESC[PnD

Cursor Backward: Moves the cursor back by the specified number of columns without changing lines. If the cursor is already in the leftmost column, ANSI.SYS ignores this sequence.

ESC[s

Save Cursor Position: Saves the current cursor position. You can move the cursor to the saved cursor position by using the Restore Cursor Position sequence.

ESC[u

Restore Cursor Position: Returns the cursor to the position stored by the Save Cursor Position sequence.

ESC[2J

Erase Display: Clears the screen and moves the cursor to the home position (line 0, column 0).

ESC[K

Erase Line: Clears all characters from the cursor position to the end of the line (including the character at the cursor position).

ESC[Ps;...;Psm

Set Graphics Mode: Calls the graphics functions specified by the following values. These specified functions remain active until the next occurrence of this escape sequence. Graphics mode changes the colors and attributes of text (such as bold and underline) displayed on the screen.

Text attributes

0

1

4

5

7

8

Foreground colors

30

31

32

33

34

35

36

37

Background colors

40

41

42

43

44

45

46

47

Parameters 30 through 47 meet the ISO 6429 standard.

ESC[=Psh

Set Mode: Changes the screen width or type to the mode specified by one of the following values:

0

40 x 148 x 25 monochrome (text)

1

40 x 148 x 25 color (text)

2

80 x 148 x 25 monochrome (text)

3

80 x 148 x 25 color (text)

4

320 x 148 x 200 4-color (graphics)

5

320 x 148 x 200 monochrome (graphics)

6

640 x 148 x 200 monochrome (graphics)

7

Enables line wrapping

13

320 x 148 x 200 color (graphics)

14

640 x 148 x 200 color (16-color graphics)

15

640 x 148 x 350 monochrome (2-color graphics)

16

640 x 148 x 350 color (16-color graphics)

17

640 x 148 x 480 monochrome (2-color graphics)

18

640 x 148 x 480 color (16-color graphics)

19

320 x 148 x 200 color (256-color graphics)

Reset Mode: Resets the mode by using the same values that Set Mode uses, except for 7, which disables line wrapping. The last character in this escape sequence is a lowercase L.

ESC[code;string;...p

Set Keyboard Strings: Redefines a keyboard key to a specified string. The parameters for this escape sequence are defined as follows:

  • Code is one or more of the values listed in the following table. These values represent keyboard keys and key combinations. When using these values in a command, you must type the semicolons shown in this table in addition to the semicolons required by the escape sequence. The codes in parentheses are not available on some keyboards. ANSI.SYS will not interpret the codes in parentheses for those keyboards unless you specify the /x switch in the device command for ANSI.SYS.

  • String is either the ASCII code for a single character or a string contained in quotation marks. For example, both 65 and "A" can be used to represent an uppercase A.

Important: Some of the values in the following table are not valid for all computers. Check your computer's documentation for values that are different.

Key

Code

^SHIFT^+code

^CTRL^+code

ALT+code

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

HOME (num keypad)

0;71

55

0;119

UP ARROW (num keypad)

0;72

56

(0;141)

PAGE UP (num keypad)

0;73

57

0;132

LEFT ARROW (num keypad)

0;75

52

0;115

RIGHT ARROW (num keypad)

0;77

54

0;116

END (num keypad)

0;79

49

0;117

DOWN ARROW (num keypad)

0;80

50

(0;145)

PAGE DOWN (num keypad)

0;81

51

0;118

INSERT (num keypad)

0;82

48

(0;146)

DELETE (num keypad)

0;83

46

(0;147)

HOME

(224;71)

(224;71)

(224;119)

(224;151)

UP ARROW

(224;72)

(224;72)

(224;141)

(224;152)

PAGE UP

(224;73)

(224;73)

(224;132)

(224;153)

LEFT ARROW

(224;75)

(224;75)

(224;115)

(224;155)

RIGHT ARROW

(224;77)

(224;77)

(224;116)

(224;157)

END

(224;79)

(224;79)

(224;117)

(224;159)

DOWN ARROW

(224;80)

(224;80)

(224;145)

(224;154)

PAGE DOWN

(224;81)

(224;81)

(224;118)

(224;161)

INSERT

(224;82)

(224;82)

(224;146)

(224;162)

DELETE

(224;83)

(224;83)

(224;147)

(224;163)

PRINT SCREEN

0;114

PAUSE/BREAK

0;0

BACKSPACE

8

8

127

(0)

ENTER

13

10

(0

TAB

9

0;15

(0;148)

(0;165)

NULL

0;3

A

97

65

1

0;30

B

98

66

2

0;48

C

99

66

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

121

89

25

0;21

Z

122

90

26

0;44

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;126

9

57

40

0;127

0

48

41

0;129

-

45

95

31

0;130

=

61

43

— -

0;131

[

91

123

27

0;26

]

93

125

29

0;27

 

92

124

28

0;43

;

59

58

0;39

'

39

34

0;40

,

44

60

0;51

.

46

62

0;52

/

47

63

0;53

`

96

126

(0;41)

ENTER (keypad)

13

10

(0;166)

/ (keypad)

47

47

(0;142)

(0;74)

* (keypad)

42

(0;144)

(0;78)

- (keypad)

45

45

(0;149)

(0;164)

+ (keypad)

43

43

(0;150)

(0;55)

5 (keypad)

(0;76)

53

(0;143)

Notes

Remapping extended keys

If you have a keyboard with 101 keys, you may want to use the /x switch to remap certain extended keys. For example, there are two HOME keys on keyboards with 101 keys: One on the numeric keypad and the other in the block of cursor-control keys. Unless you specify the /x switch, the two HOME keys are the same to MS-DOS.

Ignoring extended keys

If you have a program that does not correctly interpret input from an enhanced keyboard, use the /k switch with ANSI.SYS. Your enhanced keyboard will then use conventional keyboard functions.

Using both the /x switch and the /k switch

You cannot specify ANSI.SYS with both the /x switch and the /k switch.

Examples

To exchange the backslash and question-mark keys by using literal strings, type the following escape sequence:

ESC["\";"?"pESC["?";"\"p

To exchange the backslash and question-mark keys by using each key's ASCII value, type the following escape sequence:

ESC[92;63pESC[63;92p

To restore the backslash and question-mark keys to their original meanings, type the following escape sequence:

ESC[92;92pESC[63;63p

To specify that MS-DOS display a directory listing when you press the F2 key, type the following at the command prompt:

prompt $e[0;60;"dir";13p

To specify a black screen background color and a high-intensity screen foreground color, type the following at the command prompt:

prompt $e[1;32;40m$p$g

Append

Enables programs to open data files in specified directories as if the files were in the current directory. Do not use this command when you are running Windows.

The specified directories are called appended directories because, for the sake of opening data files, they can be found as if they were appended to the current directory.

Syntax

append [[drive**:]path[;...]] [/x**[:on|:off]][/path:on|/path:off] [/e]

To display the list of appended directories, use the following syntax:

append

To cancel the existing list of appended directories, use the following syntax:

append ;

Parameters

[drive:]path

Specifies the drive (if other than the current drive) and directory that you want to append to the current directory. You can specify multiple entries of [drive**:**]path, separating the entries with semicolons.

;

When used by itself (append ;), cancels the existing list of appended directories.

Switches

/x[:on|:off]

Specifies whether MS-DOS is to search (/x:on) or not search (/x:off) appended directories when executing programs. You can abbreviate /x:on to /x. If you want to specify x:on, you must do it the first time you use append after starting your system. After that, you can switch between x:on and x:off. The default value is /x:off.

/path:on|/path:off

Specifies whether a program is to search appended directories for a data file when a path is already included with the name of the file the program is looking for. The default setting is /path:on.

/e

Assigns the list of appended directories to an environment variable named append. This switch can be used only the first time you use append after starting your system. If you use /e, you can use the set command to display the list of appended directories. For information about environment variables, see the set command.

Caution: Do not use Append with Microsoft Windows or the Windows Setup program.

Notes

Running append with Microsoft Windows

Do not use append with Microsoft Windows or the Windows Setup program.

Running append multiple times

You can use append as many times as you want after starting your system. However, note the following:

  • The /e switch is valid only the first time you use append after starting your system.

  • The second and subsequent times you run append, you must omit the .EXE filename extension. If you try to run append by typing APPEND.EXE, it will not load more than once.

Storing the list of appended directories in the environment

You can use the /e switch with append to assign the list of appended directories to an environment variable named append. To do this, first use the append command with only the /e switch. Then use append again, this time including the directories you want to append. You cannot specify /e and [drive**:**]path on the same command line.

Specifying multiple appended directories

To append more than one directory, separate multiple entries with semicolons. If you use the append command with the [drive**:**]path parameters again, the specified directory or directories replace any directories specified in a previous append command.

Appended directories and the DIR command

If you specify the dir command, the resulting list does not include filenames from appended directories.

Filename conflicts

If a file in an appended directory has the same name as a file in the current directory, programs open the file in the current directory.

Using append with programs that create new files

When a program opens a file in an appended directory, the file can be found as if it were in the current directory. If the program then saves the file by creating a new file with the same name, the new file is created in the current directory (not the appended directory). Append is appropriately used for data files that are not to be modified or that are to be modified without creating new copies of the files. Database programs often modify data files without making new copies. Text editors and word processors, however, usually save modified data files by making new copies. To avoid confusion, do not use append with these programs.

Using the /x:on switch and the path command

When /x:on is specified, you can run a program located in an appended directory by typing the program name at the command prompt. Usually, you use /path:on to specify directories that contain programs. However, when your program is in an appended directory, you do not need to use /path:on to specify that directory. MS-DOS finds a program in an appended directory by following the usual order in which MS-DOS searches for a program; that is, first in the current directory, then in the appended directories, and then in the search path.

MS-DOS functions that always use appended directories

Even when the /x:on switch is not specified, appended directories are used when programs call the following MS-DOS Interrupt 21h functions:

  • Open File (0Fh)

  • Open File Handle (3Dh)

  • Get File Size (23h)

When /x:on is specified, appended directories are used when programs call any of the Interrupt 21h functions in the preceding list or any of the Interrupt 21h functions in the following list:

  • Find First Entry (11h)

  • Find First File (4Eh)

  • Execute Program (EXEC) (4Bh)

Using append with network drives

You can use the append command to append directories that are located on network drives.

Examples

To allow programs to open data files in a directory named LETTERS on the disk in drive B and in a directory named REPORTS on the disk in drive A as if the files were in the current directory, type the following command:

append b:\letters;a:\reports 

To append the same directories and keep a copy of the list of appended directories in the MS-DOS environment, type the following commands:

append /e 
append b:\letters;a:\reports 

These must be the first append commands you use after starting your system.

Related Command

To set a search path for executable files, see the path command.

Attrib

Displays or changes file attributes.

This command displays, sets, or removes the Read-Only, Archive, System, and Hidden attributes assigned to files or directories.

Syntax

attrib [+r|-r] [+a|-a] [+s|-s] [+h|-h][[drive**:][path]filename] [/s**]

To display all attributes of all files in the current directory, use the following syntax:

attrib

Parameters

[drive:][path]filename

Specifies the location and name of the file(s) you want to process.

Switches

+r

Sets the Read-Only file attribute.

-r

Clears the Read-Only file attribute.

+a

Sets the Archive file attribute.

-a

Clears the Archive file attribute.

+s

Sets the file as a System file.

-s

Clears the System file attribute.

+h

Sets the file as a Hidden file.

-h

Clears the Hidden file attribute.

/s

Processes files in the current directory and all of its subdirectories.

Notes

Combining the Hidden and System attributes

If a file has both the Hidden and System attributes set, you can clear both attributes only with a single attrib command. For example, to clear the Hidden and System attributes for the RECORD.TXT file, you would type:

attrib –s –h record.txt 

Using attrib with groups of files

You can use wildcards (? and *) with the filename parameter to display or change the attributes for a group of files. If a file has the System or Hidden attribute set, you must clear that attribute before you can change any other attributes for that file.

Changing the attributes for a directory

You can display or change the attributes for a directory. To use attrib with a directory, you must explicitly specify the directory name; you cannot use wildcards to work with directories. For example, to hide the directory C:\SECRET, you would type the following:

attrib +h c:\secret 

The following command would affect only files, not directories:

attrib +h c:*.* 

Viewing archive attributes

The Archive attribute (a) is used to mark files that have changed since they were previously backed up. The msbackup, restore, and xcopy commands use these Archive attributes. For information about Archive attributes, see the msbackup, restore, and xcopy commands.

Examples

To display the attributes of a file named NEWS86 located on the current drive, type the following command:

attrib news86 

To assign the Read-Only attribute to the file REPORT.TXT, type the following command:

attrib +r report.txt 

To remove the Read-Only attribute from files in the \PUBLIC\JONES directory on a disk in drive B and from files in any subdirectories of \PUBLIC\JONES, type the following command:

attrib –r b:\public\jones\*.* /s

As a final example, suppose you want to give an associate a disk containing all files in the default directory on a disk in drive A except files with the .BAK extension. Because you can use xcopy to copy only those files marked with the Archive attribute, you need to set the Archive attribute for those files you want to copy. To do this, you would use the following two commands to set the Archive attribute for all files on drive A and then to clear the attribute for those files with the .BAK extension:

attrib +a a:*.* 
attrib –a a:*.bak 

Next, use the xcopy command to copy the files from the disk in drive A to the disk in drive B. The /a switch in the following command causes xcopy to copy only those files marked with the Archive attribute:

xcopy a: b: /a 

If you want xcopy to clear each file's Archive attribute after it copies the file, use the /m switch instead of /a, as in the following example:

xcopy a: b: /m 

Related Command

For more information about copying files and directories with different attributes, see the xcopy command.

Break

Sets or clears extended CTRL+C checking. You can use this command at the command prompt or in your CONFIG.SYS file.

You can press CTRL+C to stop a program or an activity (file sorting, for example). Typically, MS-DOS checks for CTRL+C only while it reads from the keyboard or writes to the screen or a printer. If you set break to on, you extend CTRL+C checking to other functions, such as disk read and write operations.

Syntax

break [on|off]

To display the current break setting, use the following syntax:

break

In your CONFIG.SYS file, use the following syntax:

break=on|off

Parameters

on|off

Turns extended CTRL+C checking on or off.

Note: The default setting for break is off. You can include the break command in your CONFIG.SYS file to enable extended CTRL+C checking every time you start your system.

Examples

To specify that MS-DOS is to check for CTRL+C only while it is reading from the keyboard or writing to the screen or printer, type the following command:

break off 

To specify that MS-DOS is to check for CTRL+C while it is reading from a disk or the keyboard or writing to a disk or the screen, type the following command:

break on 

To turn on this extended CTRL+C checking every time you start your system, include the following command in your CONFIG.SYS file:

break=on 

Buffers

Allocates memory for a specified number of disk buffers when your system starts. You can use this command only in your CONFIG.SYS file.

Syntax

buffers=n[,m]

Parameters

n

Specifies the number of disk buffers. The value of n must be in the range 1 through 99.

m

Specifies the number of buffers in the secondary buffer cache. The value of m must be in the range 0 through 8.

Default settings

The default setting for the number of disk buffers depends on the configuration of your system, as shown in the following table:

Configuration

Buffers (n)

Bytes

<128K of RAM, 360K disk

2

<128K of RAM, > 360K disk

3

128K to 255K of RAM

5

2672

256K to 511K of RAM

10

5328

512K to 640K of RAM

15

7984

The default setting for the number of buffers in the secondary cache (m) is 0 (no secondary cache buffers).

If you specify an invalid value for n or m, buffers uses the default setting of no secondary cache buffers.

Notes

Using the secondary buffer cache

Using the cache can speed up certain disk operations if you are using a computer with an 8086 processor. If you are using a computer with a faster processor, it is better to use SMARTDRV.EXE for a cache.

Using buffers with SMARTDRV.EXE

If you are using SMARTDRV.EXE, either use a smaller value for buffers, or do not specify a buffers command at all.

How MS-DOS uses buffers

MS-DOS uses the memory reserved for each disk buffer to hold data during read and write operations. To achieve the best performance with programs such as word processors, specify a value between 10 and 20 for n. If you plan to create many subdirectories, you might want to increase the number of buffers to 20 or 30. Each buffer requires approximately 532 bytes of memory. Therefore, the more buffers you have, the less memory you have available for programs. (To find out how much memory MS-DOS is using for disk buffers, use the mem /d /p command.)

If MS-DOS is loaded in the high memory area (HMA) and there is enough room in the HMA to contain all the buffers, MS-DOS also places the buffers in the HMA. If you specify more than 48 buffers, there will not be enough room in the HMA for all the buffers; in that case, MS-DOS places all of the buffers into conventional memory.

Example

To create 20 disk buffers, include the following command in your CONFIG.SYS file:

buffers=20 

Call

Calls one batch program from another without causing the first batch program to stop.

Syntax

call [drive**:**][path]filename [batch-parameters]

Parameters

[drive:][path]filename

Specifies the location and name of the batch program you want to call. Filename must have a .BAT extension.

batch-parameters

Specifies any command-line information required by the batch program.

Notes

Using batch-parameters

Batch-parameters can contain any information that you can pass to a batch program, including switches, filenames, the replaceable parameters %1 through %9, and environment variables such as %baud%.

Using pipes and redirection symbols

Do not use pipes ("|") and redirection symbols ("<<","<",">", and ">>") with the call command.

Making a recursive call

You can create a batch program that calls itself; however, you must provide an exit command. Otherwise, the parent and child batch programs can loop endlessly.

Examples

To run the CHECKNEW.BAT program from another batch program, include the following command in the parent batch program:

call checknew 

Suppose the parent batch program accepts two replaceable parameters and you want it to pass those parameters to CHECKNEW.BAT. You can use the following command in the parent batch program:

call checknew %1 %2 

Chcp

Displays the number of the active character set (code page). You can also use the chcp command to change the active character set for all devices that support character set switching.

You must install the nlsfunc program before you can use the chcp 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" in the MS-DOS 6 User's Guide.

Syntax

chcp [nnn]

To display the number of the active character set, use the following syntax:

chcp

Parameters

nnn

Specifies the prepared system character set defined by the country command in the CONFIG.SYS file. MS-DOS provides character sets for the following countries and languages:

437 United States

850 Multilingual (Latin I)

852 Slavic (Latin II)

860 Portuguese

863 Canadian-French

865 Nordic

Notes

Requirements for using the chcp command

Before you can use the chcp command, you must specify the location of the COUNTRY.SYS file by using the country command and load the nlsfunc program into memory.

Assigning a new character set

After you assign a new character set, any program you start uses that new character set. However, any program (not including COMMAND.COM) that you started before assigning the new character set will probably attempt to use the original character set.

Examples

To view the active character set setting, type the following command:

chcp 

MS-DOS responds with a message similar to the following:

Active code page: 437

To change the active character set to 850 (Multilingual), type the following command:

chcp 850

MS-DOS alerts you if the specified character set has not been prepared for your system. The following error message appears:

Invalid code page

If a device (monitor, keyboard, printer) is not prepared for a character set, MS-DOS displays an error message in the following format:

Code page 850 not prepared for device nnn

Related Commands

For more information about character sets, see the country, nlsfunc, and mode (set device code pages) commands.

Chdir (cd)

Displays the name of the current directory or changes the current directory.

Syntax

chdir [drive:][path] 
chdir[..] 
cd [drive:][path] 
cd[..]

To display the current drive letter and directory name, use either of the following syntax lines:

chdir 
cd 

Parameters

[drive:][path]

Specifies the drive (if other than the current drive) and directory to which you want to change.

.. Specifies that you want to change to the parent directory.

Notes

Changing to the root directory

The root directory is the top of the directory hierarchy for a drive. To return to the root directory, type the following command:

cd \ 

Using the current directory from a different drive

If you are working in the \PUBLIC\JONES directory on drive C and you change to drive D, you can copy files to and from the \PUBLIC\JONES directory by specifying only the drive letter C.

Changing the directory on another drive

You can change the current directory on another drive by specifying the drive letter on the command line when you use chdir or cd.

Examples

Either of the following commands changes your current directory to the directory named PRIMETIM:

chdir \primetim 
cd \primetim 

Suppose you have a directory named SPECIALS with a subdirectory named SPONSORS. To change your current directory to \SPECIALS\SPONSORS, type the following command:

cd \specials\sponsors 

Or, if your current directory is \SPECIALS, you can use the following command to change to the \SPECIALS\SPONSORS directory:

cd sponsors 

To change from a subdirectory back to the parent directory, type the following command:

cd.. 

To display the name of the current directory, you can use chdir or cd without a parameter. For example, if your current directory is \PUBLIC\JONES on the disk in drive B, type chdir to see the following response:

B:\\PUBLIC\\JONES

If you are working on drive D and you want to copy all files in the \PUBLIC\JONES and \PUBLIC\LEWIS directories on drive C to the root directory on drive D, type the following commands:

chdir c:\public\jones
copy c:*.* d:\chdir c:\public\lewis
copy c:*.* d:\

If, instead, you want to copy all files in the \PUBLIC\JONES and \PUBLIC\LEWIS directories to your current location on drive D, type the following commands:

chdir c:\public\jones
copy c:*.* d:
chdir c:\public\lewis
copy c:*.* d:

For more information on copying files, see the copy command.

CHKSTATE.SYS

Used by the MemMaker memory-optimization program to track the optimization process.

During optimization, MemMaker adds the CHKSTATE.SYS command line to the beginning of your CONFIG.SYS file. When the optimization process is complete, MemMaker removes the CHKSTATE.SYS command line.

CHKSTATE.SYS is used exclusively by MemMaker.

Chkdsk

Checks the status of a disk and displays a status report. Can also fix disk errors.

The status report shows logical errors found in the MS-DOS filing system, which consists of the file allocation table and directories. (Chkdsk does not verify that the information in your files can be accurately read.) If errors exist on the disk, chkdsk alerts you with a message. You should use chkdsk occasionally on each disk to check for errors.

Syntax

chkdsk [drive**:][[path]filename] [/f**] [/v]

To display the status of the disk in the current drive, use the following syntax:

chkdsk

Parameters

drive:

Specifies the drive that contains the disk that you want chkdsk to check.

[path]filename

Specifies the location and name of a file or set of files that you want chkdsk to check for fragmentation. You can use wildcards (* and ?) to specify multiple files.

Switches

/f

Fixes errors on the disk. Do not use this option when running chkdsk from other programs such as Microsoft Windows or the MS-DOS Task Swapper. For more information, see "Using CHKDSK With Open Files" in the Notes topic.

/v

Displays the name of each file in every directory as the disk is checked.

Notes

Format of status reports

MS-DOS displays chkdsk status reports similar to the following example:

Volume Serial Number is B1AF-AFBF
  72214528 bytes total disk space
     73728 bytes in 3 hidden files
     30720 bytes in 12 directories
  11493376 bytes in 386 user files
     61440 bytes in bad sectors
  60555264 bytes available on disk
      2048 bytes in each allocation unit
     35261 total allocation units on disk
     29568 available allocation units on disk
    655360 total bytes memory
    493456 bytes free

Fixing disk errors

To fix disk errors, use the chkdsk /f command. (Chkdsk corrects disk errors only if you specify the /f switch.) Chkdsk /f will display a prompt similar to the following:

10 lost allocation units found in 3 chains.
Convert lost chains to files?

If you press Y, MS-DOS saves each lost chain in the root directory as a file with a name in the format FILEnnnn.CHK. When chkdsk finishes, you can examine these files to see if they contain any data you need. If you press N, MS-DOS fixes the disk but does not save the contents of the lost allocation units.

If you do not use the /f switch, chkdsk alerts you with a message if a file needs to be fixed but does not fix the error(s).

Using chkdsk with open files

Never use chkdsk when files are currently open. Chkdsk is designed for use when the files on the disk are in an unchanging state— that is, when they are not open. When a file is open, it is probably changing, and MS-DOS will update the file allocation table and the directory structure to reflect changes. Such updates are not always made immediately, and updates to the file allocation table and the directories occur at different times. If you run chkdsk when files are open on the disk, it interprets differences between the directory structure and the file allocation tables as errors. Running chkdsk /f when files are open can result in corruption or loss of data. Therefore, never run chkdsk /f from another program, or when Microsoft Windows or the MS-DOS Task Swapper are running.

Using chkdsk with assigned drives and networks

The chkdsk command does not work on drives formed by the subst command. You cannot use chkdsk to check a disk on a network drive.

Physical disk errors

The chkdsk command finds only logical errors in the file system, not physical disk errors.

Bad disk sectors

Bad sectors reported by chkdsk were marked as "bad" when your disk was first prepared for operation. Physical disk-error correction utilities can also mark sectors as "bad." Bad sectors pose no danger.

Cross-Linked Files

Chkdsk reports a cross-linked file if two files or directories are recorded as using the same disk space. If chkdsk finds a cross-linked file, it displays a message similar to the following:

(File) is cross linked on allocation unit (number)

Chkdsk will not fix a cross-linked file, even if you specify the /f switch. To fix a cross-linked file, copy the specified files or directories elsewhere and delete the originals. Some of the information in these files may be lost.

Errorlevel parameters

If chkdsk does not find any errors, it returns an errorlevel value of 0. If chkdsk found one or more errors, it returns an errorlevel value of 255.

Saving a chkdsk status report to a file

You can save a chkdsk status report by redirecting the output to a file. Do not use the /f switch when you redirect chkdsk output to a file.

Examples

If you want to check the disk in drive A and have MS-DOS fix any errors encountered, type the following command:

chkdsk a: /f 

Chkdsk pauses and displays messages if it encounters errors. Then chkdsk may prompt you to specify how you want MS-DOS to correct the errors. Chkdsk finishes by displaying a report showing the status of the disk.

To redirect the output of chkdsk to a file named STATUS, type the following command:

chkdsk a: > status 

Because the output is redirected, MS-DOS does not repair errors it encounters during the check; but it records all the errors in a report file. Afterward, you can use chkdsk with the /f switch without redirection to correct any errors noted in the status report.

Choice

Prompts the user to make a choice in a batch program. Displays a specified prompt and pauses for the user to choose from among a specified set of keys. You can use this command only in batch programs.

For more information on the errorlevel parameter, see the Note section and the if command.

Syntax

choice [/c[:]keys] [/n] [/s] [/t[:]c,nn] [text]

Parameters

text

Specifies text you want to be displayed before the prompt. Quotation marks are necessary only if you include a switch character (/) as part of the text before the prompt. If you don't specify text, choice displays only a prompt.

Switches

/c[:]keys

Specifies allowable keys in the prompt. When displayed, the keys will be separated by commas, will appear in brackets ([]), and will be followed by a question mark. If you don't specify the /c switch, choice uses YN as the default. The colon (:) is optional.

/n

Causes choice not to display the prompt. The text before the prompt is still displayed, however. If you specify the /n switch, the specified keys are still valid.

/s

Causes choice to be case sensitive. If the /s switch is not specified, choice will accept either upper or lower case for any of the keys that the user specifies.

/t[:]c,nn

Causes choice to pause for a specified number of seconds before defaulting to a specified key. The values for the /t switch are as follows:

c Specifies the character to default to after nn seconds. The character must be in the set of choices specified in the /c switch.

nn Specifies the number of seconds to pause. Acceptable values are from 0 to 99. If 0 is specified, there will be no pause before defaulting.

Note: The first key you assign returns a value of 1, the second a value of 2, the third a value of 3, and so on. If the user presses a key that is not among the keys you assigned, choice sounds a warning beep (that is, it sends a BEL, or 07h, character to the console). If choice detects an error condition, it returns an errorlevel value of 255. If the user presses CTRL+BREAK or CTRL+C, choice returns an errorlevel value of 0.

When you use errorlevel parameters in a batch program, list them in decreasing order.

Examples

What the user sees when you use choice in a batch file

If you use the following syntax in a batch file,

choice /c:ync 

the user sees the following when choice is started:

[Y,N,C]?

If you add text to the syntax,

choice /c:ync Yes, No, or Continue 

the user sees the following when choice is started:

Yes, No, or Continue [Y,N,C]?

What the user sees if you leave out a prompt

If, as in the following example, you use the /n switch to leave out the prompt in a batch program,

choice /n Yes, No, or Continue? 

the user sees only the text you specified when choice is started:

Yes, No, or Continue?

What the user sees if you use the /t switch

If you use the following syntax in a batch program,

choice /c:ync /t:n,5 

the user sees the following when choice is started:

[Y,N,C]?

If, after 5 seconds, the user hasn't pressed a key, choice chooses N and returns an errorlevel value of 2. If the user presses a key before 5 seconds, choice returns the value corresponding to the user's choice.

To have the option of defragmenting drive C when you start your computer, you could add the following lines to your AUTOEXEC.BAT file:

choice Defrag drive /ty,5
if errorlevel 2 goto SkipDefrag
defrag c:
:SkipDefrag

If you press N within 5 seconds, defrag will not run and choice returns an errorlevel value of 2. If you do not press N within 5 seconds, or if you choose Y, defrag is run on drive C.

Using choice in a batch program

The following batch program demonstrates using the choice option to select one of three programs: MS-DOS Editor, Microsoft Anti-Virus, or Microsoft Backup.

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
cls
echo.
echo A   Microsoft Editor
echo B   Microsoft Anti-Virus
echo C   Microsoft Backup
echo.
choice /c:abc Choose an option
if errorlevel 3 goto MSBackup
if errorlevel 2 goto Msav
if errorlevel 1 goto Edit
:Edit
edit
goto End
:Msav
msav
goto End
:Msbackup
msbackup
goto End
:End

Cls

Clears the screen.

The cleared screen shows only the command prompt and cursor.

Syntax

cls

Command

Starts a new instance of the MS-DOS command interpreter.

A command interpreter is a program that displays the command prompt at which you type commands. Use the EXIT command to stop the new command interpreter and return control to the old one.

Syntax

command [[drive**:]path] [device] [/cstring] [/e**:nnnnn] [/kfilename] [/p [/msg]]

In your CONFIG.SYS file, use the following syntax:

shell=[[dos-drive**:]dos-path]command.com [[drive:]path][device] [/e**:nnnn] [/p [/msg]]

Parameters

[drive:]path

Specifies where the command interpreter is to look for the COMMAND.COM file when the transient part of the program needs to be reloaded. This parameter must be included when loading COMMAND.COM for the first time if the COMMAND.COM file is not located in the root directory. This parameter is used to set the COMSPEC environment variable.

device

Specifies a different device for command input and output. For more information about this parameter, see the ctty command.

[dos-drive:]dos-path

Specifies the location of the COMMAND.COM file.

Switches

/c string

Specifies that the command interpreter is to perform the command specified by string and then exit.

/e:nnnnn

Specifies the environment size, where nnnnn is the size in bytes. The value of nnnnn must be in the range 160 through 32768. MS-DOS rounds this number up to a multiple of 16 bytes. The default value is 256.

/k filename

Runs the specified program or batch file and then displays the MS-DOS command prompt. This switch is particularly useful for specifying a startup file other than C:\AUTOEXEC.BAT for the MS-DOS Prompt in Windows. (To do this, open the DOSPRMPT.PIF file using the PIF Editor, and type the /k switch in the Optional Parameters box.) It is not recommended to use the /k switch on the shell command line in your CONFIG.SYS file; doing so can cause problems with applications and installation programs that make changes to your AUTOEXEC.BAT file.

/p

Should be used only when command is used with the shell command in the CONFIG.SYS file. The /p switch makes the new copy of the command interpreter permanent. In this case, the exit command cannot be used to stop the command interpreter. If you specify /p, MS-DOS runs your AUTOEXEC.BAT file before displaying the command prompt. If there is no AUTOEXEC.BAT file in the root directory of the startup drive, MS-DOS carries out the date and time commands instead. If you do not have a shell command in your CONFIG.SYS file, COMMAND.COM is automatically loaded from the root directory with the /p switch.

/msg

Specifies that all error messages should be stored in memory. Usually, some messages are stored only on disk. This switch is useful only if you are running MS-DOS from floppy disks. You must specify the /p switch when you use the /msg switch. For more information about using the /msg switch, see the Notes section.

Notes

Limits on environment size

If nnnnn is less than 160 or greater than 32768, MS-DOS uses the default value of 256 bytes and displays the following message:

Parameter value not in allowed range.

Changing your terminal device

You can specify a different device (such as AUX) for input and output by using the device parameter. For more information about device, see the ctty command.

Running multiple command interpreters

When you start a new command interpreter, MS-DOS creates a new command environment. This new environment is a copy of the parent environment. You can change the new environment without affecting the old one. The default size of the new environment is 256 bytes or the size of the current environment rounded up to the next 16 bytes, whichever is larger. Use the /e switch to override the default size. (Note that the current environment refers to the memory actually being used, not to the environment size specified with the previous /e switch.)

Transient and resident memory

MS-DOS loads the command interpreter in two parts: the resident part (which is always in memory) and the transient part (at the top of conventional memory). Some programs write over the transient part of COMMAND.COM when they run. When this happens, the resident part must locate the COMMAND.COM file on disk to reload the transient part. The COMSPEC environment variable identifies where COMMAND.COM is located on the disk. If COMSPEC is set to a floppy disk drive, MS-DOS might prompt you to insert a disk that contains COMMAND.COM.

If MS-DOS is loaded in the HMA, a portion of resident COMMAND.COM is also loaded into the HMA, making more conventional memory available for programs.

Using the /msg switch

Usually, MS-DOS leaves many error messages in the COMMAND.COM file on the disk instead of using memory to store them. When MS-DOS needs to display one of these messages, MS-DOS retrieves the message from the disk containing COMMAND.COM.

If you are running MS-DOS from floppy disks instead of from a hard disk, MS-DOS cannot retrieve such error messages unless you have the disk containing COMMAND.COM in drive A. If this disk is not present, MS-DOS displays one of the following short messages instead of the full message:

Parse error
Extended error

You can make sure MS-DOS displays complete error messages by using the /msg switch with command. This switch forces MS-DOS to keep these error messages in memory so that they are always available when needed.

Use the /msg switch with command if you have a floppy disk system, unless you cannot afford to lose the memory used to store the error messages.

You must also specify the /p switch when you use the /msg switch.

Internal commands

Command is called a command processor because it reads any commands that you type and processes them.

Some commands are recognized and carried out by command itself. These commands are considered internal to command. Other MS-DOS commands are separate programs located on your hard disk, which MS-DOS loads just like your other programs.

The following MS-DOS commands are implemented by command:

break

echo

rem

call

exit

rename (ren)

chcp

for

rmdir (rd)

chdir (cd)

goto

set

cls

if

shift

copy

loadhigh (lh)

time

ctty

mkdir (md)

type

date

path

ver

del (erase)

pause

verify

dir

prompt

vol

Examples

The following command specifies that the MS-DOS command interpreter is to start a new command interpreter from the current program, run a batch program named MYBAT.BAT, and then return to the first command interpreter:

command /c mybat.bat 

The following CONFIG.SYS command specifies that COMMAND.COM is located in the DOS directory on drive C:

shell=c:\dos\command.com c:\dos\ /e:1024 

This command directs MS-DOS to set the COMSPEC environment variable to C:\DOS\COMMAND.COM. This command also creates an environment of 1024 bytes for this command interpreter.

Related Command

The shell command is the preferred method of using command to permanently increase space for the environment table.

Copy

Copies one or more files to the location you specify.

This command can also be used to combine files. When more than one file is copied, MS-DOS displays each filename as the file is copied.

Syntax

copy [/a|/b] source [/a|/b] [+ source [/a|/b] [+ ...]][destination [/a|/b]] [/v]

Parameters

source

Specifies the location and name of a file or set of files from which you want to copy. Source can consist of a drive letter and colon, a directory name, a filename, or a combination.

destination

Specifies the location and name of a file or set of files to which you want to copy. Destination can consist of a drive letter and colon, a directory name, a filename, or a combination.

Switches

/a

Indicates an ASCII text file. When the /a switch precedes the list of filenames on the command line, it applies to all files whose names follow the /a switch, until copy encounters a /b switch, in which case the /b switch applies to the file whose name precedes the /b switch.

When the /a switch follows a filename, it applies to the file whose name precedes the /a switch and to all files whose names follow the /a switch, until copy encounters a /b switch, in which case the /b switch applies to the file whose name precedes the /b switch.

An ASCII text file can use an end-of-file character (CTRL+Z) to indicate the end of the file. When combining files, copy treats files as ASCII text files by default.

/b

Indicates a binary file. When the /b switch precedes the list of filenames on the command line, it applies to all files whose names follow the /b switch, until copy encounters an /a switch, in which case the /a switch applies to the file whose name precedes the /a switch.

When the /b switch follows a filename, it applies to the file whose name precedes the /b switch and to all files whose names follow the /b switch, until copy encounters an /a switch, in which case the /a switch applies to the file whose name precedes the /a switch.

The /b switch specifies that the command interpreter is to read the number of bytes specified by the file size in the directory. The /b switch is the default value for copy unless copy is combining files.

/v

Verifies that new files are written correctly.

Notes

Copying to and from devices

You can substitute a device name for one or more occurrences of source or for destination.

Using or omitting the /b switch when copying to a device

When destination is a device (for example, COM1 or LPT1), the /b switch causes MS-DOS to copy data to the device in binary mode. In binary mode, all characters (including such special characters as CTRL+C, CTRL+S, CTRL+Z, and carriage return) are copied to the device as data. Whereas, omission of the /b switch causes MS-DOS to copy data to the device in ASCII mode. In ASCII mode, such special characters as those previously listed may cause MS-DOS to take special action during the copying process.

Using the default destination file

If you do not specify a destination file, MS-DOS creates a copy with the same name, creation date, and creation time as the original file, placing the new copy in the current directory on the current drive. If the source file is on the current drive and in the current directory and you do not specify a different drive or directory for the destination file, the copy command stops and MS-DOS displays the following error message:

File cannot be copied onto itself
0 File(s) copied

Using the /v switch

If MS-DOS cannot verify a write operation, it displays an error message. Although recording errors rarely occur with the copy command, the /v switch lets you verify that critical data has been correctly recorded. The /v switch also slows down the copy command, because MS-DOS must check each sector recorded on the disk.

Using the /a and /b switches

The effect of an /a or /b switch depends upon its position on the command line. When the /a or /b switch follows the source filename, copy performs as shown in the following list:

/a

Treats the file as an ASCII (text) file and copies data that precedes the first end-of-file character. Copy does not copy the first end-of-file character or the remainder of the file.

/b

Copies the entire file, including any end-of-file character.

When the /a or /b switch follows the destination filename, copy performs as shown in the following list:

/a

Adds an end-of-file character as the last character of the file.

/b

Does not add an end-of-file character.

Combining files with the copy command

If you specify more than one source, separating entries with a plus sign (+), copy combines the files, creating a single file. If you use wildcards in source but specify a single filename in destination, copy combines all files matching the filename in source and creates a single file with the filename specified in destination.

In either case, copy assumes the combined files are ASCII files unless you specify the /b switch. (Do not combine non-ASCII files without specifying the /b switch; doing so can result in truncated files, since most binary files contain CTRL+Z characters which cause copy to behave as if it has reached the end of the file.)

If the name of the destination file is the same as the name of one of the files being copied (except the first file), the original contents of the destination file are lost. When this happens, copy displays the following message:

Content of destination lost before copy

Copying files in subdirectories

To copy all of a directory's files and subdirectories, you should use the xcopy command.

Copying zero-length files

Copy does not copy files that are 0 bytes long. Use xcopy to copy these files.

Changing the time and date of a file

If you want to assign the current time and date to a file without modifying the file, use a command in the following format. The commas indicate the omission of the destination parameter.

copy /b source+,, 

Examples

The following command copies a file and ensures that an end-of-file character is at the end of the copied file:

copy memo.doc letter.doc /a 

To copy a file named ROBIN.TYP from the current drive and directory to an existing directory named BIRDS that is located on drive C, type the following command:

copy robin.typ c:\birds 

If the BIRDS directory doesn't exist, MS-DOS copies the file ROBIN.TYP into a file named BIRDS that is located in the root directory on the disk in drive C.

To copy several files into one file, list any number of files as source parameters on the copy command line. Separate filenames with a plus sign (+) and specify a filename for the resulting combined file, as the following example shows:

copy mar89.rpt + apr89.rpt + may89.rpt report 

This command combines the files named MAR89.RPT, APR89.RPT, and MAY89.RPT from the current drive and directory and places them in a file named REPORT in the current directory on the current drive. When files are combined, the destination file is created with the current date and time. If you omit destination, MS-DOS combines the files and stores them under the name of the first specified file. For example, if a file named REPORT already exists, you can use the following command to combine all four files in REPORT:

copy report + mar89.rpt + apr89.rpt + may89.rpt 

You can also combine several files into one by using wildcards, as the following example shows:

copy *.txt combin.doc 

This command combines all files in the current directory on the current drive that have the extension .TXT into one file named COMBIN.DOC, also in the current directory on the current drive.

If you want to combine several binary files into one by using wildcards, include the /b switch, as the following example shows:

copy /b *.exe combin.exe 

This prevents MS-DOS from treating CTRL+Z as an end-of-file character.

Caution: If you combine binary files, the resulting file might not be usable due to internal formatting.

In the following example, copy combines each file that has a .TXT extension with its corresponding .REF file. The result is a file with the same filename but with a .DOC extension. Thus, copy combines FILE1.TXT with FILE1.REF to form FILE1.DOC. Then copy combines FILE2.TXT with FILE2.REF to form FILE2.DOC, and so on.

copy *.txt + *.ref *.doc 

The following copy command combines 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 

Copying information from the keyboard

The following copy command copies what you type at the keyboard to the OUTPUT.TXT file:

copy con output.txt 

After you type this command and press ENTER, MS-DOS copies everything you type to the file OUTPUT.TXT. When you are finished typing, press CTRL+Z to indicate that you want to end the file. The CTRL+Z character will appear on the screen as "Z". You can also end a copy con command by pressing the F6 key. When you press F6, it generates the CTRL+Z character, which appears on the screen as Z.

The following example copies information from the keyboard to the printer connected to LPT1:

copy con lpt1 

Related Command

For information about copying directories and subdirectories, see the xcopy command.

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 determing which characters can be used in filenames. You can use this command only in your CONFIG.SYS file.

The country command configures MS-DOS to recognize the character set and punctuation conventions observed when using one of the supported languages.

Syntax

country=xxx[,[yyy][,[drive**:**][path]filename]]

Parameters

xxx

Specifies the country code.

yyy

Specifies the character set for the country/region.

[drive:][path]filename

Specifies the location and name of the file containing country/region information.

Notes

Changing default settings

MS-DOS uses the United States as the default setting. You can use the country command in your CONFIG.SYS file to change the setting.

If you do not specify the location and name of the file containing country-specific information, MS-DOS tries to find the COUNTRY.SYS file in the root directory of your startup drive.

Specifying supported languages

The following table lists each country/region or language supported by MS-DOS. The table also lists the character sets you can use with each country code. For example, if you use country code 003, you can use only character set 437 or 850 for the yyy parameter. The first of the two character sets listed for each country/region or language is its default character set.

Country/Region or language

Country code

Character sets

Belgium

032

850, 437

Brazil

055

850, 437

Canadian-French

002

863, 850

Croatia

038

852, 850

Czech Republic

042

852, 850

Denmark

045

850, 865

Finland

358

850, 437

France

033

850, 437

Germany

049

850, 437

Hungary

036

852, 850

International English

061

437, 850

Italy

039

850, 437

Latin America

003

850, 437

Netherlands

031

850, 437

Norway

047

850, 865

Poland

048

852, 850

Portugal

351

850, 860

Serbia

038

852, 850

Slovakia

042

852, 850

Slovenia

038

852, 850

Spain

034

850, 437

Sweden

046

437, 850

Switzerland

041

850, 437

United Kingdom

044

437, 850

United States

001

437, 850

Character sets for the following countries or languages are also available with special versions of MS-DOS: Arabic, Israel, Japan, Korea, People's Republic of China, and Taiwan.

Specifying international time and date formats

The country code specifies the time and date formats used by the following MS-DOS commands: backup, date, restore, and time.

The following table lists the date and time formats related to each country code. For each country code, the "Date format" column shows how MS-DOS displays January 3, 1993, and the "Time format" column shows how MS-DOS displays 5:35 P.M. (with 0 seconds and 0 hundredths of a second).

Country/Region or language

Country code

Date format

Time format

Belgium

032

23/01/1993

17:35:00

Brazil

055

23/01/1993

17:35:00

Canadian-French

002

1993–01–23

17:35:00

Czech Republic

042

1993–01–23

17:35:00

Denmark

045

23–01–1993

17.35.00

Finland

358

23.01.1993

17.35.00

France

033

23.01.1993

17:35:00

Germany

049

23.01.1993

17:35:00

Hungary

036

1993–01–23

17:35:00

International English

061

23–01–1993

5:35:00.00p

Italy

039

23/01/1993

17.35.00

Latin America

003

23/01/1993

5:35:00.00p

Netherlands

031

23–01–1993

17:35:00

Norway

047

23.01.1993

17:35:00

Poland

048

1993–01–23

17:35:00

Portugal

351

23–01–1993

17:35:00

Spain

034

23/01/1993

17:35:00

Sweden

046

1993–01–23

17.35.00

Switzerland

041

23.01.1993

17,35,00

United Kingdom

044

23/01/1993

17:35:00.00

United States

001

01–23–1993

5:35:00.00p

Character sets for the following countries or languages are also available with special versions of MS-DOS: Arabic, Israel, Japan, Korea, People's Republic of China, and Taiwan.

Examples

To convert international currency, time, date, and case to French conventions, add the following command to your CONFIG.SYS file:

country=033 

For this example, assume that the COUNTRY.SYS file is in the root directory of the startup drive. If COUNTRY.SYS is in a different location, you would specify the location in [drive**:**]path on the command line.

To specify a character set with the country code for France, type the following:

country=033,850 

If you omit the character set but include the [drive**:**][path] filename parameter, you must still type the comma that would have preceded the character set, as the following example shows:

country=033,,c:\dos\country.sys 

Related Commands

For information about changing characters and their arrangement on your keyboard, see the keyb command, or see the chapter "Customizing for International Use" in the MS-DOS 6 User's Guide.

For information about preparing and selecting character sets, see the mode (set device code pages) command.

For information about loading country-specific information, see the nlsfunc command.

Ctty

Changes the terminal device used to control your computer.

Use the ctty command if you want to use another device to enter commands.

Syntax

ctty device

Parameters

device

Specifies the alternative device you want to use to type MS-DOS commands. Valid values for the device parameter are prn, lpt1, lpt2, lpt3, con, aux, com1, com2, com3, and com4.

Notes

Setting up a serial port for ctty

Use the mode command to set up your serial port for baud rate, parity, bits, and stop bit before using the ctty command.

Using ctty with programs that do not use MS-DOS

Many programs do not use MS-DOS for input or output. These programs send input directly to the hardware on your computer. The ctty command has no effect on these programs; it affects only programs that use MS-DOS for reading keyboard input and displaying output.

Setting the terminal device with command

In addition to the ctty command, you can use the device parameter of the command command to specify the input device.

Examples

To change control of all input and output from the current device (your computer monitor and keyboard) to the AUX port, type the following at the command prompt:

ctty aux 

In this example, a remote terminal device connected to the AUX port controls input and output for your system.

To transfer input and output back to the monitor and keyboard, type the following command at the remote terminal:

ctty con 

Related Command

For more information about changing the input device when specifying a command interpreter, see the command command.

Date

Displays the date and prompts you to change the date if necessary.

MS-DOS records the current date for each file you create or change; this date is listed next to the filename in the directory.

Syntax

date [mm-dd-yy]

Parameters

mm-dd-yy

Sets the date you specify. Values for day, month, and year must be separated by periods (.), hyphens (-), or slash marks (/). The date format depends on the country setting you are using in your CONFIG.SYS file. The following list shows the valid values for the month, day, and year portions of the mm-dd-yy parameter.

mm 1 through 12 dd 1 through 31 yy 80 through 99 or 1980 through 2099

Notes

Adjusting for days in a month

MS-DOS is programmed to change months and years correctly, whether the month has 28, 29, 30, or 31 days.

Using the date command in your AUTOEXEC.BAT file

To prompt users for the date every time the computer is restarted, include the date command in your AUTOEXEC.BAT file.

Changing the date format

To display the date in other format besides mm-dd-yy, add the country command to your CONFIG.SYS file. You can change the date format to the European standard format (dd-mm-yy) or to the Scientific International (Metric) format (yy-mm-dd).

Related Command

For information about changing the current time, see the time command.

Dblspace

Compresses hard disk drives or floppy disks, and configures drives that were compressed by using DoubleSpace.

Syntax

When you issue the dblspace command by itself, the DoubleSpace program starts. This program provides an easy-to-use, menu-oriented user interface for setting up and working with compressed drives. For more information, see the chapter "Making More Disk Space Available" in the MS-DOS 6 User's Guide.

If you add switches or parameters to the dblspace command, MS-DOS carries out the requested task without starting the DoubleSpace program. The command syntax differs from task to task. You can use the dblspace command to perform the following tasks:

  • Check the validity of a compressed drive's internal file structure. For more information, see dblspace /chkdsk.

  • Compress a hard disk drive or floppy disk. For more information, see dblspace /compress.

  • Create a new compressed drive in the free space on an existing drive. For more information, see dblspace /create.

  • Defragment a compressed drive. For more information, see dblspace /defragment.

  • Delete a compressed drive. For more information, see dblspace /delete.

  • Format a compressed drive. For more information, see dblspace /format.

  • Display information about a compressed drive. For more information, see dblspace /info.

  • Display a list of the drives on your computer. The list includes compressed and uncompressed hard disk drives, floppy disk drives, and other removable-media drives. It does not include network drives. For more information, see dblspace /list.

  • Mount a compressed volume file (CVF). When DoubleSpace mounts a CVF, it assigns a drive letter; you can then use the files that CVF contains. For more information, see dblspace /mount.

  • Unmount a compressed drive. For more information, see dblspace /unmount.

  • Change the estimated compression ratio of a compressed drive. For more information, see dblspace /ratio.

  • Change the size of a compressed drive. For more information, see dblspace /size.

Notes

Running the dblspace command without switches or parameters

The first time you run the dblspace command, it starts the DoubleSpace Setup program. DoubleSpace Setup compresses your hard disk drive and loads DBLSPACE.BIN into memory. DBLSPACE.BIN is the part of MS-DOS that provides access to compressed drives.

Thereafter, when you run the dblspace command without specifying any switches or parameters, the DoubleSpace program starts. This program lists your compressed drives and provides menu commands for working with them. You can perform all DoubleSpace tasks either from within the DoubleSpace program or from the MS-DOS command line.

DBLSPACE.BIN and DBLSPACE.SYS

DBLSPACE.BIN is the part of MS-DOS that provides access to your compressed drives. When you start your computer, MS-DOS loads DBLSPACE.BIN along with other operating system functions, before carrying out the commands in your CONFIG.SYS and AUTOEXEC.BAT files. DBLSPACE.BIN always loads in conventional memory, since it loads before device drivers that provide access to upper memory.

The DBLSPACE.SYS device driver does not provide access to compressed drives; it simply determines the final location of DBLSPACE.BIN in memory. When loaded with a device command, the DBLSPACE.SYS device driver moves DBLSPACE.BIN from the top to the bottom of conventional memory. When loaded with a devicehigh command, DBLSPACE.SYS moves DBLSPACE.BIN from conventional to upper memory, if available.

For more information, see DBLSPACE.SYS.

How DoubleSpace assigns drive letters

When you install DoubleSpace, it creates a new drive and assigns a drive letter to that drive. DoubleSpace skips the first four available drive letters and assigns the next available drive letter to the new drive. For example, if your computer has only drives A, B, and C, DoubleSpace skips letters D, E, F, and G, and assigns drive letter H to the new drive.

When assigning letters to additional drives (for example, if you compress another drive), DoubleSpace works backwards from the first drive letter it assigned. In the example above, DoubleSpace would next assign the letter G.

DoubleSpace attempts to avoid drive-letter conflicts with drives created by fdisk, RAMDrive, networks, or other installable device drivers that assign drive letters. However, if a drive-letter conflict does occur, DoubleSpace resolves the conflict by reassigning its drive letters.

Dblspace /Chkdsk

Checks the structural validity of a compressed drive. If DoubleSpace Chkdsk finds errors such as lost clusters or cross-linked files, it informs you of the problem and corrects any errors it can. (DoubleSpace Chkdsk checks the internal structure of the compressed volume file; to check the compressed drive's MS-DOS file allocation tables, use the chkdsk command instead.)

Syntax

dblspace /chkdsk [/f] [drive**:**]

Parameters

drive:

Specifies the letter of the drive you want DoubleSpace to check. This parameter is optional; if you do not specify a drive, DoubleSpace checks the current drive.

Switches

/chkdsk

Checks the structural validity of the specified compressed drive. This switch can be abbreviated to /chk.

/f

Fixes errors on the compressed drive.

Dblspace /Compress

Compresses the files on an existing hard disk drive, floppy disk, or other removable media. Compressing an existing drive makes more space available on that drive.

Note: DoubleSpace cannot compress a drive that's completely full. To compress your startup hard disk drive, the drive must contain at least 1.2 MB of free space. Other hard disk drives and floppy disks must contain at least .65 MB of free space. (DoubleSpace cannot compress 360K floppy disks.)

Syntax

dblspace /compress drive1: [/newdrive=drive2:] [/reserve=size]

Parameters

drive1:

Specifies the existing drive you want to compress.

Switches

/compress

Compresses the hard disk drive or floppy disk specified by the drive parameter. This switch can be abbreviated to /com.

/newdrive=drive2:

Specifies the drive letter for the uncompressed (host) drive. After DoubleSpace compresses an existing drive, your system will include both the existing drive (now compressed) and a new uncompressed drive. The /newdrive switch is optional; if you omit it, DoubleSpace assigns the next available drive letter to the new drive. This switch can be abbreviated to /new.

/reserve=size

Specifies how many megabytes of space to leave uncompressed. Because some files, such as the Windows swap file, do not work properly when stored on a compressed drive, it's a good idea to reserve some uncompressed space. The uncompressed space will be located on the new uncompressed drive. (If the drive you are compressing contains a Windows permanent swap file, DoubleSpace moves the file to the new uncompressed drive.) This switch can be abbreviated to /res.

Notes

Compressing floppy disks

You can use DoubleSpace to increase the storage capacity of floppy disks in addition to hard disks. After compressing a floppy disk, you can use it to store data or to transfer data from one computer to another.

Compressing a floppy disk is similar to compressing an existing hard disk drive. You can compress a floppy disk that is completely empty or one that contains files. (Make sure the floppy disk is formatted and has at least .65 MB of free space. DoubleSpace cannot compress a floppy disk that is completely full. DoubleSpace also cannot compress 360K floppy disks.)

Using compressed floppy disks

In general, you use a compressed floppy disk just as you would a normal floppy disk. The main difference is that you must mount a compressed floppy disk before you can use it.

When you first compress a floppy disk, DoubleSpace mounts it for you. However, if you change floppy disks or restart your computer, you will have to remount the floppy disk before you can use it again.

To mount a floppy disk, use the dblspace /mount command.

To use a compressed floppy disk to transfer data from one computer to another, both computers must be running DoubleSpace.

Examples

To compress drive D, type the following command:

dblspace /compress d: 

Because this command does not specify how much space to leave uncompressed, DoubleSpace leaves 2 MB of uncompressed space (the default). Because the command does not specify a drive letter for the uncompressed drive, DoubleSpace assigns the next available drive letter to the new uncompressed drive (the host drive).

To direct DoubleSpace to compress drive E, assign the drive letter F to the new uncompressed drive (the host drive), and leave 4 MB of uncompressed space on drive F, type the following command:

dblspace /compress f: /reserve=4 

Dblspace /Create

Creates a new compressed drive by using free space on an uncompressed drive. The new compressed drive will provide more storage capacity than the amount of space it uses.

Syntax

dblspace /create drive1: [/newdrive=drive2:] [/size=size | /reserve=size]

Parameters

drive1:

Specifies the uncompressed drive that contains the space you want to use to create the new drive.

Switches

/create

Creates a new compressed drive by using free space on the uncompressed drive specified by drive1. This switch can be abbreviated to /cr.

/newdrive=drive2:

Specifies the drive letter for the new compressed drive. The /newdrive switch is optional; if you omit it, DoubleSpace assigns the next available drive letter to the new drive. This switch can be abbreviated to /n.

/reserve=size

Specifies how many megabytes of free space DoubleSpace should leave on the uncompressed drive. To make the compressed drive as large as possible, specify a size of 0.

You can include either the /reserve switch or the /size switch, but not both. If you omit both switches, DoubleSpace reserves 1 MB of free space. The /reserve switch can be abbreviated as /re.

/size=size

Specifies the total size, in megabytes, of the compressed volume file. (This is the amount of space on the uncompressed drive that you want to allocate to the compressed drive.) You can include either the /reserve switch or the /size switch, but not both. The /size switch can be abbreviated as /si.

Examples

To create a new compressed drive that uses all available space on uncompressed drive E, type the following command:

dblspace /create e: /reserve=0 

To create a new compressed drive by using 10 MB of space on uncompressed drive E, type the following command:

dblspace /create e: /size=10 

To create a new compressed drive by using space on uncompressed drive D, and to direct DoubleSpace to leave 2.75 MB of free space on drive D, type the following command:

dblspace /create d: /reserve=2.75 

The following command creates a new compressed drive by using all but 1MB of the space on drive D:

dblspace /create d: 

Because the command includes neither the /reserve switch nor the /size switch, DoubleSpace uses the default value for the /reserve switch and leaves 1 MB of space on drive D.

Dblspace /Defragment

Defragments the selected compressed drive. Defragmenting a compressed drive consolidates the free space on it. If you are planning to reduce the size of a compressed drive, you should first use the defragment command to consolidate the drive's free space. You can then make the drive smaller than you could if you did not first defragment it.

Syntax

dblspace /defragment [drive**:**]

Parameters

drive1:

Specifies the drive you want to defragment. This parameter is optional; if you do not specify a drive, DoubleSpace defragments the current drive.

Switch

/defragment

Directs DoubleSpace to defragment the specified drive. This switch can be abbreviated as /def.

Note

The defrag command optimizes disk performance by reorganizing the files on a drive. You can use defrag to optimize uncompressed drives. Although you can run defrag on a compressed drive, doing so will probably not improve your system's speed.

Unlike the defrag command, the dblspace /defrag command does not speed up your system. Dblspace /defrag simply consolidates a compressed drive's free space so that all the free space is at the end of the compressed volume file. This enables you to reduce the size of the compressed drive more than you otherwise could.

Example

To defragment drive D, you would type the following at the command prompt:

dblspace /defragment d: 

To defragment the current drive, type the following command:

dblspace /defragment 

Dblspace /Delete

Deletes the selected compressed drive and erases the associated compressed volume file.

Caution: Deleting a compressed drive erases the entire drive and all the files it contains.

Syntax

dblspace /delete drive :

Parameters

drive:

Specifies the drive you want to delete. (DoubleSpace will not allow you to delete drive C.)

Switch

/delete

Deletes the specified drive. This switch can be abbreviated as /del.

See dblspace /delete—Note for information about restoring a compressed drive that has been accidentally deleted.

Note

If you accidentally delete a compressed drive, you might be able to restore it by using Microsoft Undelete. When DoubleSpace deletes a compressed drive, it actually deletes a file on your uncompressed drive. This file is called the "compressed volume file". A compressed volume file has a filename in the form DBLSPACE.xxx (for example, DBLSPACE.000).

First, restore the deleted compressed volume file by using Undelete. Once you have restored the file, remount it by using the dblspace /mount command.

For information about using Microsoft Undelete, see the chapter "Managing Your System" in the MS-DOS 6 User's Guide.

Example

The following command directs DoubleSpace to delete compressed drive E:

dblspace /delete e: 

DoubleSpace then deletes the compressed volume file for drive E. This completely erases drive E and all the files it contains.

Note: You cannot delete drive C.

See dblspace /delete for information about restoring a compressed drive that has been accidentally deleted.

Dblspace /Format

Formats the selected compressed drive.

Caution: Formatting a compressed drive deletes all the files it contains. You cannot unformat a drive that has been formatted by using dblspace /format.

Syntax

dblspace /format drive :

Parameters

drive:

Specifies the drive you want to format. (DoubleSpace will not allow you to format drive C.)

Switch

/format

Directs DoubleSpace to format the specified compressed drive. This switch can be abbreviated as /f.

Example

The following command directs DoubleSpace to format compressed drive E:

dblspace /format e: 

DoubleSpace then formats compressed drive E, which completely erases all the files on it.

Dblspace /Info

Displays information about the selected drive's free and used space, the name of its compressed volume file, and its actual and estimated compression ratios.

Syntax

dblspace [/info] drive**:**

Parameters

drive:

Specifies the compressed drive about which you want information.

Switch

/info

Directs DoubleSpace to display information about the selected drive. This switch is optional and can be omitted as long as you specify a drive letter.

Examples

The following command displays information about drive C:

dblspace /info c: 

The following command displays information about drive E:

dblspace e: 

Dblspace /List

Lists and briefly describes all your computer's drives (except network drives).

Syntax

dblspace /list

Switch

/list

Directs DoubleSpace to display a list of your computer's local (non-network) drives. This switch can be abbreviated to /l.

Example

The following command displays a list of your computer's drives (except network drives):

dblspace /list 

Dblspace /Mount

Establishes a connection between a compressed volume file (CVF) and a drive letter so that you can use the files the CVF contains. DoubleSpace usually mounts CVFs automatically. You need to mount a CVF only if you previously unmounted it, or if the CVF is located on a floppy disk.

Syntax

dblspace /mount[=nnn] drive1: [/newdrive=drive2:]

Parameters

drive1:

Specifies the drive that contains the compressed volume file you want to mount. You must specify a drive letter.

Switches

/mount=nnn

Directs DoubleSpace to mount the compressed volume file with the filename extension specified by the nnn parameter. For example, to mount a CVF named DBLSPACE.001, you would specify /mount=001. If you omit the nnn parameter, DoubleSpace attempts to mount the compressed volume file named DBLSPACE.000. The /mount switch can be abbreviated as /mo.

/newdrive=drive2:

Specifies the drive letter to assign to the newly mounted compressed drive. This switch is optional; if you don't specify a drive letter, DoubleSpace assigns the new drive the next available drive letter. This switch can be abbreviated as /new.

Examples

To mount a compressed floppy disk in drive A, you would type the following:

dblspace /mount a: 

To mount the compressed volume file DBLSPACE.001 located on uncompressed drive D, you would type the following:

dblspace /mount=001 d: 

Dblspace /Ratio

Changes the estimated compression ratio of the selected drive. DoubleSpace uses this ratio to estimate how much free space the drive contains. You might want to change the estimated compression ratio if you plan to store new files with a compression ratio that differs greatly from the current ratio.

Each time you start your computer, DoubleSpace adjusts the estimated compression ratio to match the average compression ratio of the data currently stored on the drive.

Syntax

dblspace /ratio[=r.r] [drive**:** | /all]

Parameters

drive:

Specifies the drive for which you want to change the estimated compression ratio.

You can include either a drive letter or the /all switch, but not both. If you specify neither the drive nor the /all switch, DoubleSpace changes the estimated compression ratio for the current drive.

Switch

/ratio=r.r

Changes the estimated compression ratio of the specified drive(s). To change the ratio to a specific number, specify the ratio you want. You can specify a ratio from 1.0 to 16.0. If you don't specify a ratio, DoubleSpace sets the drive's estimated compression ratio to the average actual compression ratio for all the files currently on the drive. This switch can be abbreviated as /ra.

/all

Specifies that you want to change the ratio of all currently mounted compressed drives. (If you use this switch, you cannot also specify a value for the drive parameter.)

Examples

To change the estimated compression ratio of all your compressed drives to match each drive's actual compression ratio, type the following command:

dblspace /ratio /all 

To change drive D's estimated compression ratio so that it is 3.2 to 1, you would type the following:

dblspace /ratio=3.2 d: 

To change the estimated compression ratio of the current drive to 6 to 1, you would type the following:

dblspace /ratio=6 

Dblspace /Size

Enlarges or reduces the size of a compressed drive. You might want to enlarge a compressed drive if its host drive contains plenty of free space. You might want to reduce the size of a compressed drive if you need more free space on the host drive.

Syntax

dblspace /size[=size1 | /reserve=size2] drive**:**

Parameters

drive:

Specifies the drive you want to resize.

Switches

/size=size1

Changes the size of the specified drive. You can specify the new size of the drive by using the size1 parameter. The size of the drive is the number of megabytes of space that the drive's compressed volume file uses on the uncompressed (host) drive. The /size switch can be abbreviated as /si.

You can specify the drive's new size by using either the size1 parameter or the /reserve switch, but not both. If you include neither the size1 parameter nor the /reserve switch, DoubleSpace makes the drive as small as possible.

/reserve=size2

Specifies how many megabytes of free space you want the uncompressed (host) drive to contain after DoubleSpace resizes the drive. The /reserve switch can be abbreviated as /res.

You can specify the drive's new size by using either the /reserve switch or the size1 parameter of the /size switch, but not both. If you include neither the /reserve switch nor the size1 parameter, DoubleSpace makes the drive as small as possible.

Examples

To change the size of drive C so that its compressed volume file uses 60 MB of space on drive D, type the following command:

dblspace /size=60 c: 

To change the size of drive E so that its host drive, drive D, contains 20 MB of free uncompressed space, type the following command:

dblspace /size /reserve=20 e: 

To change the size of drive C so that it is as large as possible, type the following command:

dblspace /size /reserve=0 c: 

Dblspace /Unmount

Breaks the connection between the selected drive's compressed volume file and its drive letter. Unmounting a drive makes it temporarily unavailable.

You cannot unmount drive C.

Syntax

dblspace /unmount [drive**:**]

Parameters

drive:

Specifies the drive you want to unmount. This parameter is optional; if you omit it, DoubleSpace unmounts the current drive.

Switch

/unmount

Unmounts the specified compressed drive. This switch can be abbreviated as /u.

Example

To unmount compressed drive E, type the following command:

dblspace /unmount e: 

DBLSPACE.SYS

Determines the final memory location of DBLSPACE.BIN.

DBLSPACE.BIN is the part of MS-DOS that provides access to your compressed drives. When you start your computer, MS-DOS loads DBLSPACE.BIN along with other operating system functions, before carrying out the commands in your CONFIG.SYS and AUTOEXEC.BAT files. DBLSPACE.BIN always loads in conventional memory because it loads before device drivers that provide access to upper memory.

When you run DoubleSpace Setup, it adds a device command for DBLSPACE.SYS to your CONFIG.SYS file. To move DBLSPACE.BIN to upper memory, change the device command for DBLSPACE.SYS to a devicehigh command.

Syntax

device = [drive**:**][path]dblspace.sys /move

devicehigh = [drive**:**][path]dblspace.sys /move

Parameter

[drive:][path]

Specifies the location of the DBLSPACE.SYS file.

Switch

/move

Moves DBLSPACE.BIN to its final location in memory.

Initially, DBLSPACE.BIN loads at the top of conventional memory. When DBLSPACE.SYS is loaded by using the device command, DBLSPACE.BIN moves from the top of conventional memory to the bottom. This can be useful for avoiding conflicts with programs that require access to the top of conventional memory.

When DBLSPACE.SYS is loaded by using the devicehigh command, DBLSPACE.BIN moves to upper memory, if available. Moving DBLSPACE.BIN to upper memory makes more conventional memory available.

Notes

DBLSPACE.SYS does not provide access to compressed drives

The DBLSPACE.SYS device driver does not provide access to compressed drives; it simply moves DBLSPACE.BIN to its final location in memory. (DBLSPACE.BIN is the part of MS-DOS that provides access to compressed drives; it loads with other operating system functions, before MS-DOS carries out the commands in your CONFIG.SYS file.)

Avoiding conflicts with programs that require access to the top of conventional memory

When you start your computer, MS-DOS loads DBLSPACE.BIN at the top of conventional memory. A few programs require access to the top of conventional memory and do not work properly if DBLSPACE.BIN is located there. To avoid such conflicts, DoubleSpace Setup adds a device command for DBLSPACE.SYS before any command that starts a program that is known to require this area of memory. When loaded with a device command, the DBLSPACE.SYS device driver moves DBLSPACE.BIN from the top of conventional memory to the bottom of conventional memory.

Moving DBLSPACE.BIN to upper memory

When loaded with a devicehigh command, the DBLSPACE.SYS device driver moves DBLSPACE.BIN from conventional to upper memory. If there is no upper memory block large enough to accommodate DBLSPACE.BIN, it is instead moved to the bottom of conventional memory.