71
Ch 2 1 Command Syntax Using the DIR Command with Parameters and Wildcards

Command Syntax Using the DIR Command with Parameters and Wildcards

  • Upload
    devin

  • View
    63

  • Download
    0

Embed Size (px)

DESCRIPTION

Chapter 2. Command Syntax Using the DIR Command with Parameters and Wildcards. Overview. Will learn to read a syntax diagram and explain the function of each part of the diagram. Overview. Will learn some basic commands, their syntax, and how to make commands more specific. Overview. - PowerPoint PPT Presentation

Citation preview

Page 1: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 1

Command SyntaxUsing the DIR Command with

Parameters and Wildcards

Page 2: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 2

OverviewOverview

Will learn to read a syntax diagram and explain the function of each

part of the diagram.

Page 3: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 3

OverviewOverview

Will learn some basic commands, their syntax, and

how to make commands more specific.

Page 4: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 4

OverviewOverview

Will be able to define prompts and explain how they are

used.

Page 5: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 5

OverviewOverview

The purpose and function of defaults will be explained.

Page 6: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 6

OverviewOverview

Will learn how to change the default drive and directory.

Page 7: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 7

OverviewOverview

Will learn how to use subdirectories and wildcards

with the DIR command.

Page 8: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 8

OverviewOverview

The purpose and function of redirection will be explained and then will learn how to redirect the output of the DIR

command to a file or a printer.

Page 9: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 9

OverviewOverview

Will learn to use the Online Help feature.

Page 10: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 10

Command SyntaxCommand Syntax

All languages have rules or conventions for speaking

and writing.

Page 11: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 11

Command SyntaxCommand SyntaxTo communicate with computer at command line prompt:

Learn its language (commands) Follow its syntax (word order) Use correct punctuation

Page 12: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 12

Command SyntaxCommand Syntax

The graphical user interface in Windows operating system

uses syntax and rules.

Page 13: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 13

What Are Parameters?What Are Parameters?

Parameter: Information to modify or

qualify a command

Page 14: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 14

What Are Parameters?What Are Parameters?

Parameters can be: Variable Fixed

Page 15: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 15

What Are Parameters?What Are Parameters?

Variable parameter: x + y = z

Page 16: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 16

What Are Parameters?What Are Parameters?

Fixed parameter: x + 5 = z

Page 17: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 17

Reading a Reading a Syntax DiagramSyntax Diagram

Command line interface language has: Vocabulary (commands) Grammar (punctuation) Syntax (order)

Page 18: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 18

Reading a Reading a Syntax DiagramSyntax Diagram

DIR command syntax used earlier: DIR [drive:] [path] [filename] [/A [[:]

attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:] sortorder]] [/P] [/Q] [/S] [/T[[:] timefield]] [/W] [/X] [4]

Page 19: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 19

Using Fixed Parameters Using Fixed Parameters with the DIR Commandwith the DIR Command

Fixed parameter: Referred to as a switch. Begins with / (the slash).

Page 20: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 20

Using Fixed Parameters Using Fixed Parameters with the DIR Commandwith the DIR Command

Slash = forward slash (/).

\ = Backslash.

Page 21: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 21

Using Fixed Parameters Using Fixed Parameters with the DIR Commandwith the DIR Command

DIR command with /P parameter displays one screen

of information at a time.

Page 22: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 22

Using Fixed Parameters Using Fixed Parameters with the DIR Commandwith the DIR Command

Notes for lab activities: Check notes at beginning of each activity At end of work session return to Windows

desktop and follow shut-down procedure Know your laboratory procedures If system varies from text refer to the

Configuration Table in Chapter 1.6

Page 23: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 23

Activity—Using Fixed Activity—Using Fixed Parameters with DIR CommandParameters with DIR Command

KEY CONCEPTS: Clear Screen Display directory using:

/P parameter /W parameter /P /W parameters

Delimiter

Page 24: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 24

Using File Names as Using File Names as Variable ParametersVariable Parameters

File specification (name) consists of: File name File extension

Page 25: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 25

Using File Names as Using File Names as Variable ParametersVariable Parameters

Conventions for Naming Files All files in directory (subdirectory) must have unique

