Introduction to Batch Files - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to Batch Files

Description:

Chapter 10 Introduction to Batch Files Overview A batch file is a text file that contains an ordered series of commands. Overview Batch files allow the user to – PowerPoint PPT presentation

Number of Views:255
Avg rating:3.0/5.0
Slides: 64
Provided by: ValuedGate1506
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Batch Files


1
Chapter 10
  • Introduction to Batch Files

2
Overview
  • A batch file is a text file that contains an
    ordered series of commands.

3
Overview
  • Batch files allow the user to
  • automate a process
  • create more powerful
  • commands

4
Concepts of Batch Interactive Processing
  • A batch file contains one or more commands.

5
Concepts of Batch Interactive Processing
  • A batch file must have the extension .BAT

6
Concepts of Batch Interactive Processing
  • Batch files allow the user to
  • minimize keystrokes
  • minimize the
  • possibility of errors

7
Concepts of Batch Interactive Processing
  • In interactive processing (real-time mode)
  • the user directly
  • interacts with
  • computer
  • info. is processed
  • without delay

8
How Batch Files Work
  • The difference between Data and Program files is
    determined by their file extensions.

9
How Batch Files Work
  • Priority rules are followed when the OS looks for
    a file to load and execute.

10
How Batch Files Work
  • The .BAT extension is the last file extension the
    OS looks for when trying to execute a program.

11
Using EDIT to Write Batch Files
  • To write a batch file
  • must use a program
  • that creates ASCII
  • text files.

12
Using EDIT to Write Batch Files
  • Word processing programs can create text files,
    but
  • they are very large
  • they take a long time
  • to load into memory

13
Using EDIT to Write Batch Files
  • EDIT is the small, simple text editor in MS-DOS
    used to write batch files.

14
Using EDIT to Write Batch Files
  • Notepad is the text editor in Windows that can be
    used to write batch files.

15
(No Transcript)
16
Writing and Executing a Batch File to Save
Keystrokes
  • It is sometimes easier to use COPY CON instead of
    EDIT to write a simple batch file.

17
Writing and Executing a Batch File to Save
Keystrokes
  • Two drawbacks to using COPY CON
  • Cannot correct errors
  • once ltEntergt is pressed
  • Cannot correct errors in
  • existing files

18
Writing and Executing a Batch File to Save
Keystrokes
  • Must use EDIT to correct errors.

19
(No Transcript)
20
Using Batch Files to Load Application Software
  • To launch an application in Windows
  • click program icon
  • select program from
  • menu
  • use the toolbar

21
Using Batch Files to Load Application Software
  • To launch an application program from the command
    line
  • must create a batch file

22
Using Batch Files to Load Application Software
  • Need to follow three steps in order to load
    application software in MS-DOS.

23
(No Transcript)
24
Writing a Batch File to Load an Application
Program
  • By creating a batch file, a user can simplify the
    process of loading an application program in
    MS-DOS.

25
(No Transcript)
26
Creating Shortcuts for Batch Files on the Desktop
  • To run a batch file from Windows
  • click file name in
  • Explorer/My Computer
  • create shortcut for file
  • and place on desktop

27
(No Transcript)
28
Special Batch File Commands
  • There are nine commands specifically designed to
    be used in batch files.

29
Special Batch FileCommands
  • CALL
  • CHOICE
  • ECHO

30
Special Batch File Commands
  • FOR
  • GOTO
  • IF

31
Special Batch FileCommands
  • PAUSE
  • REM
  • SHIFT

32
The REM Command
  • REM command (remarks)...
  • statements keyed in by user that tell what is
    the purpose of the batch file

33
(No Transcript)
34
The ECHO Command
  • ECHO command
  • displays a command and the output of that
    command to the screen.

35
The ECHO Command
  • The default value for ECHO is ON.

36
The ECHO Command
  • Can turn off the display of the command and only
    see the output of the command.

37
The ECHO Command
38
(No Transcript)
39
Activity Using ECHO
40
The PAUSE Command
  • PAUSE command
  • instructs the batch file to stop executing
    until the user takes some action.

41
(No Transcript)
42
Stopping a Batch File from Executing
  • Two ways to interrupt a batch file during
    execution
  • Press ltCtrlgt C
  • Press ltCtrlgt ltBreakgt

43
(No Transcript)
44
Replaceable Parameters in Batch Files
  • Many commands use variable or replaceable
    parameters.

45
Replaceable Parameters in Batch Files
  • Batch files can also use replaceable parameters.

46
Replaceable Parameters in Batch Files
  • Replaceable parameters are used to limit the
    number of batch files that do the same thing, but
    use different names.

47
Replaceable Parameters in Batch Files
  • Place holders are needed to indicate to the batch
    file that a variable (file name) will be keyed in.

48
Replaceable Parameters in Batch Files
  • The place holder used in batch files is the
    percent sign (), followed by a number (0-9).

49
Replaceable Parameters in Batch Files
  • The sign is a signal to the OS that a parameter
    is coming.

50
Replaceable Parameters in Batch Files
  • The numbers (0-9) indicate what position the
    parameter is on in the command line.

51
(No Transcript)
52
Multiple Replaceable Parameters in Batch Files
  • Many commands used in batch files may require
    more than one parameter.

53
Multiple Replaceable Parameters in Batch File
  • Batch files can have up to 10 replaceable
    parameters (0-9).

54
(No Transcript)
55
Activity Using Multiple Replaceable Parameters
56
Creating Useful Batch Files
  • With batch files a user can create new commands
    that are not provided by the OS.

57
(No Transcript)
58
Understanding AUTOEXEC.BAT
  • AUTOEXEC.BAT is a file that
  • runs when the system
  • is booted
  • contains specific
  • commands that a user
  • chooses to run

59
Understanding AUTOEXEC.BAT
  • Interactive booting
  • user is asked by the computer if s/he
    wants to execute each line in the CONFIG.SYS
    and AUTOEXEC.BAT files.

60
(No Transcript)
61
Controlling the Boot Process
  • During booting process, the user may experience
    problems that are related to instruction
    statements in the CONFIG.SYS or AUTOEXEC.BAT
    files.

62
Controlling the Boot Process
  • By pressing certain function keys, the user can
    control the boot process in order to correct
    problems that arise.

63
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com