Working with the command line interface
This presentation is the property of its rightful owner.
Sponsored Links
1 / 39

Working with the Command Line Interface PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

Working with the Command Line Interface. Chapter 4. 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. Deciphering the Command Line Interface.

Download Presentation

Working with the Command Line Interface

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Working with the command line interface

Working with the Command Line Interface

Chapter 4



  • 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

Deciphering the command line interface

Deciphering the Command Line Interface

Historical conceptual


  • In the late 1970s when IBM invented the IBM Personal Computer (PC), they went looking for an OS

    • Digital Research had an OS but turned them down

    • So IBM went to a small company that had created BASIC called Microsoft and talked to its president, Bill Gates

      • Bill Gates’ company had never written an OS but he 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 (Microsoft Disk Operating System)

Command line interface

Command Line Interface

  • How does a command line interface work?

    • Begin 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

    • This is basically what you do when working in Windows’ GUI environment, except you point and click to ask the computer to execute commands

Accessing the command line

Accessing the Command Line

  • Using the Run dialog box

    • Start  Run

    • Windows NT 4.0/2000/XP: type cmd

    • Windows 9x/Me: type command

  • You may also access the command line thru the Start  Programs menu

The command prompt

The Command Prompt

  • The command prompt is always focused on a specific folder

    • Any commands operate on the files and folders in the folder you are focused in

    • You must first focus on the drive and folder where you want to work

File names and formats

File Names and Formats

  • Each program or piece of data is stored as a file on the drive

  • Files names 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

  • The following characters may not be used

    • / \ [ ] | ÷ + = ; , * ?

File names and formats1

File Names and Formats

  • Windows does not restrict the filename to 8.3, but to be backward compatible you need to follow the 8.3 standard

    • Windows creates two file names for every file to ensure backward compatibility

  • The extension tells the computer the type of file

  • All files are stored in a binary format

    • The method of binary organization is called the file format

    • American Standard for Information Interchange (ASCII) is a commonly understood file format



  • American Standard Code for Information Interchange (ASCII)

    • Universal file format

    • Defines 256 8-bit characters

    • Also called text files or DOS files

    • First 32 characters are special commands

      • Some may also be characters

    • Text files do not store information like fonts, margins, bold, underline, and so forth

    • Many of the ASCII characters show up on your keyboard

      • To display any of the ASCII characters you may simply hold down the ALT key while inputting the ASCII number on the numeric keypad

Ascii character chart

ASCII Character Chart

Drives and folders

Drives and Folders

  • At boot Windows assigns each hard drive partition, floppy drive, and CD-ROM a drive letter

    • Floppy drives are usually assigned A: or B:

    • Hard drive partitions may be assigned C: thru 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

Folders and files

Folders and Files

  • No two folders under the same folder may have the same name

  • No two files in the same folder may have the same name

    • Folder and file names may be duplicated as long as they are in or under the same folder

  • C:\ represents the root directory of the C drive

  • To describe a subfolder, add the name of the folder

    • C:\TEST

  • The exact location of a file is called the path

Directory tree

Directory Tree

Mastering fundamental commands

Mastering Fundamental Commands

Structure syntax and switches

Structure: Syntax and Switches

  • The command line requires the exact syntax for each command

  • Type the name of the command, any parameters (required or optional), and any switches you’d like to use

    • Switches modify the behavior of the command

    • Multiple switches may be allowable

Working with the command line interface


  • Help with any command is readily available in one of three ways

    • HELP gives a one-line description of each command

    • HELP commandgives specific help for the command

    • Command /? gives specific help for the command

Dir command

DIR Command

  • The DIR command lists the contents of a particular directory

    • The DIR/W command only lists the names of the files

Dir command switches

DIR Command Switches

Directories cd command

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

  • To switch between drives, type the drive letter followed by a colon

Making and removing directories

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

Running a program

Running a Program

To run a program:

  • Change the DOS focus to the directory where the program is stored

  • Type the filename with or without its extension and press ENTER

Working with files

Working with Files

Working with files1

Working with Files

  • Attributes (H, R, S, A) are special values assigned to a file

    • Hidden: hides the file from DIR

    • Read-only: protects a file from being deleted or modified

    • System: identifies system files like IO.SYS

    • Archive: identifies files that have not been backed up

  • The ATTRIB.EXE program is used to inspect and change file attributes

Working with files2

Working with Files


  • Wildcards are special characters that enable DOS commands to act on more than one file at a time

  • * represents any number of characters

  • ? represents a single character

Working with files3

Working with Files

  • The DEL and ERASE commands are used for deleting files

  • The RD and DELTREE commands are used for deleting directories

  • The REN command is used to rename files

  • The COPY command is used for making a copy of the file in a new location

  • The MOVE command is used for moving the file from its original location to a new one

  • The XCOPY command is used for working with multiple directories

Mike s five step copy move process

Mike’s Five-Step COPY/MOVE Process

1. Point the command prompt to the directory containing the files to be copied or moved

2. Type COPY or MOVE and a space

3. Type the name(s) of the file(s) to be copied/moved (with or without wildcards) and a space

4. Type the path of the new location for the files

5. Press ENTER

Working with batch files

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

Working with the command line interface


  • EDIT is a command line command that starts a very basic text editor

Creating a batch file

Creating a Batch File

  • Using EDIT type in some commands on their own line

  • Then save the file with a BAT extension

  • 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

Echo command

ECHO Command

  • ECHO will display text on the screen

  • ECHO OFF turns off the display of text on the screen

  • @ at the beginning 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

Set and path commands

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 your presence is

    • If the program is not located in the folder where you are, then 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 additional locations to look

Set and path commands1

SET and PATH Commands

Sever command

SEVER Command

  • SETVER makes the program believe you are running specific version of DOS

    • SETVER by itself lists the current settings

Beyond a

Beyond A+

Using function keys

Using Function 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 to start the program

    • Windows 2000 automatically starts the program

Compact command


  • Compact

    • Displays or alters the compression of files

    • Compact /c

Cipher command

CIPHER Command

  • Cipher

    • Displays or alters the encryption of files

    • /e specifies encryption operation

    • /a says to apply it to the files as well as the directory

  • Login