names. File names - mandatory - may be less than but no longer

than 256 characters File extensions - usually three characters long. Following characters illegal - may NOT be used in file

name: \ / : * ? < > | All other characters, including periods and spaces, are

legal in Windows file names.

Page 26: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 26

Using File Names as Using File Names as Variable ParametersVariable Parameters

File name reflects subject of file.

File extension usually given by application creating file.

Page 27: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 27

Using File Names as Using File Names as Variable ParametersVariable Parameters

When naming files, many older 16-bit application packages

adhere to older 8.3 DOS rules.

Page 28: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 28

Using File Names as Using File Names as Variable ParametersVariable Parameters

Can locate specific file by using file name.

Give DIR command information about file you seek:

DIR [drive:] [path] [filename] [/P] [/W]

Page 29: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 29

Using File Names as Using File Names as Variable ParametersVariable Parameters

In some syntax diagrams you will see:

[filename[.ext]]

If a file name has an extension, it must be included.

Page 30: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 30

Using File Names as Using File Names as Variable ParametersVariable Parameters

A dot (.), delimiter, is used between file name and file extension.

Example: MYFILE.TXT

Page 31: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 31

Activity—Using a File Name Activity—Using a File Name as a Variable Parameteras a Variable Parameter

KEY CONCEPTS: System messages DIR command with long file names File extensions - more than 3 characters 8.3 file name Use of quotation marks Use of /x parameterHow 8.3 name derived from LFNReasons for keeping file names short/concise

Page 32: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 32

Command Line EditingCommand Line Editing

Can reuse last command keyed in without rekeying it: <F1> - recalls one letter at a time <F3> - recalls entire command line

Page 33: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 33

Command Line EditingCommand Line EditingTable 2.1 Editing Keys Command Summary p. 53Table 2.1 Editing Keys Command Summary p. 53

Page 34: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 34

Command Line EditingCommand Line EditingTable 2.1 Editing Keys Command Summary p. 53Table 2.1 Editing Keys Command Summary p. 53

Page 35: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 35

Command Line EditingCommand Line EditingTable 2.1 Editing Keys Command Summary p. 53Table 2.1 Editing Keys Command Summary p. 53

Page 36: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 36

Activity—Using Activity—Using Command EditingCommand Editing

KEY CONCEPT: Use editing keys to recall and edit commands Overstrike mode Insert mode Delete line quickly by using <Esc> key How to search for previously entered command

Page 37: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 37

Drives as Device NamesDrives as Device Names

Device is a place to read information from/to.

Page 38: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 38

Drives as Device NamesDrives as Device Names

Disk drives have assigned device names.

Page 39: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 39

DefaultsDefaultsDefault: Implied instructions Value used unless another value

is specified

Page 40: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 40

DefaultsDefaultsAs an example, when A: \ > is displayed on screen it is the:

Prompt Default drive Designated or logged drive

Page 41: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 41

Activity—Working Activity—Working with the Defaultwith the Default

KEY CONCEPTS: “Shelling out to DOS” Using Default drive Determining drive to be searchedWhy DIR A: HELLO TXT is a very

clear request

Page 42: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 42

Brief Introduction to Brief Introduction to Subdirectories—The PathSubdirectories—The Path

Subdirectories: Used primarily on hard disks

Page 43: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 43

Brief Introduction to Brief Introduction to Subdirectories—The PathSubdirectories—The Path

Subdirectories permit the . . . grouping of files by type. disk to be divided into smaller

more manageable sections.

Page 44: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 44

Brief Introduction to Brief Introduction to Subdirectories—The PathSubdirectories—The Path

Page 45: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 45

Brief Introduction to Brief Introduction to Subdirectories—The PathSubdirectories—The Path

Root directory: Created and named by OS when

disk is formatted Indicated by the backslash (\)

Page 46: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 46

Brief Introduction to Brief Introduction to Subdirectories—The PathSubdirectories—The Path

Other subdirectories created and named by user.

Naming rules same as rules for naming files.

Page 47: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 47

Brief Introduction to Brief Introduction to Subdirectories—The PathSubdirectories—The Path

