• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Batch File Programming

In the following sections, I'll discuss programming techniques that take advantage of the extended commands provided by the CMD shell. The commands that are most useful in batch files are listed in Table 12.1.

Table 12.1. Batch File Commands
Command Use
call Calls batch file subroutine
echo Displays text to the user
setlocal/endlocal Saves/restores environment variables
exit Terminates batch file
for Iterates over files or folders
goto Used for flow control
if Executes commands conditionally
pause Lets the user read a message
pushd/popd Saves/restores the current directory
rem Used for comments and documentation
set Sets environment variables, performs calculations, and prompts for user input
shift Scans through command-line arguments
start Launches a program in a different window



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint