You are on page 1of 16

Tutorial 2 Displaying

Directories
Streamlining the Process for
Locating Files

Using the Command History


F3 What did it do?
DOSKEY incorporated when opening a
Command Prompt
Command Processor tracks last 50
commands in memory known as
command history
When command history gets full, oldest
command is eliminated first to make room
for new command

Using the Command History


Use up arrow to recall previous command
Use down arrow to go to next command
Can you edit commands?
Edit keys
Left arrow one character left
Right arrow one character right
Home beginning of line
End end of command line

Using the Command History


Insert mode vs. Overtype mode
Insert Mode
Inserts text beginning at cursor

Overtype Mode
Inserts text beginning at cursor but overwrites
existing text past cursor

Use Insert key to toggle between modes


F7 key creates pop-up box of command
history, select and then press enter

Displaying a Directory Listing


DIR (internal)
Displays information about contents of disk
If a drive is not specified {A:,C:,D:} DIR refers to
default drive {C:}
Example
DIR (will give listing of C drive)
DIR A: (will give listing of floppy disk drive)

If listing is over 25 lines, you can scroll back up


through listing
Listed in disk order

How do you change the default drive?

Parts of a Directory Listing


Five columns of information

1st column File Date date file last modified


2nd column File Time time file last modified
3rd column Directory Marker - <DIR>, identifies
subdirectories in current directory
4th column File Size size of file in bytes
5th column Long Filename file name created
under windows (short filename for files created under
MS-DOS or the Windows operating system) also
gives file extension

DIR command switches


/? gives help documentation
/P pauses a directory listing (1 screen)
/W displays filenames in across columns
/D displays filenames in down columns (only
available in 2000 & NT)
/O display filenames in alphabetical order
** You can combine various switches into one
command line **

More on Order switch


Sort Order parameters

/OE file extension only


/OEN file extension, then main part of name
/OD file date and time
/OS file size
/ON main part of filename only
/O or /ONE main part of filename then extension

By placing a minus sign (-) in front of parameter


you can reverse the order

Short Filenames
Compatible with MS-DOS 8.3 format
Created when given a long filename
Short filename is first 6 characters followed by
tilde (~) then a number
Example filena~1

Number is used to differentiate between files


that may have the same short filename
Example filenames = filena~1
filename = filena~2

DIR and File Attributes


Each file has file attributes
System (S)
Hidden (H)
Read-only (R)
Archive (A)
Directory (D) only with directories

Use the Attribute (/A) switch with DIR to


show files only with specified attribute

Wildcards
Used to substitute for characters in
filename
Two wildcards asterisk (*) and question
mark (?)
What is the difference?
Question mark typically replaces one
character
Asterisk can be used for one or more
characters

Wildcard Examples
Dir *.xls /o /p (looking for projection)

Wildcard Examples
Dir *projection.xls /o /p (narrow search)

Wildcard examples
Dir ????ware.ppt /o
How many characters will go before the ware?

Windows Environment Variables


Allows you to create custom commands
Utilizes SET command
SET variable=string (no space)
Example SET DIRCMD=/P /O

SET can be used to eliminate continuous


typing of switches
To view environment variables type SET
and press enter

Windows Environment Variables


After using SET command, the setting
stays in place until you specify a new
setting, remove the setting, or exit the
Command Prompt window
Example for removal
SET DIRCMD=

You might also like