Command: batch files
BATCH FILES contain a sequence of DOS commands. By running the BATCH
FILE, this sequence is run. This can be used to save time, so that a
set of commands does not have to be typed out in full at the DOS prompt
each time.
BATCH FILES are text files, but with the .bat file extension. They can
be created or edited with a text editor such as EDIT or EDLIN.
To run a BATCH FILE, simply type its name at the DOS prompt, with or
without the .bat extension.
A very important BATCH FILE, AUTOEXEC.BAT is run automatically when
FreeDOS starts. You can load necessary drivers while booting the system
with this file.
Syntax:
- none -
Options:
- none -
Comments:
Some commands are especially designed for use in programming batch files.
autoexec.bat The automatic batch file,
beep Makes a beeping sound,
call Runs another batch file,
choice Prompts the user to make a choice,
cls Clears the screen,
echo Print a message, turn batch file display on/off,
for For loop (repeat commands),
goto Continue running from somewhere else in the batch file,
if If condition (choose between two sets of commands),
lh Loads a program into the upper memory area,
loadhigh Loads a program into the upper memory area,
path Displays or sets a search path for executable files,
pause Waits for user to press a key,
prompt Changes the way command prompt appears,
rem Expanatory remarks for the programmer,
set Displays, sets, or removes environment variables,
shift Shifts the numbering of batch file parameters.
You can use the commands beep, cls, echo, lh, loadhigh, path,
prompt and set outside of a batch file too.
BATCH commands are a command internal to command.com
and need no other file in order to work.
Examples:
IN A .BAT FILE / AUTOEXEC.BAT:
Example for creating a batch file:
type: edit foo.bat
then edit should open and you can type the following example in it:
C:\fdos\bin\chkdsk c:
C:\fdos\bin\defrag c:
C:\fdos\bin\dosfsck c:
then goto "file" - "save" and close edit.
When you type foo.bat the commands will be executed.
See also:
autoexec.bat beep call choice cls
echo edit edlin for goto
if lh loadhigh path pause
prompt rem set shift
File:
Please read this command's lsm file also.
You will find the updated version (internet) here and
the version described in this manual page here.
The lsm file contains information about the name of the programmer,
the download site, and some other command related information.
Copyright © 2003 Robert Platt, updated 2007 by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.