0% found this document useful (0 votes)
134 views8 pages

MS Dos

Uploaded by

AnuNeeralgi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
134 views8 pages

MS Dos

Uploaded by

AnuNeeralgi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

MS-DOS

DOS DOS is an acronym for Disk Operating System. It was developed by Bill Gates
and Paul Allen of Microsoft Corporation, USA in 1980. - MS-DOS (Microsoft)

DOS Commands are classified into two types:


1. Internal commands. 2. External commands.

Internal commands are integral part of the COMMAND.COM. These are simple routines
within the command processor. But, external commands are stored on disk as a separate file.

Let us discuss some of the most commonly used internal and external commands.

Go to MSDOS from Windows Operating System:

Click Start Button →Choose Program →Choose Accessories →Click Command Prompt as
shown below:

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.
Table: Directory command options

Option Meaning
DIR/P Page wise listing of directories and
files
DIR/W Widthwise listing of directories
and files
DIR/A Display all directories and files
DIR/B Display in bare format (No heading
information and summary)
DIR/O Listing files in sorted order
DIR/S Display specified files in all
directories and subdirectories
DIR/L Display in lowercase letters
DIR/AD Display only directories
DIR/AR Display read-only files
DIR/AH Display only hidden files
DIR/AA Display only files accessible for
archiving
DIR/AS
3. COPY - This command is used to copy one file to another. It duplicates the existing file.
The syntax is C:\>copy OldFileName NewFileName

Here, OldFileName is an existing file and NewFileName is the file that copies the contents of
OldFileName.
Examples: i) C:\> copy odd.c ABC.C
ii) C:\> copy exp1.c prg.c
Copying of a file from one directory to another is also possible. The syntax changes.
copy drive:pathname drive:pathname
Here pathname indicates the location of the file to be copied.
Example: i) C:\> copy C:\DOS\CONFIG.SYS A:\PBK\CONFIG.SYS
ii) C:\> copy C:\TC\bin\sort.c D:\PETiis.c

4. REN - This command is used to rename the existing file.


Its syntax is as follows.
REN FileName1 FileName2 Here, FileName1 is a file present in the directory and is
renamed by FileName2.

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
and 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\
This brings you back to C:\>(Root directory).
The above commands are used in below window.

9. RD - This command is used to remove or delete the directories. Before using this
command ensures that the directory to be deleted must be empty. Otherwise the directory will
not be deleted. The syntax is as follows.
RD DirName
Example: C:\> RD XYZ
It deletes the directory XYZ in root directory (i.e. C:\>).

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.

11. CLS - This command clears the full screen.

12. DATE - This is used to display the current date or set the new date. Type the following
command
C:\>DATE and press the ENTER key. You will find on the screen
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

15. PATH - This displays the current path or sets a search path for executable files. By
specifying the path, the executable files in any directory can be invoked from any other
directory. Its syntax is as follows.
PATH drive; path
Example: C:\> PATH C:\DOS; C:\DBASE;
It enables you to execute DBASE commands at DOS prompt and DOS command at DBASE
prompt. It also enables to execute commands of both DOS and DBASE commands at C: >.
It enables you to execute DBASE commands at DOS prompt and DOS command at DBASE
prompt. It also enables to execute commands of both DOS and DBASE commands at C: >.

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 or These are used by data base programs to hold the users' data information
.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]


DOS Command Exercises
Notes:
Perform the following steps BEFORE trying to do any of the exercise.

Open a MS-DOS window


- (a) START | PROGRAMS | MS-DOS or (b)START | RUN, enter in
command.com
and press OK.2.

1. Change drive to the C: drive


- just type
C:
and hit enter.3.

2. Create a new directory called 240temp


-
MD 240TEMP (or MKDIR240TEMP)
and hit enter. This is where you will do ALL your work forthese exercises.4.

3. Change directory to that new directory


-
CD 240TEMP
.5.

Create a file
-
COPY CON FILE1.TXT
. Now just hit a few randomkeystrokes to put anything in the file. When finished, hit F6 and
thenenter. 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 thecontents of that file (garbage). Also do a
DIR
and you will see the contentsof the directory you're in (c:\240temp). You will see that file.

Exercise

1. Copy FILE1.TXT and make a file2.txt, file3.dat, file4.xyz, file5.txt. Payattention to the names
and extensions of the files.
2. List out the directory and see ALL the newly created files.3.
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.dat5.
5. Create a subdirectory under the directory you're currently in. Call this newdirectory 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 inthere.
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 theone 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 remainingfile. Change directories up
to the parent directory (up one level) and nowdelete 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 anextension of TXT.

Exercise-2:
1. Create two new subdirectories labeled: PUBLIC and PRIVATE in the C:\Work directory.
2. Create twosubdirectories labeled PROGRAMS and DATAS in the PUBLIC directory .
3. Create a subdirectory labeledDOCUMENT in the PRIVATE directory.
4. In the DOCUMENT directory create a text file named mylive.txt, and write your
firstname,lastname, birth date in this file.
5. Copy the file mylive.txt to the DATA directory.
6. Rename the file from mylive.txt to your lastname, for example: kowalski.txt.

Exercise 3:
1. From the level of the C:\Work directory create a directory labeled LAB, and then create
twosubdirectories 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
thehidden 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
theinformation about the attributs of this structure in the file infolab2.txt.
14. Delete the tree of the C:\WORK\LAB directory.

You might also like