Presentation is loading. Please wait.

Presentation is loading. Please wait.

Working with the Command- Line Interface

Similar presentations


Presentation on theme: "Working with the Command- Line Interface"— Presentation transcript:

1 Working with the Command- Line Interface
Chapter 14

2 Overview In this chapter, you will learn to
Explain the operation of the command-line interface Execute fundamental commands from the command line Manipulate files and folders from the command line

3 Historical/Conceptual
IBM invented the PC in the late ’70s but needed an operating system Digital Research had an OS but turned them down IBM went to a small company (Bill Gates at Microsoft) that had created BASIC Microsoft had never written an OS but accepted the challenge Gates found an OS called Quick-and-Dirty-Operating-System (QDOS) and purchased it from the person who wrote it Microsoft released it as MS-DOS V 1.1 (Microsoft Disk Operating System) MS-DOS 6.22 ultimately released in 1994 DOS used a command-line interface

4 Deciphering the Command-Line Interface
IT Technician CompTIA A+ Technician Deciphering the Command-Line Interface

5 Command-Line Interface (CLI)
How does a command-line interface work? Begins with a prompt indicating the computer is ready to do something Type in a command and press ENTER The command is executed A new prompt is displayed—ready for the next command CLI executes commands like the Windows GUI In CLI, type the command and press ENTER In GUI, point and click to execute commands

6 Accessing the Command Line
In Windows 2000 use the Run dialog box Start | Run Type cmd You may also access the command line through the Start | All Programs menu

7 The command prompt is always focused on a specific folder
Any commands operate on the files and folders in the folder in which you are focused You must first focus on the drive and folder where you want to work

8 Filenames and File Formats
Each program or piece of data is stored as a file on the drive Filenames have two parts Filename In DOS, up to 8 characters long Extension In DOS, up to 3 characters long Optional The filename and extension are separated by a dot Called the 8.3 naming system These characters may not be used / \ [ ] | ÷ + = ; , * ? Windows Filenames Windows allows a lot of freedom in file naming, but it still has a handful of characters that you can’t use for file or folder names: / \ [ ] | ÷ + = ; , * ? Filenames may be up to 255 characters in length

9 The extension tells the computer the type of file
Filenames and Formats Windows does not restrict the filename to 8.3 (can be up 255 characters) To be backward-compatible with DOS you need to follow the 8.3 standard Windows creates two filenames for every file to ensure backward-compatibility The extension tells the computer the type of file .exe, .doc, .xls

10 All files written in binary format
File Formats All files written in binary format American Standard Code for Information Interchange (ASCII) used for text Universal file format Defines bit characters Unicode Uses 16-bit code to cover every character for the most common languages

11 ASCII Character Chart

12 At boot, Windows assigns partitions and a drive letter
Drives and Folders At boot, Windows assigns partitions and a drive letter Floppy drives are usually assigned A: or B: Hard drive partitions may be assigned C: to Z: CD-ROM drives are named after hard drives Windows uses a hierarchical directory tree Files are put into groups called folders In DOS we call folders directories The root directory is at the beginning of the hierarchical structure with folders underneath Windows calls all folders folders except for the root, which still gets the old term directory, as in root directory. In practice, though, the terms directory and folder are interchangeable. Some techs split hairs and call these data containers folders when you’re in the GUI, but directories when you’re at a command prompt. It’s the same thing!

13 Folders and files must be unique
Can’t be the same name in the same folder C:\ represents the root directory of C To describe a subfolder, add the name of the folder C:\TEST The location of a file is called the path The path of C:\test\file.txt is C:\test Tech Tip Directory trees It helps to visualize a directory tree as upside down, because in geek speak, the trunk, or “root directory”, is spoken of as if it were “above” the folders that divide it up, and those subfolders are spoken of as being “above” the folders into which they are divided. For example, “The file is in the Adobe folder under Program Files.”

14 Directory Tree

15 Mastering Fundamental Commands

16 Structure: Syntax and Switches
The command line requires the exact syntax for each command Type the name of the command and desired or allowed switches Switches modify the behavior of the command Multiple switches may be allowable DIR /W /P Displays the directory in wide mode and one page at a time

17 Help with any command is readily available in one of three ways
HELP gives a one-line description of each command HELP command gives specific help for the command Command /? gives specific help for the command

18 The DIR command lists the contents of a particular directory
The DIR/W command lists only the filenames Tech Tip Error messages are good! Let’s talk about errors in general for a moment, not just command-prompt errors like “Invalid directory,” but any error, including Windows errors. Many new computer users freeze in horror when they see an error message. Do not fear error messages. Error messages are good! They will save you. Seriously, think how confusing it would be if the computer didn’t tell you when you messed up. Error messages tell us what we did wrong so we can fix it. You absolutely cannot hurt your PC in any way by typing the DIR or CD commands incorrectly. Take advantage of this knowledge and really experiment. Intentionally make mistakes to familiarize yourself with the error messages. Have fun. Learn from errors.

