Internal vs. External • Internal – DATE
DOS COMMANDS You will use these more than you think!
– TIME – VER – PROMPT – PATH – DIR – CD, MD ,RD
• External – FORMAT – FDISK – SYS – ATTRIB – COPY – XCOPY – DELTREE
– DEL – EXIT
Internal DOS Commands • • • • •
Only need the “basic three” to be active All contained within COMMAND.COM No need for PATH statement No need for CONFIG.SYS No need for AUTOEXEC.BAT
DATE MM-DD[-YY] • Used to set the CMOS date on the computer • Occurs at the point of the • Stored at the number of milliseconds since about 1980 • For HELP type DATE /?
External DOS Commands • Always need the “basic three” • All require that an executable file by that name is available for use • PATH statement frequently necessary • Usually do not need CONFIG.SYS • Usually do not need AUTOEXEC.BAT
TIME HH:MM[:SS[.XX[A/P]]] • Used to set the CMOS time on the computer • Occurs at the point of the • Stored in the CMOS as the number of milliseconds since about 1980 (32 bit clock will last till some time in 2020s)
• The HH must be on 24 hour basis • The XX above are for hundredths of seconds and is optional • The A/P (AM/PM) designation is optional.
1
VER • Displays the current version number of DOS • No parameters
PROMPT [ PARAMETERS] • Usually set to: – $P – to give the current directory – $G – to give the “greater than” symbol after the current directory
• Check out PROMPT /? To get other parameters. • Demo
PATH [;] or PATH= [path1][;path2] [etc..] • No Parameters—display the current path specification • Only the “ ;” mark—erase the current path specification • Otherwise: – Look first in path1 – Then in path2 – Then is subsequent listed paths in the specified order.
Interesting DOS Questions • What happens when one does: – DIR C: vs. DIR C:\ ? – Why – Can one do a DIR on the a: drive from the c: drive? – What is the difference between a DIR C: from the D: drive and a DIR C:\ from the D: drive?
DIR [ PATH] [SUBSET] • Path – may refer to any disk and directory • Subset – only displays files and directories that match the “subset criteria.” • Wild cards frequently used • Demo
Making a Directory MD [path\]name[\] (or MKDIR) • Used to create a new directory • Path\ when not present is assumed to be the current directory • Do not have to be within the directory where new directory will reside
2
Remove Directory RD [path\]name[\]
CD PATH (CHDIR)
(or RMDIR)
• Used to switch from the current directory to the directory described in the path part of the statement. • Valid abbreviations (for all directory commands):
• Used to delete or remove the directory name • When Path\ not present is considered to be the current directory • Can not delete directory with any contents • Do not have to be within the directory being removed
– Single dot . —relative to current directory – Double dot .. —relative to parent directory – Back slash \ — The preceding is either the root directory or a directory name
Wildcards—when referring to filenames
DEL [ PATH\] FILENAME • Deletes the file(s) described by filename • Wildcards frequently used here • Once deleted files are frequently possible to “undelete”
EXIT • Will close current window if running in a window • Will close current DOS shell if active • Will NOT close the root or primary DOS shell • In older versions also included the STOP function • Demo –
• The ? Character: –may be used to represent any single valid character for inclusion in the specification. Example: DIR ab??c.txt • The * character: – To the left of the filename dot: The * character is assumed to be representing any and all combinations of characters to its left including itself. – To the right of the filename dot: The * character is assumed to be representing any and all combinations of characters to its right including itself.
External DOS Commands • Need the “Basic 3” plus • Also need the specific executable file • May need PATH in AUTOEXEC.BAT – Where are the DOS commands in WINDOWS? – How would one issue DOS commands with and without the PATH statement
3
Help with DOS External Commands
External DOS Commands • • • • • •
FORMAT FDISK SYS ATTRIB COPY XCOPY
• • • • • •
SCANDISK CHKDSK DELTREE DEFRAG DEBUG DISKCOPY
• From the command prompt in WINDOWS: – Command name /? – This will list the various switches and options – Note: c:\windows\command must be within the path specification.
• From the command prompt in older DOS: – HELP [DOS COMMAND NAME] – The Help file and the QBASIC.EXE are necessary
FORMAT FDISK • Used to make either floppies or hard disks usable by DOS • Creates on the disk: – – – – –
Master Boot Record—“Size media” Sectors, tracks and cylinders Fills Clusters with F6h and numbers them Two copies of the FAT table Root directory
SYS [DRIVE1 PATH1] DRIVE2 • Used to transfer current “Basic 3” OS files found on DRIVE1\PATH1 to the device Named as DRIVE2 • The disk (Drive2) should then be bootable • If a floppy, the disk usually needs to be completely blank first • Same effect when FORMAT DRIVE2 /S switch used
• Used to partition a hard disk • Creates and writes to Hard Disk two copies of the “partition table” • Undocumented /MBR switch to restore backup copy of partition table
ATTRIB +or- attribute [ path\] filename • Possible attributes: – – – –
Hidden—not seen with DIR command System—system file, can not be deleted Read only—cannot be changed Archive—file has changed since last backup
• Path – The path to filename file • Filename – The file with attributes – (wildcards used frequently)
• DEMO
4
COPY filename1 filename2 • • • • • •
Both filenames may have a path given No path implies the current directory filename1 is the source file copied filename2 is the destination filename Wildcards frequently used Lots of other switches /?
DISKCOPY SOURCE DESTINATION • SOURCE—Source drive (A:) • DESTINATION—Destination Drive (B:) • Makes an exact copy hidden files, errors and even corrupt files • Copies Disk Image • Possible to do DISKCOPY A: A:
CHKDSK • Like SCANDISK but only runs in DOS • Can find errors, but does not fix them • A legacy from older DOS
XCOPY or XCOPY32 • Used to copy entire directories & subdirectories • Will copy hidden files with /H switch • Check /? Switch to get full switches
SCANDISK • Used to correct errors in FAT • Cleans up and corrects problems • Runs in both WINDOWS and DOS
DELTREE • Used to delete an entire directory & all of its sub-directories • Powerful but dangerous • Be careful with this one!
5
DEFRAG
DEBUG
• Used to make a hard disk run faster • Causes all clusters of a file on a hard disk to be contiguous • May take a lot of time!
• Used to manipulate and view very specific parts of memory or disks • Discussed later in this course.
End
6