Programming Batch Files - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Programming Batch Files

Description:

A combination of commands to create one file who's commands will run one after ... couple of chapters, you may remember a 'Y' file you created in order to answer ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 19
Provided by: jmef
Category:
Tags: batch | create | files | programming | run | up

less

Transcript and Presenter's Notes

Title: Programming Batch Files


1
Programming Batch Files
  • Chapter 6

2
Batch files
  • A combination of commands to create one file
    whos commands will run one after the other in
    sequence to perform a specified task. (As
    defined in Ch. 5)

3
Certain Conditions
  • Can contain only ASCII text
  • Include commands the CLI understands
  • Have a .BAT extension in its file name

4
Various Batch Commands
  • You can create a batch file from actions or
    command lines that you put together.
  • For example, if you go back a couple of chapters,
    you may remember a Y file you created in order
    to answer questions automatically in a
    formatting batch file.

5
Name of batch file
  • After youve created a batch file, all you must
    do is enter the name of the file without the
    extension.
  • The CLI reads the .BAT extension and knows to
    execute the commands within it.

6
Echo command
  • Normally, a batch file is executed with the
    default of ECHO on.
  • This means that each line is displayed on the
    monitor as it is executed.
  • Your assignment for this chapter will be to build
    a batch file for a user.

7
Echo command
  • You will not want the user to see these
    commands. Any idea what command you would use?
  • Yes, the echo off command at the very beginning
    of the commands area of your batch file.

8
Using the _at_ sign
  • Where else have you seen this?
  • Yes, email addresses.
  • Use in the CLI to hide the display of the
    execution of any commands.

9
Using the _at_ sign
  • We did this with the echo off command.
  • Yes, but what about the echo off command. It
    will still show to the user.
  • Use the command _at_echo off command to hide even
    the echo off command from the user.

10
Displaying Empty Lines
  • Sometimes you wish to insert empty lines to make
    your batch message more readable.
  • Place a / (forward slash) after the echo command.
  • Also can use , . / \ after echo

11
REM for remarks
  • When creating a batch file, we need to place
    documentation with this.
  • Documentation tells who created this file, the
    date, name of file, and the purpose for the file.
  • When you begin your batch file (also used in
    creating programs/programming) always place REM
    statements.

12
Sample REM
13
Where do I create batch files?
  • Youll notice a familiar color to the previous
    slide.
  • Where did I create my batch file?
  • (Hint its a CLI text file.)
  • Yes, the CLI text editor.

14
Batch files
  • Be sure that when to type the edit command to
    go to the text editor, to type the name of the
    file with an extension of .bat
  • Remember, youll need to use your keyboard
    commands.

15
Batch file creation
  • Note with the example, the four REM lines, and
    then the separation between the REM lines and
    then the lines of code.
  • First line, _at_echo off.
  • In lab youll practice this process and email the
    files to me.

16
Congratulations!!!
  • Youve made it to the end!
  • Well stop in your books at page 122.
  • Next week, you will take your CLI and Chapter 1
    CISCO Exam in the computer lab at school.
  • Contact me if you have questions.

17
About the Exam
  • The Exam will be closed book, worth 100 total
    points, and comprised of the following
  • 50 objective questions (true/false multiple
    choice) 50 points.
  • Production Exam (A number of questions based on a
    hierarchical structure) 50 points.

18
If questions.
  • Please contact me during our chat session, via
    discussion board, or WebCT email.
  • Ill help you to be successful all that I can!
  • Good luck with your exam!
Write a Comment
User Comments (0)
About PowerShow.com