Exercise 1 – Create your first batch file Exercise 2 – Create a directory structure Exercise 3 – Wildcards example Exercise 4 – Wildcards example Exercise 6 - Wildcards Example Exercise 7 – Copy from one drive to another Exercise 8 – Creating a Directory structure Exercise 9 – Copying and moving files Exercise 10 – Removing directories Exercise 11 – Using the ECHO COMMAND Exercise 12 – Using the call command Exercise 13 – Replaceable parameters Exercise 14 – Replaceable parameters Exercise 15 – Replaceable parameters Exercise 16 – Replaceable parameters Exercise 17 - Paths
Batch files are files that contain a list of commands. It executes the commands within the file when you execute the batch file. The commands execute one by one. A command within a batch file can be used to start/run another application, for example you could start MS Word.
Why batch files are useful?
A batch file could be used to run frequently run commands, deleting a series of files, moving files, copying files etc. A simple batch file does not require any special programming skills and can be done by users who only know DOS commands.
An example of a well known batch file is the autoexec.bat, which is a simple batch file loaded each time the computer is loaded on MS-DOS and early Windows computers. This batch file contained all the necessary commands and programs used to run MS-DOS and Windows each time the computer booted.
Use your VMware accounts to do this lab sheet because you will need to save your work.
Next page please.
Exercise 1 – Create your first batch file 1. Open the Virtual Box then click start to load Windows 7. 2. If a dialog box appears, just click OK. 3. Open an MS-DOS command window. 4. Change to the root directory of the E: drive and create a directory called BatchFiles. You can use this directory to save your batch files. 5. At the MS-DOS prompt, open the editor by keying in EDIT and pressing