Ch 2 Command Syntax - Del Mar College
Chapter 2
Command Syntax—
Using the DIR Command with Parameters and Wildcards
LECTURE NOTES
|CHAPTER OUTLINE |Learning Activities |
| |Slides 2-9 |
|CHAPTER OVERVIEW | |
|Will learn to read a syntax diagram and explain the function of each part of |Chapter Overview duplicated in the PowerPoint slides. |
|the diagram. |After completion of lecture, suggest to students that they review |
|Will learn some basic commands, their syntax, and how to make commands more |Objectives and Outcomes found on first page of chapter as a check to |
|specific. |see if they have mastered concepts. |
|Will be able to define prompts and explain how they are used. | |
|The purpose and function of defaults will be explained. | |
|Will learn how to change the default drive and directory. | |
|Will learn how to use subdirectories and wildcards with the DIR command. | |
|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. | |
|Will learn how to use the Online Help feature. | |
| | |
| | |
| | |
|COMMAND SYNTAX | |
|Command Syntax | |
|All languages have rules for speaking and writing. | |
|Syntax (word order) and punctuation of a language is important. | |
|Computers use language that consists of vocabulary, syntax, and punctuation. | |
|Commands. | |
|Similar to verbs. | |
|Action you wish to take. |SECTION 2.1 (p. 40) |
|GUI in Windows - still syntax and rules. |Slides 10-12 |
|Icon that points to a program based on rules of syntax. | |
|An error message of “Bad command or file name” is computer saying, I don't |User communicates with computer by using language that computer |
|understand. |understands. |
| |Command syntax is the language, punctuation, and order needed to |
|WHAT ARE PARAMETERS? |execute a command properly. |
|What are Parameters? |Discussion Question (1) - Define command syntax. |
|Provide information to modify/qualify command. |Discussion Question (2) - Why is syntax important when using a command?|
|Some commands. | |
|Require parameters. | |
|Have optional parameters - used for special purposes. | |
|Do not use parameters. | |
|Types of parameters. | |
|Variable parameters = user supplies value to command. | |
|Fixed parameters = cannot change fixed value (must use value provided). | |
|Parameters added to make action of command more specific. | |
| |SECTION 2.2 (pp. 40-41) |
|READING A SYNTAX DIAGRAM |Slides 13-16 |
|Reading a Syntax Diagram. | |
|Using DIR. |Discussion Question (3) - Define parameters. |
|First entry is always the command. |Discussion Question (4) -What is the difference between a variable and |
|Must be exact. |a fixed parameter? |
|Next parameters. | |
|Brackets - parameter is optional. | |
|Never key in brackets. | |
|N0 required/mandatory parameters for DIR. | |
|DIR syntax – See Power Point slide # | |
| | |
|USING FIXED PARAMETERS WITH THE DIR COMMAND | |
|Using Fixed Parameters with the DIR Command | |
|DIR uses optional parameters. | |
|Optional parameters (/W and /P are fixed). | |
|Controls how directory is displayed. | |
|/W = wide display. |SECTION 2.3 (p. 41) |
|/P = pause or paged display. |Slides 17-18 |
|With new versions rules do not change. | |
|DIR has both optional and fixed parameters. |Use analogies. |
|Slashes must be keyed in, brackets never. |- Vocabulary (commands). |
|When using DIR command by itself, files scroll by so quickly they cannot be |- Punctuation |
|read. |- Syntax (order). |
|Use /P parameter to display one screen of information at a time. |Discussion Question (5) - How would you use a syntax diagram? Why is |
|Must respond to prompt before another screen of information will appear. |the diagram important? |
| | |
|ACTIVITY—USING FIXED PARAMETERS WITH THE DIR COMMAND | |
|Using Fixed Parameters with the DIR Command | |
|Note: Whenever text refers to ACTIVITIES DISK – use working copy made in | |
|Chapter 1 labeled “ACTIVITIES DISK – Working Copy" |SECTION 2.4 (pp. 41-42) |
|Activity steps. |Slides 19-22) |
|Boot system/Open Command Prompt window | |
|Key in: CD \ then Key in: CLS |Fixed parameter referred to as switch and begins with the /. |
|Insert “ACTIVITIES Disk – Working Copy” in Drive A and make A: default drive.|Discuss. |
|Key in: DIR /P |- Difference between slash/backslash. |
|Press 3 times, and/or until reach end of display. |- Why /P more efficient than using or + S keys. |
|Key in: DIR /W |Reiterate any special lab instructions. |
|Key in: DIR /P /W |If system varies from text refer to configuration table in Chapter 1.6.|
|Return to system prompt | |
|Activity completed. | |
| | |
| | |
|USING FILE NAMES AS VARIABLE PARAMETERS | |
|Using File Names as Variable Parameters | |
|/P and /W are optional fixed parameters for DIR. | |
|Another parameter (name of file) can be used with DIR command. | |
|File naming review. | |
|Files formally called file specifications. | |
|File specifications broken into two parts: | |
|File name. |SECTION 2.5 (pp. 42-46) |
|File extension. |Slide 23 |
|Conventions for naming files: | |
|All files in a directory (subdirectory) must have unique names. |Any special lab instructions? |
|File names are mandatory. |Delimiter. |
|May be less than but no more than 256 characters long. |- / slash. |
|File extensions are usually three characters long. |- Signals one thing ending and another beginning. |
|The following characters are illegal and may NOT be used in a file name: |- Forward slash (/) used only with fixed parameters. |
|\ / : * ? < > | |Mention that there is no space between / and P and / and W. |
|All other characters, including periods and spaces, are legal in Windows file|Discussion Question (6) - Name two parameters that can be used with the|
|names. |DIR command. Explain why you would use the parameters. |
|File names should reflect subject of files. |Discussion Question (7) - Define delimiters. Give an example of a |
|File extensions usually given by application creating the file. |delimiter. |
|Many older 16-bit application packages (pre Windows 95) - | |
|Cannot deal with long file names, spaces or periods in file names. | |
|Follow older DOS rules: | |
|8 characters in name and 1 to 3 characters in optional extension. |SECTION 2.6 (pp. 47-48) |
|Some files on Internet adhere to older DOS rules. |Slides 24-30 |
|DIR syntax using /P or /W: | |
|DIR [drive:][path][filename] [/P] [/W] |Naming conventions same in Windows XP as in Windows 2000. |
|Filename in brackets |Parameters are specific to each command. |
|- is a variable optional parameter. |When giving file name give both parts - file name and file extension. |
|- plug in value or name of file. |Even though spaces and long names can be used, it’s better to keep file|
|In some syntax diagrams, you will see [filename[.ext]] |names short and concise. |
|- .ext in brackets as is part of file name syntax. |Older DOS rule called 8.3 rule. |
|File may not have an extension. |Dot (delimiter) only used between file name and file extension. |
|If file has extension | |
|- must include it. |Discussion Question (8) - Define file specifications. |
|- no spaces between file name and extension. |Discussion Question (9) - How do you separate a file name and a file |
|Delimiter used between file name and extension is dot (.) |extension? |
|When using DIR command, you will not see period or dot between file name and | |
|file extension on screen. | |
|- Directory display, dot indicated by spaces. | |
| | |
|ACTIVITY—USING A FILE NAME AS A VARIABLE PARAMETER | |
|Using a File Name as a Variable Parameter | |
|At command line with prompt A:\> . | |
|Activity steps. | |
|Key in following commands: | |
|DIR VENUS.TXT | |
|DIR NOFILE.TXT | |
|DIR STEVEN.FIL C:\WINDOWS\SYSTEM32\ | |
|DIR LONGFILENAME | |
|DDIR LONGFILENAME.EXTENSION | |
|DIR Sandy and Patty.txt | |
|DIR “Sandy and Patty.txt” | |
|DIR /X/P | |
|Continue pressing key until you reach end of display. | |
|Activity completed. | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
|COMMAND LINE EDITING | |
|Command Line Editing | |
|Can reuse last command keyed in without re-keying it. | |
|Use to recall command line one letter at a time. | |
|Use to recall entire command line. | |
|See PowerPoint slide # for Editing Keys Command Summary. | |
| | |
|ACTIVITY—USING COMMAND EDITING |SECTION 2.7 (pp. 48-52) |
|Using Command Editing |Slide 31 |
|“ACTIVITIES Disk—Working Copy” is in Drive A with A: \> displayed. | |
|Activity steps. |Discuss all parts of display with each command. |
|Key in DIIR/P |System message – File Not Found (Error message). |
|Press key twice |Can enter more than one file specification with DIR command. |
|Cancel command and clear memory of command line editor. |Can enter more than one parameter at one time when using DIR. |
|Key in the following: |Can use DIR command with long file name. |
|CLS |File extension can have more than three characters. |
|DIR FRANK.FIL |Quotation marks used to treat long file name with spaces in it as one |
|DIR VEN.99 |unit. |
|VOL |Long file name has name that adheres to 8.3 naming convention (name |
|DIR JUP.99 |called an alias). |
|DIR ORION.NEB |/X parameter - used to see 8.3 names. |
|DIR DRESS.UP RIGHT.UP |8.3 name derived from LFN by removing spaces, taking first 6 characters|
|Press following keys. |of file name and adding a tilde (~) and a number. |
|Up arrow key 2 times. |Good idea to keep file names short/concise |
|Down arrow key once. |Less chance of making typo |
| + one time. |LFNs take up needed room on floppies. |
| key |Discussion Question (10) – What is used to separate a file |
|At cursor key, key in: FILE3.FP. |specification from a path name? |
|Press following keys: | |
| then up arrow key twice. | |
| + left cursor one time. |SECTION 2.8 (p. 53) |
|Key in: FILE3.FP |Slides 32-35 |
|Press . |Discussion Question (10) – If you keyed in 10 commands and wanted to |
|Press /number that appears before DIR VEN>99 (in this case 2) |reuse a command previously keyed in, what could you do? |
|Press //D/. | |
|Press / + | |
|Press up arrow key once. | |
|Close Command Prompt window. | |
|Activity completed. |SECTION 2.9 (pp. 54-57) |
| |Slide 36 |
| | |
|DRIVES AS DEVICE NAMES |Discuss results of editing key used in this activity. |
|Drives as Device Names |Editing keys can be used to recall and edit commands. |
|Device is a place to read information from or write information to. |Overstrike mode – replaces each character you key in data. |
|Disk drives have device names (followed by a colon) assigned so Windows knows|Insert mode –“inserting data” at the cursor. |
|where to read or write. |Use shortcut ( key) to delete line quickly. |
|Drive names on stand-alone computers are typically A:, B:, or C:. |Can search for previously entered command by keying in first letter/s |
|If on network, disk drive letters can vary. |of command you are interested in. |
|Other common devices to read information from or write information to: | |
|Keyboard. | |
|Printer. | |
|Monitor. | |
| | |
|DEFAULTS | |
|Defaults | |
|Implied instructions. | |
|When you don't tell the computer what to do, it makes assumptions. | |
|Computer assumptions are called defaults. | |
|When prompt is A:> | |
|Tells you A is the default drive. | |
|Any command given will assume the default unless otherwise specified. | |
|The displayed prompt is the default, designated, or logged drive. | |
|In Explorer default drive indicated on title bar. | |
| | |
| | |
| | |
| |SECTION 2.10 (pp. 57-58) |
| |Slides 37-38 |
| | |
| |Disk drive is an example of a device. |
| |Discuss what drive names are in the lab. |
|ACTIVITY—WORKING WITH DEFAULTS |First floppy disk is called A: |
|Working with Defaults |First hard disk is called C: |
|“ACTIVITIES Disk” in Drive A. |Discussion Question (11) - What is the function and purpose of a |
|Activity steps. |device? |
|Open Command Prompt window. | |
|Key in the following: | |
|A: | |
|DIR | |
|DIR A: | |
|C: | |
|CD \ | |
|DIR A: | |
|DIR HELLO.TXT | |
|DIR A: HELLO.TXT |SECTION 2.11 (p. 58) |
|Activity completed. |Slides 39-=40 |
| | |
|A BRIEF INTRODUCTION TO SUBDIRECTORES—THE PATH |Default - very important concept. |
|A Brief Introduction to Subdirectories—The Path |Value used unless another value is specified. |
|Subdirectories are used primarily on hard disks. |Default drive is drive commands will operate on unless other |
|Allows grouping of files by type. |information is given. |
|Allows disk to be divided into smaller, more manageable sections. |Remind students that these rules apply to application software as well.|
|Windows refers to subdirectories as folders. |Default drive, designated drive, and logged drive are the same. |
|Graphically represented with folder icons. |Discussion Question (12) - Explain the function and purpose of the |
|In command line shell folders referred to as directories and subdirectories. |default drive. |
|Subdirectories can contain other subdirectories. |Discussion Question (13) - How can you tell which drive is the default |
|In C:\MYFILES\REPORTS\REP.DOC |drive? |
|First backslash (\) always represents root directory. | |
|The other backslashes are delimiters - separators between elements in the | |
|path. | |
|(elements being subdirectories). |SECTION 2.12 (pp. 58-62) |
|Every disk comes with one directory named by operating system. |Slide 41 |
|Other subdirectories are created and named by user. | |
|Rules for naming are same as for naming files. |“Shelling out to DOS” or “shelling out to command line” – when open |
|Do not usually have extensions. |Command Prompt window and changed default drive to A. |
|Subdirectory name is called the path name. |If on network hard drive letter may not be C: |
|Path is route followed by operating system to locate, save, and retrieve a |Discuss using default vs. giving drive to be searched. |
|file. |DIR A: HELLO TXT – very clear request – drive designator preceded file |
|When you see "path" in a syntax diagram substitute the directory name or |name. |
|names. | |
| | |
|ACTIVITY—USING PATH WITH DIR | |
|Using Path with the DIR Command | |
|“ACTIVITIES Disk-Working Copy” in Drive A. C:\> is displayed. |SECTION 2.13 (pp. 62-63) |
|Activity steps. |Slides 42-49 |
|Key in: | |
|DIR A: |Subdirectories used with large storage media, i.e., RW-CDs or Zip |
|DIR A:\DATA |disks. |
|DIR A:\DATA\THIN.EST |Technically, only one directory (the root), all others are |
|Activity completed. |subdirectories. |
| |Terms "directory" and "subdirectories" used interchangeably in this |
|CHANGING DEFAULTS |text. |
|Changing Defaults |Subdirectories can be used on any disk - hard or floppy. |
|Default drives can be changed so OS automatically uses drive displayed on |Directory/subdirectory names cannot be letters of the alphabet. |
|screen as default drive. |Letters of the alphabet are reserved for disk drive names. |
|Text assumes C:\WINNT\SYSTEM32. |Forward slashes (/) for parameters. |
|Be sure filled out information on Configuration Table in Chapter 1.6. |Backslashes (\) for directories. |
| |Use analogy of file cabinet (disk) and drawer (subdirectory). |
| |Discussion Question (14) - Define default subdirectory. |
|ACTIVITY—CHANGING THE DEFAULT DRIVE |Discussion Question (15) - How can you tell which directory is the |
|Changing the Default Drive |default subdirectory? |
|“ACTIVITIES Disk—Working Copy” in Drive A. C: \> is displayed. | |
|Activity steps. | |
|Change default to A:\> | |
|Key in: | |
|DIR | |
|DIR C:\ | |
|DIR C:\WINDOWS\SYSTEM32\ | |
|Activity completed. | |
| | |
|CHANGING DIRECTORIES | |
|Changing Directories | |
|Default directory can be changed as easily as default drive. | |
|Once default drive is established can establish default directory. | |
|- Do not need to specify path as default is specified. |SECTION 2.14 (pp. 63-65) |
|To change directory, key in CD (change directory), followed by the directory |Slide 50 |
|(path) name. | |
|If you key in CD with no parameters, the directory that is current is the | - indicates subdirectory listing. |
|default directory. |Use of backslash as delimiter for path names. |
|To change drives at same time as you change directories, use /D parameter. |Backslash. |
| |First \ is the root directory. |
|ACTIVITY—CHANGING DIRECTORIES |Other \’s are delimiters. |
|Changing Directories | |
|“ACTIVITIES Disk—Working Copy” is in Drive A. A: \> is displayed. | |
|Activity steps. | |
|Key in the following: |SECTION 2.15 (p. 65) |
|C: |Slide 51 |
|CD | |
|CD \WINDOWS\SYSTEM32 |Command line is not case sensitive. |
|DIR |Inform students of any differences in your lab. |
|CD |Prompt displayed on screen could look different from textbook prompt. |
|CD /D A:\DATA | |
|DIR |SECTION 2.16 (pp. 65-67) |
|CD \ |Slide 52 |
|Activity completed. | |
| |Stress importance of noticing default drive. |
|GLOBAL FILE SPECIFICATIONS: WILDCARDS, THE ?, AND THE * |Emphasize that C:\ is major subdirectory for most users. |
|Global File Specifications: Wildcards, (?, and *) |Discussion Question (16) - What steps must be done to change the |
|Allow you to work with a group of files. |default drive? Why would you change the drives? |
|Formally called global file specifications. |Discussion Question (17) – What does A:\> mean? |
|Informally called wildcards. | |
|* represents a group of characters. |SECTION 2.17 (p. 67) |
|? represents a single character. |Slides 53-55 |
|Techniques used here will also apply in Search in the GUI (in Windows |Discussion Question (19) – What steps must be done to change a |
|Desktop). |directory? Why would you change a directory? |
| | |
| | |
| | |
| | |
|ACTIVITY—DIR AND WILDCARDS | |
|DIR and Wildcards | |
|“ACTIVITIES Disk—Working Copy” in Drive A:. A: \> is displayed. | |
|Activity steps. | |
|Key in: C: | |
|Key in: CD \WINDOWS\SYSTEM32 | |
|Key in the following: | |
|DIR G | |
|DIR G*.* | |
|DIR *.SYS | |
|DIR A:\*.TXT | |
|DIR A:\?????.TXT |SECTION 2.18 (pp. 67-69) |
|DIR A:\EXP*.* |Slide 56 |
|DIR A:\EXP99*.* | |
|DIR A:\EXP??JAN.* |CD keyed in alone will display current default directory. |
|CD \ |CD followed by path (directory name) will change default directory. |
|Activity completed. |CD \ will always return to root directory. |
| |First backslash always means root directory and other backslash is a |
| |delimiter. |
| |Discussion Question (20) – What is the significance of the first |
|REDIRECTION |backslash in a command? |
|Redirection | |
|Keyboard = standard input device. | |
|Screen (monitor) = standard output device. |SECTION 2.19 (pp.69-70) |
|Redirection tells OS to redirect output somewhere else. |Slides 57-58 |
|Usually to file or printer. | |
|Printer. |DIR command & file name find one specific file. |
|Must be local, not network printer. |Global file specifications to find group of files. |
|Works only with commands that write to standard output. |Use analogy of playing cards where joker can stand for another card of |
|Redirection works with DIR. |your choice. |
|Does not work with all commands. |Discussion Question (20) - Define global file specifications. |
|Syntax is: | |
|COMMAND > DESTINATION |SECTION 2.20 (pp. 70-75) |
|Space req. on both sides of >. |Slide 59 |
| | |
|ACTIVITY—REDIRECTING OUTPUT TO A FILE |Stress importance of knowing directory where the files are located. |
|Redirecting Output to a File |Emphasize that even though DIR G will find files, should get used to |
|“ACTIVITIES Disk—Working Copy” in Drive A. C:\ is displayed. |using DIR G*.* |
|Activity steps. |Examples of using *. |
|Key in: A: |Compare using * and ? |
|Key in: DIR *.NEW |If group has common file extension .SYS can display files using wild |
|Key in: DIR *.NEW > MY.HW |cards *.SYS |
|Key in: DIR MY.HW |Discussion Question (22) - How are wildcards used? |
|Activity completed. |Discussion Question (22) - If you see C:\WINNT\SYSTEM32> on the screen,|
| |what does it mean? |
|REDIRECTING OUTPUT TO THE PRINTER | |
|Redirecting Output to the Printer | |
|Can redirect output of DIR command to printer to get a hard copy. |SECTION 2.21 (pp. 75-76) |
|Printer device name is PRN, LPT1, LPT2, and sometimes LPT3. |Slides 60-62 |
|PRN and LPT1 are usually synonymous. | |
|Must know network printer name to redirect to network printer. |Must use correct device name for printer. |
| |- PRN for default printer |
|ACTIVITY—REDIRECTING THE OUTPUT TO THE PRINTER |- LPT1, LPT2, LPT3 for printer attached to specific port. |
|Redirecting the Output to the Printer |If using network printer must know name of network printer. |
|Can this activity be done in the lab? |Can name file. |
|“ACTIVITIES Disk—Working Copy” in Drive A. A: \> is default. Printer on. |Devices have specific names. |
|Activity steps. | |
|Key in: DIR *.TXT |Discussion Question (24) - What is the purpose and function of |
|Key in: DIR *.TXT > PRN. |redirection? |
|Activity completed. | |
| | |
| | |
| | |
| |SECTION 2.22 (pp. 76-77) |
| |Slide 63 |
|GETTING HELP | |
|Getting Help |Discuss how to deal with write-protected disks. |
|Prior to DOS 5.0, was HELP in manual. |Remind students that redirection is an “instead of” procedure. |
|Reference manual is called documentation. | |
|In DOS 6.0 and above, documentation found more online than in written form. | |
|For procedures/methods used in Windows GUI, use Help choice on Start menu. | |
|May get help on command line commands in GUI help. | |
|For help with command and syntax within DOS environment. | |
|Key in name of command followed by a space, a forward slash and question |SECTION 2.23 (pp. 77-78) |
|mark. |Slides 64-65 |
|Use HELP followed by command name. | |
|Commands and syntax listed in Appendix B. |Review how disk drives are named. |
| |Any special printing procedures in lab? |
| |Difference between numeral one and letter l. |
| | |
| | |
| | |
| | |
| | |
|ACTIVITY—GETTING HELP WITH A COMMAND |SECTION 2.24 (pp. 78-79) |
|Getting Help with a Command |Slides 66-67 |
|ACTIVITIES Disk—Working Copy” in Drive A. Default drive/directory is A: \>. | |
|Activity steps. |NOTE: |
|Key in following commands: |- Are there special lab instructions? |
|DIR /? |- Is this a Read-only activity? |
|DIR /ON |- Need local printer to do this activity.- Unless your lab has |
|DIR /O-N |additional instructions. |
|DIR /S |Redirection is an “instead of” procedure. |
|DIR /BLP |Hardware solutions – manipulate hardware to get desired results. |
|DIR /B /L /P |--Done if page not ejected from local printer. |
|Press until end of display is reached. | |
|Key in: EXIT | |
|Initiate and complete Windows shut-down procedure. |SECTION 2.25 (pp. 79-80) |
|Activity completed. |Slides 68-70 |
| | |
| |Paper documentation still useful, i.e., if cannot boot system, what do |
| |you do? |
| |For procedures/methods in Windows GUI – good database info accessed via|
| |HELP choice on Start Menu. |
| |Discussion Question (25) - What would you do if you forgot the |
| |parameter for a wide DIR display? |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |SECTION 2.26 (pp. 80-84) |
| |Slide 71 |
| | |
| |Review. |
| |- Commands – verbs OS acts upon. |
| |- Use of mouse. |
| |- Parameters available with DIR command. |
| | |
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- medical terminology ch 2 quizlet
- medical terminology ch 2 quiz
- 1 15 2 command block commands
- minecraft 1 12 2 command block
- 1 12 2 command generator
- del mar fair san diego
- da form 3953 mar 1991
- 1 12 2 command block house
- 1 12 2 command block mods
- class 10 ch 2 english
- animal farm ch 2 summary
- minecraft 1 12 2 command generator