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 / FDAUTO.BAT is run
automatically when FreeDOS starts. You can load necessary drivers while
booting the system with this file. Of course it also can be edited
according to your requirements.
Syntax:
- none -
Options:
- none -
Comments:
Some commands are especially designed for use in programming
batch files.
alias Creates, displays or removes an alias for use on the
command line.
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 alias, beep, choice, 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:\FREEDOS\BIN\chkdsk c:
C:\FREEDOS\BIN\defrag c:
C:\FREEDOS\BIN\dosfsck c:
then goto "file" - "save" and close edit.
When you type foo.bat the commands will be executed.
See also:
autoexec.bat/fdauto.bat
edit
edlin
shift
Copyright © 2004 Robert Platt, updated 2011 and 2022 by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.