Vous êtes sur la page 1sur 3

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.

1. Open a MS-DOS window - (a) START | PROGRAMS | MS-DOS or (b)


START | RUN, enter in command.com and press OK.
2. Change drive to the C: drive - just type C: and hit enter.
3. 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.
4. Change directory to that new directory - CD 240TEMP.
5. 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.
6. 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.

1. Copy FILE1.TXT and make a file2.txt, file3.dat, file4.xyz, file5.txt. Pay


attention to the names and extensions of the files.
2. List out the directory and see ALL the newly created files.
3. Now you just want to see a list of the files that have TXT as their extension.
4. Make a copy of file4.xyz and call it first.dat
5. Create a subdirectory under the directory you're currently in. Call this new
directory TESTDIR
6. Copy all the files with an extension of DAT to the new subdirectory.
7. Change directories to the newly created directory and list all the files in
there.
8. Delete file3.dat.
9. Go back up to the parent directory of the current directory you are in.
10. 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.
11. Change the name of file1.txt to file6.txt.
12. Delete the directory you created (TESTDIR). Are you able to do this
? Why or Why not ?
13. 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.
14. List all the files that start with FI and have an extension of TXT.
15. List all the files that start with the word FILE, then a single digit an
extension of TXT.

DOS commands practice

On a disk create a file with the filename (yourname).txt. In this file, answer these
questions by showing the necessary command. Number the answers in the file.
1 What are the two common wildcards used in DOS?
2 What is the command that will show the current directory
3 What is the command that would show the directory of the
A drive
4 What switch can be used with DIR command to show one
page at a time?
5 How would you change from C:\WINDOWS to C:\ ?
6 How would you change from C:\ to C:\WINDOWS ?
7 How would you make a directory named MYDIR ?
8 How would you delete MYDIR directory/
9 If you were in C drive, how do you change to A drive?
10 What is the command to change the prompt to show the
current date?
11 What is the command to unconditionally format a floppy?
12 How do you use the FORMAT command to make a bootable
“system” disk?
13 What is the smallest readable section of a track called?
14 What is the program called that reads the operating system
on bootup and contains a list of the disks key characteristics
(bytes, no. of sectors, no. of heads, etc)?
15 What component is it that keeps a table of 2 byte entries
that keeps track of files (clusters) on the hard drive?
16 What are the executable file name extensions and in what
order do they execute on executable files?
17 What command copies the entire contents of a floppy disk
to another floppy disk?
18 What command will let you send the contents of the root
directory to the printer?
19 Which function key will repeat the previous command
(without retyping it)?
20 What does the PATH command do?
Command Prompt (Ms DOS) Exercises
Exercise 1
1. Create two new subdirectories labeled: PUBLIC and PRIVATE in the C:\Work directory. Create two
subdirectories labeled PROGRAMS and DATAS in the PUBLIC directory . Create a subdirectory labeled
DOCUMENT in the PRIVATE directory.
2. In the DOCUMENT directory create a text file named mylive.txt, and write your firstname,
lastname, birth date in this file.
3. Copy the file mylive.txt to the DATA directory.
4. Rename the file from mylive.txt to your lastname, for example: kowalski.txt.

C:\ WORK\ PUBLIC\ PROGRAMS\


DATA\ kowalski.txt
PRIVATE\ DOCUMENT\ mylive.txt.txt

Exercise 2
1. From the level of the C:\Work directory create a directory labeled LAB, and then create two
subdirectories labeled: LAB2A and LAB3A in the LAB directory.
2. In the LAB3A directory create a subdirectory labeled LAB4.
3. In the LAB2A directory create files: file1.txt and write your firstname and lastname in this file,
file2.txt and write the number of your index in it.
4. Place a data from the files: file1.txt and file2.txt into mydata.txt file.
5. Display the contents of the file mydata.txt.
6. Copy the file mydata.txt to the LAB3 directory renaming it to filescal.txt.
7. Rename the file from mydata.txt to mydata.lst.
8. Enable the "read only" attribute for the file filescal.txt.
9. Enable the "hidden" attribute for the LAB4 directory.
10. Enable "read only" and "hidden" attributes for the file file2.txt."
11. Create a directory: C:\WORK\LABOR.
12. Remove the structure from the LAB directory to the LABOR directory, remember about the
hidden files and directories and the empty directory.
13. Place the information about the structure of the C:\WORK directory in the file inflab.txt, and the
information about the attributs of this structure in the file infolab2.txt.
14. Delete the tree of the C:\WORK\LAB directory.

C:\ WORK\ LAB\ LAB2A\ file1.txt


file2.txt
mydata.txt
LAB3A\ LAB4A\

Exercise 3
Create a batch file kat.bat that creates the structures of the directories presented on the picture in the current
directory, and displays the message: "Directories created".

Vous aimerez peut-être aussi