The Command Line Interface
The OS files • IO.sys • MSDOS.sys • Command.com • IO and MSDOS are hidden files, COMMAND.COM shows in directory listings
The Prompt • This can be (re)set using the PROMPT command • Displays the current drive and current directory • A:\> • This means the computer is waiting for you to type some command and is “looking” at the A: drive, root directory
Where is the Command Line? • In Windows 9x, click Start | Run and type COMMAND • In Windows 2000, XP, click Start | Run and type CMD • In Vista and 7, click Start and type CMD in the Search Box • Either way, you get to a black screen with white lettering
And to get out of it • Type EXIT at the prompt – or - • Click on the close box (upper right corner)
File Names • Classic is 8.3; Windows still creates them • FileNa~1 for File Named Joe • 2K and XP will do this five times, then switch to different method • File extensions link file to creating program .DOC for Word documents, .XLS for Excel spreadsheets and now .DOCX and .XLSX • Program files are .EXE or .COM • Windows file names can be 255 characters
File Format • Each (version of a) program stores its file(s) in a specific format • Some programs can “read” other file formats, some won’t • Simply changing the file extension DOES NOT change the file format • You need to watch this when sending files to other people: they need the application you used, or one that can read that format
File Header File Data (in some form) Clear Text File Footer ASCII file in contrast
ASCII • American Standard Code for Information Interchange • 256 characters (8-bits) • Alphabets are in lower 128 codes • ASCII files (.txt) often contain “tuning” information for applications • Use NotePad to create or edit
Unicode • 16-bit version of 8-bit ASCII • Lower 256 codes of Unicode line up with ASCII • Allows special characters and languages to be used with Windows
File Organization • We start at the “root” of a drive • We add “folders” (or directories) at the root level • We can then add files, or more folders, under those folders
Can contain files or directories C:\ Income Data Expenses Games Jan Feb Jan Feb Mar Inc.txt C:\Income\Jan\Inc.txt
DIR • Gives you a directory listing of the current directory (without any additional info)
CD • Change Directory • CD <name> to go down one level • CD .. To go up one level
Change Drive • Type drive letter and colon, press <Enter> • A:\>C: takes you from A: to C: drive • C:\>A: takes you back to A: • Can be combined with most commands • DIR A:\ will give you the directory of A:\ (root) directory from any location on any other drive
MD • Make directory immediately below current directory RD [/s] • Removes directory immediately below current directory – must be empty, unless you use the /S option • There is NO recycle bin at the command prompt
Running a Program • Type the name of the program, any switches and press <Enter> • We will do this with FDISK and FORMAT • Programs have .COM or .EXE extensions
Create a File • For our work at the Command Prompt, use Notepad to create .TXT file(s) with just some text in them • Any command prompt, then type notepad at that prompt to open NotePad
Copy • Copy <what> <where> • Copy c:\test\file1.txt c:\real\file1.txt • C:\real>copy c:\test\file1.txt
Rename a file • REN <what> <new name> • REN rico.txt arturo.txt • Obviously, rico.txt has to exist and arturo.txt does not exist
File Attributes • Four basic attributes: Hidden, System, Read Only and Archive • Turn on attribute with: ATTRIB + (h,s,r,a) • Turn off an attribute with: ATTRIB – (h,s,r,a)
Wildcards • The asterisk (*) will replace (up to) eight characters (or more, for long file names) • The question mark (?) will replace ONE character • *.DOC = all files that have .DOC extension • File0? = file01, file02, file03 to file09 • Jan* = all files that start with Jan • Can be used with almost all commands that take a file name
Delete a File • DEL or ERASE command • There is no UNDO command; it is gone forever • Be very careful with this command
Batch Files • ASCII text files (use NotePad or Edit) with .BAT extension • Can include all the commands we have looked at, plus lots more • Can save a lot of typing if you want to do the same thing over and over
CHKDSK • Check Disk command. • It needs total access to hard disk drive • Will lurk in background until you restart the system; then it will run after POST and before Windows loads.
SFC • System File Checker • Sfc /scannow • Tends to undo a Service Pack upgrade • Wants the Windows installation media
Shutdown • That’s what it does • Can shut down a remote system