School of Computing & Mathematics
First Year – Semester One
CSC-10029: Fundamentals of Computing
Tutorial Sheet 04 – Introduction to Microsoft DOS
For week beginning 06-November-2017.
Microsoft Disk Operating System (MS DOS) is no longer used directly as a the main shell for
Microsoft's operating systems and it has been superseded by the GUI-based Microsoft Windows
Operating Systems for computers and other devices. However, understanding how to use various
DOS commands will give you a good foundation for working with other CLI-based operating systems
such as Unix and Linux, where the GUI is not available or where it does not support some system
administration functions.
1. Starting MS DOS
Start the DOS command prompt by typing cmd in the search window followed by the <enter>
key (or from the start menu: Accessories -> command prompt)
The start-up screen will show the default disk drive and the current working directory (or a
'folder' in the Windows GUI-based environment).
Example default directory: C:\Users\Thomas>
C: denotes the hard disk drive or HDD [A: is often reserved for 3.5in floppy disk drive
(diskette), B: for the 5.25in floppy disc drive, and D: for a partition in the HDD]. Other disks
(including memory sticks, etc.,) are often assigned a letter of alphabet from E to Z, in that
order.
2. To change the drive to for example S: drive, type S: followed by <enter>
(Note: S: is your designated student home drive on Keele networks. Stay on this drive for the
rest of the exercises. Careful not to delete files accidentally because recovering them may not
be straight forward. You should also always to keep a backup copy of your files. )
MS DOS is not case sensitive (like Unix, for example) and typing a command such as DiR
<enter> has exactly the same effect as dir <enter>
3. To list the contents of a directory (or folder) on a screen, type
DIR <enter>
You can use various options for displaying the output on the screen such as dir /p to display
one screen at a time; dir /w displays file names and directory
ALSO: Dir <directory name> to list contents of a subdirectory.
To discover more options or help on using a particular command, type use /? after the
command (e.g., dir /?)
Some file extensions are reserved for system use, e.g.,:
.COM command file for system functions(machine code)
.EXE executable file for users and applications (machine code)
.BAT batch file contains multiple DOS commands to be executed in a sequence
.SYS system file
4. To clear the screen, type CLS <enter>
5. To display or change the date, type DATE <enter>
Then enter the date in the specified format. Pressing <enter> without changing the date does
not reset the system date. The TIME commands works in a similar fashion.
TN CSC-10029: Tutorial Sheet 04 Page 1 of 2
6. Creating new directories or folders with mkdir or md.
Example: mkdir csc-10029
To navigate through directories use cd or chdir
Example: cd csc-10029
Try the following sequence of commands
mkdir practicals
cd practicals
mkdir algebra
mkdir logic
mkdir numbers
dir
You have formed a hierarchy of folders: csc-10029 - > practicals - > [algebra | logic |
numbers]. Use tree command to view the hierarchy of a subdirectory or subfolder]
cd .. returns to a parent directory.
[Return to this exercise after completing Exercise 10 – batch files. You need to remove the
directories first, with the rd <directory_name> command]
7. Using wild cards
* is placeholder for any number of characters
? represents one character
try: dir *.exe /s /p [shows a lot of files if you stand on C:\ ]
try: dir *.exe /s /p / w
[Ctrl + C to terminate output]
8. Copy a file
Use any file on your directory: Copy <fileone> <filetwo>
produces a duplicate of <fileone> called <filetwo>
To copy all files from one directory or folder (and put them in another directory or folder (try
this with your own directories)
<source directory> \Copy *.* <destination directory>
9. Deleting a file (careful with these commands)
DEL <insert filename here>
DEL *.ANY delete all files with an extension ANY
DEL *.* deletes ALL files on the current working directory
[can UNDELETE file - but not well supported in current Windows versions]
Exercise: create multiple .txt files with notepad and then delete them with *.txt
10. Working with batch files
Batch files contain multiple DOS commands in a specified sequence
Exercise: Create a file called mybatch.bat on your working directory to contain the following
commands:
CLS
ECHO Welcome to Reeves Town!
PAUSE
DIR /p /w
CLS
You can find more examples and the command-line reference A-Z at:
https://technet.microsoft.com/en-gb/library/bb490890.aspx
TN CSC-10029: Tutorial Sheet 04 Page 2 of 2