Batch File Commands
echo. creates a new line
echo off turns of returning the text for commands
echo on turns on returning text for commands
echo [text] displays the [text] provided
echo This text will be displayed.
Remark used to place comments
Rem This part is now a comment and will
not be executed
Allows you to assign locations to various sections of
the batch file. Used in conjunction with GOTO to skip
certain sections or return to certain sections.
Proceed to the specified section. Used with LABEL to
effectively skip and return to sections.
echo This is the start section.
Used to assess whether a given condition is true or
not (see below).
Determines if the returned errorlevel is within a certain
level, then executes a given command.
if errorlevel 5 goto end
Allows a batch file to wait for a user to select an
option from a set of choices. /C: specifies the
allowable keys, /N makes it so available choices
aren't displayed at the end of the prompt string.
choice /C:12345 /N Please Choose 1, 2,
3,4, or 5.
Determines if a file or directory exists. If it does,
execute the given command.
if exist %filename%.%xname% echo
if not exist
Determines if a file or directory doesn't exist. If it
doesn't, execute the given command.
if not exist %filename%.%xname% echo
%filename%.%xname% NOT FOUND!
Used to prompt the user for input and assign the
value of that input to a variable.
input xname "Give me the extension of
the file you are looking for: "
Used to remove the extension from a file, and assign
the name of the file to a variable.
justname filename %fullname%
Clears the screen of all text and display the prompt.
echo This will display some text.
rem The above text will be cleared from
the screen and only a prompt will be
Ceases operation of the batch file until the