19 DIR Command Switches

20 Directories: CD Command
The CD (or CHDIR) command is used to change the focus to a different directory The CD\ command is used to return to the root directory CD .. Goes up one directory To switch between drives, type the drive letter followed by a colon C: D: The Windows command-line interface almost never tells you that a command has been performed successfully. But be assured it will complain when you do something wrong! The old adage is, “DOS never pats you on the back, but it will slap you in the head!”

21 Making and Removing Directories
The MD (or MKDIR) command is used for creating a directory The DEL command is used for deleting files, and the RD (RMDIR) command is used for deleting directories and subdirectories The DELTREE command is used for deleting directories containing files and subdirectories The RD command in Windows NT, 2000, and XP will delete populated directories—that is, directories containing files or subdirectories. Use the /S switch: Type RD /S and the directory name.

22 Running a Program To run a program:
Change the DOS focus to the directory where the program is stored CD C:\Program Files\My Program Type the filename with or without its extension and press ENTER Setup.exe By and large, you can’t run Windows GUI-based applications within a command-line environment. Most will simply pop open in their own window, just as if you opened them from the Start menu. Try typing SYSEDIT at the command prompt within Windows and see what happens!

23 Working with Files

24 Working with Files Attributes (H, R, S, A) are special values assigned to a file Hidden: hides the file Read-only: protects a file from being deleted or modified System: identifies system files Archive: identifies files that have not been backed up The ATTRIB.EXE program is used to inspect and change file attributes

25 Attrib Attrib can be used to change the attributes
Use + to add attribute Use – to remove attribute Attrib +R AILOG.TXT Makes it read only Attrib –H AILOG.TXT Makes it no longer hidden

26 Working with Files Wildcards:
Wildcards are special characters that enable commands to act on more than one file at a time The * represents any number of characters The ? represents a single character DIR *.TXT Lists all files that end in .TXT DIR *.?XT Lists all files that end in XT

27 Working with Files REN command is used to rename files
DEL and ERASE commands are used to delete files COPY command is used for making a copy of the file in a new location MOVE command is used for moving the file to a new location XCOPY command is used for working with multiple directories

28 Mike’s Five-Step COPY/MOVE Process
Point the command prompt to the directory containing the files to be copied or moved C:\> CD \DOCS 2. Type COPY or MOVE and a space C:\DOCS> COPY 3. Type the name(s) of the file(s) to be copied/moved and a space C:\DOCS> COPY *.doc 4. Type the path of the new location for the files C:\DOCS> COPY *.doc c:\Steam 5. Press ENTER

29 Working with Batch Files
Batch files are text files that store a series of commands One command on each line Batch files use the .BAT extension Batch files may be edited with any text editor Notepad EDIT Batch files get their own type of icon

30 EDIT is a command-line command that starts a basic text editor
Most of the keyboard shortcuts used in WordPad, Word, and so on, were first used in the EDIT program. If you know keyboard shortcuts for WordPad or Word, many will work in EDIT.

31 Save the file with a .BAT extension
Creating a Batch File Using EDIT, type in some commands on their own line (such as cd:\ and Dir) Save the file with a .BAT extension C:\test.bat Launch a command prompt and run the batch file C:\> CD \ C:\> Test.bat Don’t try using the TYPE command on anything other than a text files—the results will be unpredictable.

32 Some additional commands are
VER shows the current version of Windows ECHO tells the batch file to put text on the screen TYPE displays the contents of a batch file on the screen SET display settings that Windows has loaded by default Don’t try using the TYPE command on anything other than a text files—the results will be unpredictable.

33 ECHO Command ECHO will display text on the screen ECHO OFF turns off the display of text on the screen @ at the beginning of a line prevents displaying the command, but not the result of the command @ECHO OFF is frequently used in batch files to “clean up” the appearance when the batch file is run

34 SET will display the list of settings that Windows loads by default
SET and PATH Commands SET will display the list of settings that Windows loads by default Programs (and batch files) are run from the location where the prompt is If the program is not located in the current folder, you receive an error message To tell your command to look in other places, use the PATH command PATH by itself lists the current list of places to look for a program PATH= location; location; location; … will add locations

35 Beyond A+

36 Using Special Keys F1 function key brings back the previous command one letter at a time F3 function key brings back the entire command at once The DOSKEY command stores a list of all previously typed commands and can be accessed by using the up arrow key Type DOSKEY Windows XP/2000 automatically starts the program With Windows 2000/XP, you can use the up and down arrow keys on the keyboard to scroll through previously typed commands.

37 COMPACT Command COMPACT
Displays or alters the compression state of files compact /c

38 CIPHER Command CIPHER Displays or alters the encryption state of files
/e specifies encryption operation /a says to apply it to the files as well as the directory When using the COMPACT and CIPHER commands, you must type in spaces between multiple parameters (for example, switches and filenames).


Download ppt "Working with the Command- Line Interface"

Similar presentations


Ads by Google