28
The Command Line Yep, you need to know this

The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Embed Size (px)

DESCRIPTION

Accessing the Command Line XP: Run dialog box; type CMD or COMMAND Vista/7: Search Dialog box; same command Right-click shortcut and select Run As Administrator for commands that affect Windows

Citation preview

Page 1: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

The Command Line

Yep, you need to know this

Page 2: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

The Basics

• Start with the Prompt, what the computer tells you when ready for a command

• You type a command and press ENTER when you want to send it to the computer

• Computer may come back with text about what it did (or did not do) and then will present the Prompt once more

Page 3: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Accessing the Command Line

• XP: Run dialog box; type CMD or COMMAND• Vista/7: Search Dialog box; same command• Right-click shortcut and select Run As

Administrator for commands that affect Windows

Page 4: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Focus

• Command Line always focused on a drive and directory; prompt will show both

• C:\Windows\System32> has focus on C: drive and Windows\System32 folder

• Change focus– Type drive letter and colon, then ENTER– Type CD and directory name to drill down– Type CD .. To go up a level

• DOS will remember drive and directory

Page 5: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Filenames• Everything is a file to the computer• Each file has a name: 8.3 format• Windows allows 255 characters in file name• Extension (should be) unique to application

that created the file; changing the file extension does not change the file contents

• Windows uses file extension to determine: a) Program that created it and b) What icon to use for the file

Page 6: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

ASCII

• American Standard Code for Information Interchange

• Each unique method of binary organization is called a file format

• ASCII defines 256 eight-bit characters• First, universal, file format still used for

configuration files

Page 7: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Folders

• Also called directories• Any file at the root of the directory tree is said

to be in the Root Directory• A folder within a folder is a sub-directory or

subfolder• Any folder can have many subfolders and files;

names have to be unique unless in different folders

Page 8: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Path

• The route to a file; listing of drive and directory structure to get to the file:– C:\Windows\System32\Notepad.exe

• This is the path to the file and its full name

Page 9: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Command.com

• Shifts command to upper case• Looks within command.com • Looks within the current directory (focus)• Looks in directories specified in the PATH• Returns “Bad command or file name”• <command> /? Will bring up help on the

command

Page 10: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Oh No!

• DOS will do what you say, not what you mean so double-check spelling and syntax before the Enter key is pressed

• I wanted a directory listing, but I typed DEL instead of DIR

Page 11: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

DIR

• Shows the contents of the current directory• Can show another directory if you point it

there: dir c:\windows• Dir /w will give you a five-column display• Dir /p will pause at each screenful of

information

Page 12: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

CD

• Change directory• CD <directory name> will take you down to

that directory• CD .. Will take you up one directory level• CD \ will take you to the root directory for the

drive

Page 13: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Move between drives

• Type the drive name followed by a colon and then press enter

• A: will take you to the A: drive• C: will take you to the C: drive• Command will remember what directory you

were in on each drive when you switch

Page 14: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

MD• MD <name> to make a directory• New directory is directly below current

directory• Automatically creates . (dot) and .. (double-

dot) files. Dot is current directory; double-dot is parent directory (one up)

• Does not tell you anything if it worked

Page 15: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

RD

• RD <name> to remove (empty) directory (only . and .. Files remain

• Removes directory below current directory• RD <name> /s will remove files, subdirectories

and directory

Page 16: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Running a Program

• Your computer can only run files with the extensions: .exe, .com or .bat

• You do not have to type the extension to run the file/program

Page 17: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

ATTRIB

• Attrib <name> displays the attributes (H,S,R,A) for a file

• Attrib <name> + turns on the attribute• Attrib <name> - turns off the attribute

Page 18: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Wildcards

• * (shift-8) replaces any number of characters• ? Replaces just one character• Can be used anywhere a file name is legal• DIR a*.* will find any file that starts with “a” in

the directory and has any extension

Page 19: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

REN

• Renames a file name to a new name• REN <old name> <new name>

Page 20: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

DEL

• BE VERY CAREFUL WITH THIS COMMAND!!!!• Deletes one or more (if you use wildcards)

files; all gone, no going back• Will not remove directories• Actually, replaces the first character with Σ• You don’t get a response

Page 21: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Copy/Move

• Copy <what> <where>• Copy d:\win98\*.* c:\win98\*.* will copy all

files from the D: drive (optical drive) win98 directory to the C:\WIN98 directory – will not change file names

• There is no “undo” for copy/move gone wrong

Page 22: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

XCOPY

• Allows copying of directories, files and subdirectories at one time

• Xcopy c:\data d:\data /s/e will copy everything in the c:\data directory to a d:\data directory including files and subdirectories (/s) even if empty (/e)

Page 23: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Robocopy

• Robust copy command• Allows you to copy files and directory

structures across a network• Found in Vista and 7

Page 24: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

CHKDSK

• Command line version of Error Check• Usually fails when you start it because it can

not lock the drive; will run next time Windows restarts

Page 25: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Format

• We have a whole presentation on this• Format c: /s will format c: drive and install

system files (DOS)

Page 26: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Hostname

• Will give you the name of the computer

Page 27: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

SFC

• System File Checker• SFC /scannow• Will attempt to set computer disk to be the

same as installation disk; I think it eats Service Packs

Page 28: The Command Line Yep, you need to know this. The Basics Start with the Prompt, what the computer tells you when ready for a command You type a command

Shutdown

• Guess what it does