First backslash - root directory

Following backslashes – delimiters.

Page 48: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 48

Brief Introduction to Brief Introduction to Subdirectories—The PathSubdirectories—The Path

Path: Route followed by OS to locate,

save, and/or retrieve a file Subdirectory name

Page 49: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 49

Brief Introduction to Brief Introduction to Subdirectories—The PathSubdirectories—The Path

Fig 2.1 File Cabinets and Subdirectories p.63Fig 2.1 File Cabinets and Subdirectories p.63

Page 50: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 50

Activity—Using Path with Activity—Using Path with the DIR Commandthe DIR Command

KEY CONCEPTS: Delimiter for path names Backslash (first and others)

Page 51: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 51

Changing DefaultsChanging DefaultsDefault drive can be changed.

Command line is not case sensitive.

Page 52: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 52

Activity—Changing Activity—Changing the Default Drivethe Default Drive

KEY CONCEPTS: Changing default Locating file not in default directory C:\ - major subdirectory

Page 53: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 53

Changing DirectoriesChanging Directories

Default directory can be changed.

Page 54: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 54

Changing DirectoriesChanging Directories

Partial command syntax: CD [/D][Drive:][path]

Page 55: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 55

Changing DirectoriesChanging Directories

CD with no parameters - current default directory.

CD followed by path name - change default.

/D parameter - change drive and directory.

Page 56: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 56

Activity—Changing Activity—Changing DirectoriesDirectories

KEY CONCEPTS:Results of keying in

CD alone - display current default directory CD followed by path - will change default

directory CD \ - will always return to root directory

Page 57: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 57

Global File Specifications: Global File Specifications: Wildcards, the ?, and *Wildcards, the ?, and *

Global file specifications (wildcards): Can operate on group of files

instead of just a single file

Page 58: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 58

Global File Specifications: Global File Specifications: Wildcards, the ?, and *Wildcards, the ?, and *

* - represents a group of characters.

? - represents a single character.

Page 59: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 59

Activity—DIR and Activity—DIR and WildcardsWildcards

KEY CONCEPTS: Locating files with insufficient data Using * and *.* Using ? and ??? Using *.SYS

Page 60: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 60

RedirectionRedirection

Keyboard: Standard input device

Screen: Standard output device

Page 61: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 61

RedirectionRedirectionRedirection: Changes output from monitor to

somewhere else (usually file or printer) To work with printer must be local

printer Works only with commands that write to

standard output

Page 62: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 62

RedirectionRedirection

Redirection syntax command: COMMAND > DESTINATION

(Space required on both sides of >)

Page 63: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 63

Activity—Redirecting Activity—Redirecting Output to a FileOutput to a File

KEY CONCEPTS: Redirecting output to a file Redirection is “instead of” procedureDealing with write-protected disks

Page 64: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 64

Redirecting OutputRedirecting Outputto the Printerto the Printer

Can redirect computer output to a file or to a printer.

To redirect to printer need a local printer.

Page 65: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 65

Redirecting OutputRedirecting Output to the Printer to the Printer

Printers device names: PRN, LPT1, LPT2 and sometimes

LPT3.

Page 66: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 66

Activity—Redirecting the Activity—Redirecting the Output to the PrinterOutput to the Printer

KEY CONCEPTS: Redirection Hardware solutions

Page 67: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 67

Activity—Redirecting the Activity—Redirecting the Output to the PrinterOutput to the Printer

Fig 2.2 Redirected Output p.79Fig 2.2 Redirected Output p.79

Page 68: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 68

Getting HelpGetting Help

Documentation: Reference manual that comes

with any software package

Page 69: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 69

Getting HelpGetting Help In DOS 6.0 and above,

documentation provided less in written form and more

online.

Page 70: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 70

Getting HelpGetting Help

For help in DOS environment: Key in command, then a space,

forward slash, and question mark Use HELP followed by command

name

Page 71: Command Syntax Using the DIR Command with  Parameters and Wildcards

Ch 2 71

Activity—Getting Help Activity—Getting Help with a Commandwith a Command

KEY CONCEPT: Results of commands:

? ON O-N S BLP B/L/P

E D