batch file abc's - Computer Definition
This tutorial is for Windows PC users who want to routinely perform a series of file management operations without having to enter commands one at a time. Using a text editor such as Notepad, type each command on a separate line in the order of execution. Save the file with a .CMD extension. If the following commands are saved in a batch file named BACKIMAGES.CMD, every time BACKIMAGES is run, the Xcopy commands will be executed in sequential order: BACKIMAGES.CMD xcopy \images\*.gif \backup /m xcopy \images\*.jpg \backup /m xcopy \images\*.png \backup /m C:\BATCHFILES>backimages run script Tip! Store all batch files in a dedicated folder and add that folder to the Path environment variable so that any batch file can be executed from any prompt (see Path environment variable). SELECTIVE OPERATION A batch file can include multiple tasks, and the user can choose which one to execute. See Choice. USER INPUT A batch file can be flexible and accept user input. The percent sign (%) symbol is used to indicate the parameter variables that are replaced with actual user input when the command is executed. Notice the behavior if the following command were in a batch file named SAVE.CMD: batch command: xcopy \%1\*.%2 g:\ /m user enters: C:\>save bob gif executes as: xcopy \bob\*.gif g:\ /m STOP A RUNNING BATCH FILE To stop a batch file in operation, press Ctrl-C or Ctrl-Break.