CSC 240 Personal Computing for Programmers
DOS Command Exercises
Setup
Notes:
- Perform the following steps BEFORE trying to do any of the exercise.
- Any letters in CAPS & ITALICS is a DOS command you should type in and press
enter after.
- I will assume you know when to press ENTER to save my carpal tunnel.
- Open a MS-DOS window - (a) START | PROGRAMS | MS-DOS or
(b) START | RUN, enter in command.com and press OK.
- Change drive to the C: drive - just type C: and hit enter.
- Create a new directory called 240temp - MD 240TEMP (or MKDIR
240TEMP) and hit enter. This is where you will do ALL your work for these
exercises.
- Change directory to that new directory - CD 240TEMP.
- Create a file - COPY CON FILE1.TXT. Now just hit a few
random keystrokes to put anything in the file. When finished, hit F6 and then enter.
You will now see the message "1 file(s) copied" which means you just
created a file called file1.txt in the 240temp directory.
- As a check, do the following - TYPE FILE1.TXT and you will see
the contents of that file (garbage). Also do a DIR and you will see the
contents of the directory you're in (c:\240temp). You will see that file.
Exercise
Now you're ready to begin the exercises. Each numbered item has an answer in the answer key. Do the exercises first, on the computer
and while down the answers. Then consult the answer key.
- Copy FILE1.TXT and make a file2.txt, file3.dat, file4.xyz, file5.txt. Pay
attention to the names and extensions of the files.
- List out the directory and see ALL the newly created files.
- Now you just want to see a list of the files that have TXT as their extension.
- Make a copy of file4.xyz and call it first.dat
- Create a subdirectory under the directory you're currently in. Call this new
directory TESTDIR
- Copy all the files with an extension of DAT to the new subdirectory.
- Change directories to the newly created directory and list all the files in there.
- Delete file3.dat.
- Go back up to the parent directory of the current directory you are in.
- List all the file with an extension of DAT in the current directory and the one you just
created. Use only one command to do so.
- Change the name of file1.txt to file6.txt.
- Delete the directory you created (TESTDIR). Are you able to do this ? Why or
Why not ?
- Change directories to the TESTDIR directory. Delete the remaining file.
Change directories up to the parent directory (up one level) and now delete the
directory.
- List all the files that start with FI and have an extension of TXT.
- List all the files that start with the word FILE, then a single digit an extension of
TXT.
That's it...if you can get through all of this, you know enough to pass any DOS
command-related questions on my tests :)