Upload
jesse-hill
View
221
Download
0
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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
REN
• Renames a file name to a new name• REN <old name> <new name>
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
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
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)
Robocopy
• Robust copy command• Allows you to copy files and directory
structures across a network• Found in Vista and 7
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
Format
• We have a whole presentation on this• Format c: /s will format c: drive and install
system files (DOS)
Hostname
• Will give you the name of the computer
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
Shutdown
• Guess what it does