Batch Commands

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.

This chapter is a complete reference for the commands supplied with MS-DOS 6. It includes an explanation of command syntax, a description of each command, and notes and examples.

This chapter is a printed version of the online Help available in MS-DOS 6. To view the command reference online, type help followed by the command name at the command prompt. To see the Help table of contents, type help with no parameters. For a list of MS-DOS commands, type fasthelp at the command prompt.

A batch file or batch program is an unformatted text file that contains one or more MS-DOS commands and is assigned a .BAT extension. When you type the name of the batch program at the command prompt, the commands are carried out as a group.

Any MS-DOS command you use at the command prompt can also be put in a batch program. In addition, the following MS-DOS commands are specially designed for batch programs:

call

for

pause

choice

goto

rem

echo

if

shift

CONFIG.SYS Commands

The CONFIG.SYS file is a text file that contains special commands. These commands configure your computer's hardware components so that MS-DOS and applications can use them. When MS-DOS starts, it carries out the commands in the CONFIG.SYS file. Typically, the CONFIG.SYS file is located in the root directory of drive C.

The following CONFIG.SYS commands can be used only in the CONFIG.SYS file:

buffers

drivparm

numlock

country

fcbs

shell

device

files

stacks

devicehigh

install

switches

dos

lastdrive

 

The following commands are commonly used in the CONFIG.SYS file and can also be typed at the command prompt:

break

rem

set

The following special CONFIG.SYS commands are used only to define multiple configurations within the CONFIG.SYS file:

include

menuitem

menucolor

submenu

menudefault

 

For more information about defining multiple configurations, see Commands for Defining Multiple Configurations.

The CONFIG.SYS file can also contain the following special characters:

;

Specifies that the current line is a descriptive comment and should not be carried out. Insert this character at the beginning of the line. (You can also insert a comment by using the rem command.)

?

Specifies that MS-DOS is to ask for confirmation before carrying out the current command. Insert this character just before the equal sign (=). For example, to have MS-DOS ask for confirmation before carrying out the dos=high command, you would change the command to read dos?=high.

Bypassing CONFIG.SYS and AUTOEXEC.BAT Commands

If you are having system problems that you suspect are caused by one or more commands in your CONFIG.SYS file, you might want to bypass some or all of the commands in your CONFIG.SYS file.

To bypass all the commands in your CONFIG.SYS and AUTOEXEC.BAT files, press the F5 key immediately after starting your computer, when you see the text "Now starting MS-DOS...".

To bypass individual CONFIG.SYS commands, press the F8 key instead. MS-DOS will then prompt you to carry out or bypass each CONFIG.SYS command. To carry out all remaining startup commands, press F5. To bypass all remaining startup commands, press ESC.

To disable this feature, add the switches /n command to your CONFIG.SYS file.

For more information about your CONFIG.SYS file, see the chapter "Configuring Your System" in the MS-DOS 6 User's Guide.

Device Drivers

The following installable device drivers are provided with MS-DOS:

ANSI.SYS

HIMEM.SYS

CHKSTATE.SYS

INTERLNK.EXE

DBLSPACE.SYS

POWER.EXE

DISPLAY.SYS

RAMDRIVE.SYS

DRIVER.SYS

SETVER.EXE

EGA.SYS

SMARTDRV.EXE

EMM386.EXE

 

The files COUNTRY.SYS and KEYBOARD.SYS are not device drivers. They are data files for the country and keyb commands, respectively. Do not try to load either of these files with the device command. If you do, your system halts, and you cannot restart MS-DOS. For information about loading COUNTRY.SYS, see the country command. For information about loading KEYBOARD.SYS, see the keyb command.

International Commands

The following commands are useful when changing country-specific settings and character sets (code pages):

chcp

mode

country

nlsfunc

keyb

 

Commands for Defining Multiple Configurations

A single CONFIG.SYS file can define several different system configurations. To define multiple configurations, you use the following special CONFIG.SYS commands:

include

menuitem

menucolor

submenu

menudefault

 

To define multiple configurations, follow these general steps:

1. Define a startup menu in the CONFIG.SYS file by using a [menu] header followed by one or more menuitem commands. The menudefault, menucolor and submenu commands can be used to define special characteristics of the startup menu.

2. Create a configuration block in the CONFIG.SYS file for each configuration you want. A configuration block begins with a block header — a name surrounded by square brackets. To each block, add the CONFIG.SYS commands that you want MS-DOS to carry out when that configuration is selected from the startup menu.

3. (Optional) In the AUTOEXEC.BAT file, use batch commands such as goto and if to have MS-DOS carry out different AUTOEXEC.BAT commands depending on the startup configuration.

When a configuration is selected from the startup menu, MS-DOS defines an environment variable named CONFIG and sets it to the name of the selected configuration block. To have MS-DOS carry out different sets of commands for different CONFIG values, add a goto %config% command to your AUTOEXEC.BAT file.

For more information about defining multiple configurations, see the chapter "Configuring Your System" in the MS-DOS 6 User's Guide.

Defining Multiple Configurations in Your CONFIG.SYS File

The following CONFIG.SYS file defines two configurations:

[Menu]
menuitem=Steve
menuitem=Lisa
[Common]
dos=high
buffers=15
device=c:\dos\himem.sys
[Steve]
files=20
device=c:dos\emm386 2048
[Lisa]
files=40
device=c:\net\network.sys
[Common]

This CONFIG.SYS file configures the computer for either Steve or Lisa. For both configurations, MS-DOS carries out the three commands in the first [common] section: dos=high, buffers=15, and device=c:\dos\himem.sys. Steve uses a desktop publishing program that requires expanded memory, so his configuration includes a command for EMM386. He does not use the network. Lisa uses the network but not desktop publishing. Her configuration starts the network driver.

Defining Multiple Configurations in Your AUTOEXEC.BAT File

When a configuration is selected from the startup menu, MS-DOS defines an environment variable named CONFIG and sets it to the name of the selected configuration block. In the AUTOEXEC.BAT file, you can use the goto command to have MS-DOS carry out different sets of commands for different CONFIG values.

The following AUTOEXEC.BAT file uses the goto command with the CONFIG variable to carry out different sets of commands. This AUTOEXEC.BAT file is designed to work with the sample CONFIG.SYS file in the preceding section.

c:\dos\smartdrv.exe
set temp=c:\temp
c:\dos\msav
; Go to the section that matches the current
; value of the CONFIG variable
goto %config%
:Steve
path=c:\dos;c:\deskpub;c:\typeset
c:\mouse\mouse.com
deskpub`
; now skip Lisa's section & go to end
goto end
:Lisa
path=c:\dos;c:\network;c:\utility
doskey
net logon lisa
goto end
:end

When MS-DOS runs this AUTOEXEC.BAT file, it starts SmartDrive, sets the TEMP environment variable, and starts the MS-DOS Anti-Virus program. MS-DOS then goes to the section that matches the value of the CONFIG variable.

If the name of the selected configuration is "Steve," MS-DOS goes to the Steve section. It then sets the search path for Steve, loads the MOUSE.COM program from the C:\MOUSE directory, and runs the desktop publishing program. The goto end command instructs MS-DOS to skip to the End section; this prevents the commands in the Lisa section from being carried out for Steve's configuration.

If the current configuration is "Lisa," the search path is set differently, MS-DOS runs the Doskey program, and a Logon command instructs the network driver (loaded from the CONFIG.SYS file) to connect the computer to the network.