Disk Operating System
Disk Operating System
Or Click Start Button ---Choose Run ----Type cmd in the Open tab as shown below:
Command Prompt will get displayed as shown:
Internal Commands
1. DIR - This command displays the list of directories and files. It
shows the name of the directory or file, number of bytes, date and time.
Type DIR at C:\>prompt as shown and then press the ENTER key.
Now, you will find on the screen, a list of files and directories present
in the directory
C:\> (Root directory)
C:\>DIR
2. DIR - Options There are many options associated with DIR command.
Below table illustrates the option and its meaning.
Option Meaning
DIR/P Page wise listing of directories and files
Examples:
i) C:\> REN EXP.C PQR1.C
ii) C:\>REN X.DOC Y.LET
iii) C:\> REN COMMAND.COM COMMAND1.COM
5. TYPE - This command is used to display the contents of
a file. Its syntax is as follows.
Type FileName
Examples: i) C:\> Type EXP.CPP
ii) C:\> Type prog.c
6. COPY CON - This command is used to create a new file from the
console. Its syntax is as follows.
COPY CON FileName
Suppose you want to create a file FirstProg.c, and then type it as
C:\> copy con FirstProg.c
• Hit ENTER key.
• The cursor (location marker) moves to the next line.
• Now type whatever the information you want.
• After completion of typing, you can stop it by pressing
simultaneously CTRL and Z keys.
• And, then press ENTER key.
7. MKDIR - This command is used to create new directories.
Its syntax is as follows.
MKDIR DirName
Where, DirName is the name of the new directory to be created.
Examples:
i) C:\> MKDIR CS
ii) D:\> MKDIR XYZ
We can also use MD in place of MKDIR. It also does the same job. MD
stands for Make Directory.
8. CD - CD stands for Change Directory. It changes the environment from one
directory to other.
Its syntax is as follows.
CD DirName
Example:
C:\> CD TC When this command is executed you will find on the screen
C:\TC>
And, if you want to go back to the prior environment then execute CD as
C:\TC>CD..
OR C:\TC>CD\
10. DEL - This command is used to delete or erase a file. Its syntax is as
follows.
DEL FileName
Example: C:\> DEL prime.C
The file prime.C is erased from root directory.
13. TIME - This command is used to display the current time or set the new time. Type
the following command.
C:\> TIME and press the ENTER Key.
You will see on the screen:
If you wish to set a new time, type your time in hour -minute-second (HH-MM-SS)
format at the end of the second line. If you don't want to set the new time, simply
press the ENTER Key.
14. VER - This displays the version of DOS installed in the system.
There are different versions of DOS, such as DOS 1.0, DOS 2.0, DOS
4.0, DOS 5.0, DOS 6.0, DOS 6.20, DOS 6.22 and DOS 7.0. Example:
C:\>VER
Rules for naming a file and its Extension
The following rules must be strictly followed while giving a name
to a file.
(a) File names can have a maximum of eight characters from A to Z or 1-
9 or special characters such as: $ & # a 1 % ( )-1 ) ---
(b) File names should not contain any blank character (space) and any of
the following characters: ?/ \ C 3+: 1 < > -
(c) Filenames like autoexec.bat, config.sys are reserved and are to be
used only for specific purposes.
(d) Each extension can contain a maximum of 3 characters. Extension
name is not compulsory but it assists in remembering the type of the
file used.
(e) The following words to be used as extensions because these are
reserved for specific purpose. CON, COX, LPT, PRN, BAS, COM,
BAT, EXE.
(f) Files with extensions EXE, COM, and BAT are called executable files
and should be used only for a very specific purpose.
Types of files in DOS
DOS supports a wide variety of files. The type of the file can be identified with the extension of the file in the
filename. The three letters following the name of the file is called as the extension of the file.
.bak : Used by programs and users to make a copy of an existing file for safety and/or
archive purposes.
.bas : A basic computer-language program file.
.bat : This is used for a batch file. Such a file is a series of commands in mostly plain
English which perform an operation in DOS automatically. They come with some
programs and may also be written by a user to make shortcuts or perform operations
like sorting or backups.
.bin : A binary file.
.c : A file of programming language in the C format
.dat : Used to hold information about a particular aspect of a program or about a particular
operation The latter may update a .dat file to reflect recent changes. Other operations
in the program may then view this file and other .dat files while determining a course
of action
.db These are used by data base programs to hold the users' data information
or .dbf :
.dir : Used to house a directory list, especially for communications programs.
.exe An executable file
External Commands are such short programs or utilities which are available on
floppy / hard disk and are loaded in the memory of the PC when specially asked for.
Some of the external commands that are often used are format, attrib,
1. FORMAT – This command is used to format the disks. Formatting is the process of making the
disks usable with DOS. It also identifies and marks the number of tracks, sectors and cylinders. Its
syntax is as follows.
FORMAT drive: options
2. ATTRIB– This is used to view or change the attributes associated with files such as read only,
hidden, archive and system files.
To make files hidden +H option is used To make files read only, +R option is used The general format
is as follows
ATTRIB [+h] [+r] [-h] [-r]
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.
4. Rename the file from mylive.txt to your lastname, for example: kowalski.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 attributes of this structure in the file infolab2.txt.
14. Delete the tree of the C:\WORK\LAB directory.
Exercise 3
the console
copy.hlp – contains the help text for the command copy
date.hlp – contains the help text for the command date
3.) From the directory C:\WINDOWS, copy all .bmp files to the directory images.
Rename the first three files to img1.bmp, img2.bmp und img3.bmp.
Move the other .bmp files from the folder images into the folder trash.
4.) In the directory txt, create the following text files:
test.txt – contains some keywords about the dos-commands you have used so far.
directories.txt – contains a listing of all directories and files you have created so far.
5.) From the directory C:\WINDOWS copy all .log files to the directory log.
Create the file all.log containing the content of all log files. Then move the original .log
files
into the folder trash.
6.) Delete all files from the directory trash and then delete the directory itself.