Information On Batch Files: Quick Links
Information On Batch Files: Quick Links
Quick links
Batch file ABCs
Creating a batch file
Batch commands
Batch file examples
Technical support
Debug Routines
Batch file ABCs
Batch files allow MS-DOS and Microsoft Windows users to
create a lists of commands to run in sequence once the batch
file has been executed. For example, a batch file could be used
to run frequently run commands, deleting a series of files,
moving files, etc. A simple batch file does not require any
special programming skills and can be done by users who have
a basic understanding of MS-DOS commands.
A good example of a batch file for someone who is more
familiar with Windows or the MacOS is to think of a batch file as
a shortcut in Windows or an icon on the MacOS. Much like a
shortcut, batch files could be used to run one or more
commands or programs through the command line.
Another example of a very well known batch file is
the autoexec.bat, which is a boot batch file loaded each time
the computer boots into MS-DOS and early versions of
Windows. This batch file contained all the necessary commands
and programs used to run MS-DOS and Windows each time the
computer booted.
Creating a batch file
MS-DOS users
Microsoft Windows and other users
MS-DOS users
To create a basic batch file in MS-DOS, follow the below steps that
give you an example of how to create a basic batch file.
1. Open an MS-DOS command window or get to MS-DOS.
2. At the MS-DOS prompt, type: edit test.bat and press enter.
@echo off
echo Hello this a test batch file
pause
dir c:\windows
5. Click File and click Save; browse to where you want to save
the file. For the file name, type "test.bat", and if your version
of Windows has a "Save as type" option, choose "All files",
otherwise it will save as a text file. Once all of this has been
done click the Save button and exit notepad.
6. Now, to run the batch file, double-click or run the file like any
other program. Once the batch file has completed running it
will close the window automatically.
Batch commands
Just like all MS-DOS commands, all batch file commands are
not case sensitive. However, in the below listing we have listed all
commands in all caps to help you identify what is a command and
what is not.
@
Does not echo back the text after the at symbol. This
most commonly used as @ECHO OFF to prevent any of
the commands in the batch file from being displayed,
just the information needed.
%1
::
CALL
ECHO
EXIT
GOTO
LABEL
IF
PAUSE
REM
SHIFT
START
Questions
MS-DOS
CH000010
CH000036
CH000209
CH000319
CH000320
CH000321
How to shut down and restart the computer with a batch file.
CH000322
CH000323
CH000435
CH000540
CH000570
CH000738
CH000754
CH000785
CH000932
CH000987
How can I make a batch file rename a file to the date or time?
CH001041
CH001049
CH001050
How can I loop or start a batch file over after it has completed?
CH001102
CH001313
CH001345
Forum
If your question is not listed on this page, try our online forum.