03-01-2023
MAHARAJA SURAJMAL INSTITUTE
Department of Computer Applications
Unit – 2
interaction with
computer
(BCA – 105)
Mr. S.P. Chauhan
Asst. Prof. & Hostel Warden
S.P. Chauhan 1
MS – DOS
File:-
It is the collection of data or information stored on a storage device such as disk in one unit.
File is used to store only one kind of information or data. There are many different types of
files such as text file, data file, program file etc. Different types of file store different types of
information.
DOS uses the concept of files to organize data on disk. To remember the physical layout of
each file, it should be named.
File Name:-
The name give to each file so that it can be referred to later is called file name. the file name in
DOS can have up to 8 alphanumeric characters and an optional extension. The extension can
be up to 3 or 4 character long depending on the version. The “.” is used to separate the name
and extension. Eg. S.No. File Extension Meaning
1. .txt General text file
2. .doc MS word file
3. .exe Executable file
4. .obj Object file
5. .bat Batch file
S.P. Chauhan 2
1
03-01-2023
MS – DOS
Directory:-
Files on the hard disk are divided into various segments or groups called directories. A
directory can store any number of files. It helps to organize files in efficient manner.
Directories may be classified into three categories:
a) Root Directory:-
It is represented by (\). It is the starting point from which all other directories branch out
b) Current Directory:-
It is the directory in which user is currently working.
c) Sub Directory:-
It is the directory within another directory. It is also known as child directory of the
immediate Parent Directory.
Let us consider the following DOS command
C:\FIT\TC>
C – Drive name.
\ – Root Directory
FIT – Directory OR Parent directory of TC
TC – Sub directory of FIT OR Child Directory of FIT
S.P. Chauhan 3
DOS Commands
When we start MS-DOS, we get a symbol on the screen like this C:\>
This symbol is known as C drive or C-prompt. Similarly A:\> is called A-prompt or A drive.
Generally A:\ is used as floppy drive i.e. when we are working on floppy disk and C:\ is used
for local disk or hard disk. A small blinking bar we see on the screen. This is cursor. It is
waiting for your instruction. There few predefined words for DOS. These are known as DOS-
Commands. Our operating system can understand only these predefined commands.
These DOS-Commands are divided into two parts: Internal Commands & External Commands
Internal Commands:-
These commands are automatic loaded into the memory when operating system is loaded into
the memory. Thus these are also called memory-resident commands. These commands are all
are stored in Command.com file, which is a executable command file. These internal command
may further grouped according to their properties. These are as follows.
General purpose File related commands Directory related commands
1. CLS
7. COPY CON
2. DIR
8. TYPE 12. CD/CHDIR
3. VER
9. COPY 13. MD/MKDIR
4. VOL
10. REN 14. RD
5. DATE
11. DEL
6. TIME
S.P. Chauhan 4
2
03-01-2023
DOS Commands
Internal Commands:- (General Purpose)
1. CLS (Clear the screen):-
It is an internal command. This command is used to clear all the information from the
display screen or wipe out every thing written on the screen, bearing only the system
prompt and a curser on the upper left corner of the screen.
Syntax:- C:\> CLS and press Enter
It will clear all the display screen and previous commands would not be seen. It will
display operating system prompt , if any on the first line of the display.
2. DIR(Directory):-
It is an internal command. This command is used for listing files, sub directories and
directories present in the current disk or in the working directory along with their size
in bytes, the date & time when they were created.
Syntax:- C:\> DIR [/Switches] OR DIR [Drive:][Path][File Name]/Switches
The various switches that can be used with DIR command are:
/P – Page wise i.e. Pause after each /B – Use bare format i.e. no /A – Display file with specified attributes.
screenful of information. heading or summary. Attributes may be:
/W – Width wise i.e. display width /L – Use lower case. D – Directories. A – Files for archiving.
wise list format. /4 – Display year with 4 H – Hidden Files.
/S – Display files in specified digits S – System Files.
directory & all subdirectories R – Read Only files. S.P. Chauhan 5
DOS Commands
Internal Commands:- (General Purpose)
2. DIR(Directory):-
The various switches that can be used with DIR command are:
/O – Display file in sort order. Sort order may be: Eg.
N – By Name. S – Files for archiving. C:\>dir filename.extension – To display the
E – By Extension. D – By Date & Time information of specific file.
G – Group Directories First - – Prefix to reverse C:\>dir D – To display list of directories & files
A – By last access date. the order in drive D
3. VER(Version) :-
It is used to see the current version of operating system. Version numbers indicates that
which edition of DOS we are working on.
Syntax:- C:\> VER press enter
4.VOL(Volume) :-
It is used for identification purpose. Apart from physical level DOS allow us to give an
electronic label for each disk. This is called volume level. So it displays the disk volume
label and serial number, if it exist.
Syntax:- C:\> VOL press enter OR C:\> VOL<drive name>
It is not necessary to mention drive name.
S.P. Chauhan 6
3
03-01-2023
DOS Commands
Internal Commands:- (General Purpose)
5. DATE:-
It is used to view the system current date i.e. date maintained by DOS. It is also used to
change the current date to the date entered by the user. Format is mm/dd/yy, where
mm is month (1 – 12), dd is the day (1 – 31) and yy is the year from 1980 to 2079 ( year
depends on version). C:\>DATE/T press enter
Syntax:- C:\> DATE press enter
The current date is: Sat 01/08/2022 Above command will only display the
Enter the new date: (mm-dd-yy) current date and will not ask for new
If you do not want to change the date press enter. date.
6. TIME:-
It displays the current system’s time. This command allow us to change the time also.
Syntax:- C:\> TIME press enter C:\>TIME/T press enter
The current time is: 16:28:53.92 Above command will only display the
Enter the new time: current time and will not ask for new
If you do not want to change the date press enter. time.
S.P. Chauhan 7
DOS Commands
Internal Commands:- (File Related)
7.COPY CON:-
It is used to create new file.
Syntax:- C:\> COPY CON Filename press enter
After copy con we must specify a suitable file name. Press enter. Start typing the
information of the file. After typinging the information we press ^Z (CTRL+Z) button or
F6 button to save the file. After pressing enter key computer will show a message like 1
file(s) copied. This means that file is stored in the disk. Suppose we don't want to save
the file or we just want to abort from file creation job, then we simply press ^C
(CTRL+C) button to abort without saving the file, intend of pressing ^Z button.
The disadvantage of this command is that the file created by this command can not be
modified. Because there is no curser movement upward or backward using arrow key.
Eg.
C:\>COPY CON Fit
Hello FIT is very easy subject
𝛬Z
1file (s) Copied
C:\>
Never forget to give a suitable filename, user can use extension as .TXT for denoting the
file as Text file. S.P. Chauhan 8
4
03-01-2023
DOS Commands
Internal Commands:- (File Related)
8.COPY:-
It is used is used to copy any file to another location or to copy the files to another
directory. This command may also be used for copying any file to another disk with
different or same file name.
This command can also be used to concatenate two or more files into a single file.
Syntax:- C:\> COPY <Source filename> <Target file name> ↵
COPY command will not copy a file onto itself. i.e. target filename with path & source file
name with path should not be the same. Eg.
C:\>COPY C:\Fit C:\Wt – This command will copy the content of file Fit to Wt on C drive
C:\>COPY C:\>Fit D:\Tc – This command will copy the content of file Fit to Tc on D drive
C:\>COPY Fit+WT Tc – This command will concatenate two files ‘Fit’ & ‘Wt’ and store
result in Tc.
C:\>COPY C:\ D:\Fit – This command will copy all content of C drive to directory Fit on D
drive.
C:\>COPY Fit.txt+*.txt – This command will copy all files with extension .txt into Fit.txt.
But the content of Fit.txt will not be duplicated.
C:\>COPY C:\Fit+,, – This command will attach the current time & date to file without
changing it.
S.P. Chauhan 9
DOS Commands
Internal Commands:- (File Related)
9.REN:-
It is used is used to change the name of any existing file or directory. If specified file does
not exist or name is already assigned to some other file, DOS will display message “
Duplicate file name or file not found”.
Syntax:- C:\> REN <Old filename> <New file name> ↵ Eg.
C:\>REN Tc Fit– This command will rename file Tc to Fit.
D:\>REN C:\abc.txt xyz– This command will rename file abc.txt stored on C: drive to
xyz.txt and will stored on C: drive.
C:\>REN D:\abc\*.BAK *.OLD– This command will change the name of all files with
extension .BAK on D:\abc directory to new extension .OLD.
10.DEL:-
It is used to remove a file or files from disk. To delete or erase file other drive or directory
we need to specify the path. It can also used to remove group of files.
Syntax:- C:\> DEL [Drive] [Path][File name][/P] ↵
[/P] – It is optional and prompts for confirmation before deleting each file. Eg.
C:\>DEL D:\Wt.txt– This command will delete file Wt.txt from D: drive.
C:\>DEL *.* – This command will delete all files of current working directory
C:\>DEL /P *.* – This command will prompt confirmation before deleting each file.
S.P. Chauhan 10
5
03-01-2023
DOS Commands
Internal Commands:- (File Related)
11.TYPE:-
It is used to display the content of a file on the screen and optionally on printer too.
The content of long files move up so rapidly that it is difficult to read them, so we use
filter command “MORE” with it
Syntax:- C:\> TYPE Filename.extension ↵ Eg.
C:\>TYPE Fit.txt – This command will show the content of file Fit.txt
C:\>TYPE Fit.txt | MORE – This command will show the content of file Fit.txt page
wise.
C:\> TYPE Fit.txt > PRN – This command will send the content of file Fit.txt for
printing also.
S.P. Chauhan 11
DOS Commands
Internal Commands:- (Directory Related)
12.CD / CHDIR:-
It stand for change directory and is used to enter or exit from any directory. i.e. it can
move us from one location in the directory structure to another.
Syntax To access any directory :- C:\> CD <Directory Name> ↵ Eg.
Let ‘Wt’ is subdirectory in the directory ‘Fit’ and we are presently at DOS prompt and
want to reach the subdirectory, then
C:\> CD Fit ↵
C:\Fit> CD Wt ↵
C:\Fit\Wt> ↵
Syntax To exit from any directory :- C:\Directory> CD.. ↵ Eg.
C:\Fit\Wt>CD.. ↵
C:\Fit>
Syntax To move root directory from any logged subdirectory:- C:\Directory\sub> CD\
↵ Eg. C:\Fit\Wt>CD\ ↵
C:\>
S.P. Chauhan 12
6
03-01-2023
DOS Commands
Internal Commands:- (Directory Related)
13.MD / MKDIR:-
It stand for make directory and is used to create new directory or new sub directory.
Syntax :- C:\> MD <Directory Name> ↵ Eg.
To make new directory ‘Fit’ at C drive
C:\> MD Fit ↵
C:\>
Now this directory ‘Fit’ can be used for keeping various sort of reports. Under this
directory we can create another directory which is known as subdirectory.
Syntax: To create subdirectory :- C:\Directory> MD <Sub Directory> ↵ Eg.
If we want to make a sub directory ‘wt’ in ‘Fit’ than we need to perform the following
steps:
C:\> CD Fit ↵
C:\Fit> MD wt ↵
Following command will make a sub directory ‘DEF’ in directory ‘ABC’, if ‘ABC’ already
exist at D drive:
C:\> MD D:\ABC\DEF ↵
C:\> S.P. Chauhan 13
DOS Commands
Internal Commands:- (Directory Related)
14.RD / RMDIR:-
It stand for remove directory and is used to remove a particular directory or sub
directory from disk. Only empty directory or sub directory can be removed. If
directory is not empty then first delete all the files present in it.
Syntax :- C:\> RD <Directory Name> ↵ Eg.
Following s should be ensured before using ‘RD’ command
a. All files or subdirectory of directory are deleted.
b.We should be one level above the directory or sub directory.
Eg. If we want to delete the ‘Wt’ sub directory from ‘Fit’ directory, then we need to do
following steps:
C:\Fit\Wt> DEL *.*↵
C:\ Fit\Wt> CD.. ↵
C:\ Fit> RD Wt ↵
S.P. Chauhan 14
7
03-01-2023
DOS Commands
Internal Commands:- (General Purpose)
15.Prompt:-
It is an internal command. This command is used to change the MS – DOS command
prompt.
Syntax:- C:\> PROMPT [Text] /[Switches]
The various switches that can be used with PROMPT command are:
$Q – = (equal sign). $N –Current Drive. $D – Current Date. $B – | (Pipe).
$T – Current time. $L – < (Less than sign). $V – Windows version number.
$P – Current drive & path. $$ – $ ( Dollar Sign) $G - > (Greater than sign)
Eg.
C:\> PROMPT Fit ↵ this will change the prompt to Fit>
Fit> PROMPT $P$G ↵ this will take back to the DOS prompt C:\>
C:\> PROMPT $D$T ↵ this will set the prompt to current date & time as
19:50:25.37Mon 01/10/2022
NOTE:- If you need any help for above DOS commands the we put a '/?' symbol after writing
the command at DOS prompt.
Example:- C:\> DIR/? or C:\> COPY/?
S.P. Chauhan 15
DOS Commands
Wildcard Characters/ Commands:-
These characters can serve as replacement entries for a single or set of characters. i.e.
These are used when we are working with multiple files instant of a single file at a time.
DOS provide two wild card characters.
i.? – (Question Mark) - It stand for a single character replacement.
ii.* - ( Asterisk) – It stand for replacement of any number of characters.
Eg.
To list out all the file and directories which have primary name of four characters & secondary
name of three characters.
C:\>DIR ????.??? ↵
To list out all the files with primary name made of four characters but first start with ‘C’ and
secondary name is ‘EXE”
C:\>DIR C???.EXE ↵
To list out all the files with primary name made of four characters but last two characters be am
and extension ‘C’
C:\>DIR ??am.C ↵ To delete all files with extension .TMP from disk.
To see all files with first character C & extension EXE C:\> DEL *.TMP ↵
C:\>DIR C*.EXE ↵ If we use /p switch the computer give ask every time
To see all files with extension EXE before deleting the file. If we enter 'Y' the it will
C:\>DIR *.EXE ↵ erase the file from disk either it will leave the
file. S.P. Chauhan 16
8
03-01-2023
DOS Commands
Piping:-
DOS allow to combine multiple commands on a single command. This technique is called
piping. The symbol for piping is (|).
On piping the output of one DOS command is send to another DOS command, which in
tern process the output it receives and then either send it to another DOS command or
display the final output. Eg.
C:\>DIR C:| SORT| MORE ↵
In above command the DIR display all files from C drive and then SORT command sort all
files and store result in MORE command, then MORE command will display result page
wise.
External Commands:-
External commands are known as Disk residence commands. These commands are used
less frequently and are stored in some external files which are stored in some external
storage device. Whenever an external command is to be executed then the external file
in which particular command stored, is transferred from secondary storage i.e. disk to
main memory i.e. RAM.
All executable files with extensions .com, .exe, and .bat are the external commands. Some
important external commands are given below
S.P. Chauhan 17
DOS Commands
External Commands:-
1. MORE 5. XCOPY 9. FIND 13. TREE
2. MEM 6. CHKDSK 10. DISKCOPY 14. FORMAT
3. SYS 7. SORT 11. ATTRIB
4. MOVE 8. FC 12. LABEL
1.MORE:-
It is used to display the screen output of a command page by page. It is basically a filter
command i.e. it can be used with some command or used with file to display content
page wise, if they exceed the page size. It is stored in MORE.COM file
Syntax:- C:\> <DOS Command>|MORE ↵ OR C:\>MORE<File Name> ↵
Eg.
C:\> TYPE abc.txt |MORE ↵ - This command will show the content of file abc.txt page
wise.
C:\> MORE def.txt ↵ - This command will show the content of file def.txt page wise.
C:\> DIR|MORE ↵ - This command will the list of directories page wise on screen.
C:\> MORE <Fit.txt ↵ - This command will show the content of file Fit.txt on screen,
pausing each time the screen is full. S.P. Chauhan 18
9
03-01-2023
DOS Commands
External Commands:-
2.MEM:- *
This command displays free and used amount of memory in the computer. It is stored
in MEM.EXE file
Syntax:- C:\> MEM/[Switches]↵
Some of the available switches are:
i. /CLASSIFY OR /C – To classify the program by memory uses. Lists the size of
programs, provides a summery of memory in use and lists largest memory block
available.
ii./DEBUG OR /D – Display the status of all modules in memory, internal drivers &
other information.
iii./PAGE OR /P – Pause after each successful of information.
Eg.
C:\> MEM↵ - This command will display total congenital memory, space available to
MS-DOS (in Bytes), size of largest executable program etc.
S.P. Chauhan 19
DOS Commands
External Commands:-
3.SYS:- *
This command is used for copy system files to any disk. The disk having system files are
known as Bootable Disk, which are used for booting the computer.
Syntax:- C:\> SYS [Drive name] ↵
Eg.
C:\> SYS D:
System files transferred.
This command will transfer the three main system files COMMAND.COM, IO.SYS,
MSDOS.SYS to the D Drive.
4.MOVE:- *
This command is used for moving one file or multiple files from one location to another
location or from one disk to another disk. In this command the content of source are
copied to the target and then contents are erased from the source. This is similar to ‘cut
& past’. This command can be used to rename a directory. It is stored in MOVE.EXE and is
executed when MOVE.EXE is present in RAM.
Syntax:- C:\> MOVE <Source Path><Target Path> ↵
S.P. Chauhan 20
10
03-01-2023
DOS Commands
External Commands:-
4.MOVE:-
Syntax:- C:\> MOVE <Source Path><Target Path> ↵
Switches that may used with MOVE command are:
i. /Y – Suppresses prompting to confirm to creation of directory or overwriting of the
destination.
ii./-Y – Causes prompting to confirm creation of directory or overwriting of the
destination.
Eg.
C:\> MOVE D:\ *.* C:\Fit ↵ - This command will move all files from D: drive to the Fit
directory on C: drive and remove the content from D: drive.
5.XCOPY:-
It copies files from one place to another on the same or different disk. It is more flexible
and may be used when we need to copy a directory instant of a file from one location to
another. This command is much faster than copy command. i.e. may be used for copying
multiple files and is basically used for backup purpose.
Syntax:- C:\> XCOPY <Source Directory Name><Target Directory Name>/[Switches] ↵
S.P. Chauhan 21
DOS Commands
External Commands:-
5.XCOPY:-
Syntax:- C:\> XCOPY <Source Directory Name><Target Directory Name>/[Switches] ↵
The target directory path may be written as well, it is not included, then XCOPY will copy
the source file onto the currently logged drive & subdirectory.
If we specify the multiple source files with the help of wildcard characters and does not
specify the target, then copies of each file matching the source will be made in the target
location. But XCOPY will not copy a file onto itself. Some available switches are:
/A – Copy the files with archive attribute set, does not /F – Display full source and destination file
change the attribute. names while copying
/M – Copy the files with archive attribute set, turn off /W – Prompts to press a key before copying.
the archive attributes. /L – Display file that would be copied.
/P – Prompts before creating each destination file. /H – Copies hidden & system file also.
/S – Copies directories & subdirectories expect empty /R – Overwrites read-only files.
ones. /U – Update files that already exist in destination.
/E – Copies directories & subdirectories including /-Y – Prompts before overwriting existing files
empty ones
Eg.
C:\> XCOPY C:\ABC\ *.TXT D:↵ - It copies all files in C:\ABC with extension .TXT to drive
D: S.P. Chauhan 22
11
03-01-2023
DOS Commands
External Commands:-
5.XCOPY:-
Eg.
C:\> XCOPY C:\ABC\ *.TXT D:↵ - It copies all files of C:\ABC with extension .TXT to drive
D:
C:\> XCOPY C:\DEF\ *.TXT/S/P D:↵ - It copies all files of C:\DEF as well as any file located
in subdirectories of DEF with extension .TXT, also prompts before copying to drive D:
6.CHKDSK (Check Disk):-
This command is used to check the status of a disk and show the report of result status. It
scan the disk in a specified drive for error. If there is any error, it reports that in the
status report. It return information about volume serial number, total disk space, space
in hidden files, space in directories, space available on disk and number of bytes in each
allocation unit etc. it require CHKDSK.EXE file for execution & require 28096 bytes.
Syntax:- C:\> CHKDSK [Drive:][Path][File Name][/F][/V] ↵
[Drive:][Path] – Specifies the drive and directory to check
[File Name] – Specifies the files to check for fragmentation.
/F – Fixes errors on the disk.
/V – Display the full path & name of every file on disk.
S.P. Chauhan 23
DOS Commands
External Commands:-
6.CHKDSK (Check Disk):-
Syntax:- C:\> CHKDSK [Drive:][Path][File Name][/F][/V] ↵
Eg. C:\> CHKDSK↵ - It check the current drive in which you are working & display the
information about it.
C:\> CHKDSK D:↵ - It check the D: & display the information about it.
7.FC (File Compare):-
This command is used to compare two set of files and display difference between them.
This command require an external file FC.EXE which needs 20574 bytes for its
execution.
Syntax:- C:\> FC <File1> <File2>[/Switches]↵
File1 & File2 specifies the full path of first & second file.
Number of available switches are:
/A – Display only first & last for each set of difference. /B – Performs a binary comparison.
/N – Display the line numbers on an ASCII comparison. /C – Disregards the case of letters.
/LBn – Sets the maximum consecutive mismatches to the specified /L – Compare file as ASCII text.
number of lines. /T – Does not expend tabs to space.
/W – Compresses white space (tabs & spaces) for comparison.
/NNNN – Specifies the number of consecutive lines that must match
after a mismatch S.P. Chauhan 24
12
03-01-2023
DOS Commands
External Commands:-
7.FC (File Compare):-
Syntax:- C:\> FC <File1> <File2>[/Switches]↵
File1 & File2 specifies the full path of first & second file.
Eg. C:\> FC Fit Wt↵ - It will compare already made files Fit & Wt and list their differences.
C:\> FC/C/L/N/W abc.txt def.bak↵ - It will perform ASCII comparison between ‘abc.txt’ &
‘def.bak’ disregards character case, display line number in the report and suppresses
consecutive spaces.
8.SORT :-
This command is used to sort the content of file numerically and alphabetically. This
command sort the input data and writes the result to the screen or to a file. This
commands basically act as a filter command and is executed when SORT.EXE file is
loaded in RAM which require 25882 bytes.
Syntax:- C:\> SORT[/R] <Input File> <Output File2>↵ OR C:\> type file.txt| SORT/
If output file name is not specified then result will show to the screen.
/R – It is used for sorting the file in descending order like from Z to A or from 9 to 0.
Eg. C:\> SORT Player.txt↵ - It will sort the name of player(content) .
S.P. Chauhan 25
DOS Commands
External Commands:-
9.FIND:-
This command is used to search specified character strings in a specified file. It can also be
used to search a particular file in a given drive. The character string must be enclosed in
double quotation marks. This command require FINF.EXE which needs 6658 bytes.
Syntax:-
C:\> FIND "String to search" <File name>[/Switch]↵ OR C:\> DIR|FIND “File Name” ↵
Some of the available switches are: /I – Ignores the case of characters when
/V – Display all lines NOT containing the specified string. searching for the string.
/C – Display only the count of lines containing the string. /N – Display line numbers with the display line.
Eg. C:\> FIND “this” abc ↵ - It search string “this” in the abc file.
C:\> FIND “this” def.txt/C ↵ - It gives the count of lines in def.txt file that contain string
“this”.
C:\>FIND ““Hello, Sir”” abc.txt/N – It displays the line number having string “Hello, Sir” in
abc.txt.
C:\> DIR|FIND “abc” – It displays whether the file abc is there in current path or not.
S.P. Chauhan 26
13
03-01-2023
DOS Commands
External Commands:-
10.DISKCOPY:-
This command is used to copies the contents of a floppy disk to another floppy disk track by
track basis. It will copy floppy disk of same size & capacity. It can not be used to copy
hard disk or RAM.
While copying using this command if target disk is unformatted DISKCOPY will format the
disk automatically. It there is a data error on the source disk, it will also be copied onto
the target disk as well.
Syntax:- C:\> DISKCOPY <Drive1:><Drive2:>[/Switch]↵
Some of the available switches are:
/1 – Copies only the first side of disk. /M – Make use of RAM to speed up copy access.
/V – Verified that the information is copied correctly. In this command same drive may be specified for
drive 1 & drive 2
Eg.
C:\> DISKCOPY A: A:↵ - If PC contain only one floppy drive then DISKCOPY is performed
using this command. Here DOS firs read the floppy disk in the source drive and then
prompts to remove the disk and insert the target disk into same drive.
C:\> DISKCOPY A: B:↵ - It will copy all contents of A drive to B drive
S.P. Chauhan 27
DOS Commands
External Commands:-
11.ATRIB:-
It is used to set the various type of attribute like read only, hidden, archive to a normal file.
i.e. it displays, set or removes the attributes. This command is stored in ATRIB.EXE
which require 15252 bytes for its storage.
Syntax:-
C:\> ATTRIB ∓Attribute <File name>↵ OR C:\> ATTRIB <File Name> ∓ ATTRIBUTE ↵
The various attributes may be: A – Archive file attribute.
+ – Set an attribute. S – System file attribute.
- – Clear an attribute. H – Hidden file attribute.
R – Read only file attribute. /S – Process file in all directories in the specified path.
Eg. C:\> ATTRIB ↵ - It will show the current attributes of all the files present at C:
C:\> ATTRIB abc +R ↵ – It will make the abc file read only.
C:\abc\def> ATTRIB xyz +H ↵ – It will make the xyz file hide only.
C:\> ATTRIB Fit +H +R ↵ – It will make hide the Fit file & make it read only. To unhide it &
make read write use –H –R.
S.P. Chauhan 28
14
03-01-2023
DOS Commands
External Commands:-
12.LABEL:-
It is used to assign, change or delete a volume label to a disk. This command is stored in
LABEL.EXE which require 9324 bytes for its storage.
Syntax:- C:\> LABEL [Drive] ↵ OR C:\> LABEL <Drive> <Label Name> ↵
Eg. C:\> LABEL ↵ – It will cause DOS prompt to enter volume label for C:
C:\> LABEL D:/FIT ↵ – It will change the volume label of D: as FIT.
13.TREE:-
It is used to display the directories & subdirectories graphically.
Syntax:- C:\> TREE <Path> [/Switch] ↵
Switch may be:-
/F – Include the file name in subdirectory.
/A – Displays the subdirectory using standard ASCII characters rather than graphic
characters.
Eg. C:\> TREE C:\Fit ↵ – It will show the directory & subdirectory present in Fit.
C:\> TREE|MORE ↵ – It will display the structure of currently logged drive & pause the
screen display after each screenful information.
S.P. Chauhan 29
DOS Commands
External Commands:-
14.FORMAT:-
It is used to create new sectors & track in a disk. i.e. it is used to make a disk usable for
operating system by dividing the disk into tracks & sectors. This command is stored in
FORMAT.COM which require 49575 byte fir its storage.
Syntax:- C:\> FORMAT <Derive Name> [/Switch] ↵
Eg. C:\> FORMAT A: ↵ – It will format the disk A:.
C:\> FORMAT A:/S ↵ – It will transfer the system files after formatting the disk.
To get the help of any DOS command HELP command may be used as follows:
C:\> HELP <Command Name> ↵ OR C:\> <COMMAND NAME>/? ↵
Eg. C:\> DIR/? ↵ OR Eg. C:\> HELP DIR ↵
S.P. Chauhan 30
15