Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

MS-DOS

1.1) Shell of DOS: Command.com


Command.com is the command interpreter in DOS environment. It generate DOS
prompt [C:\> , D:\>] and takes command from the user and execute it. It has 3 part:-
a) Transient part
b) Resident part
c) Initialization section

1.1.1) Transient part:


Transient portion maintains some software routines or programs which are basically
DOS internal command.

1.1.2) Resident part:


This part always stays in the RAM memory. It handed the critical error for DOS. It also
handle or process Ctrl C or Control + Break operation. It also load the transient portion of
Command.com if it is required.

1.1.3) Initialization Section:


Initialization section of Command.com load and execute Autoexec.bat file if it is
present in the disk.

1.1.4) Batch File:


Batch file are executable file in DOS environment. The extension of Batch file is
(.bat). It contains DOS internal, external and special purpose batch command. The
special purpose batch commands that are used are:

CHOICE, REM, FOR, IF, GOTO, ECHO, SHIFT.

1.1.5) AUTOEXEC .bat:


It is a special type of batch file created by the user and calls by the operating system.
It is called startup file in DOS.
1.2) Type of DOS Commands:
There are 2 types of DOS commands, mainly INTERNAL and EXTERNAL commands.

1.2.1) Internal Commands:


These commands can be given from the DOS prompt, irrespective of the fact the
command is there in the DOS directory or not. These can be said to be the in-built
commands of DOS. For example, the following commands are internal commands:

CHDIR  It changes the current directory, short name is CD.


CLS  It clears the screen.
COPY  It is used for copying files.
COPY CON It is used to create a quick batch file.
CTTY This command is used to redirect the keyword and screen to the serial port.

1.2.2) External commands:


These commands are such they have to be present in the hard disk to be used. Some of
the external commands are given below:

Append  It lets programs open data files as if they were in the current directory.
Assign  It is used to reassign drives when programs work only with specific drives.
Attrib  It changes file attributes, which are setting in every DOS file.
Backup  It lets you backup your hard disk onto as many floppies as required.
Restore command can be used to use backup files.
Chkdsk  It checks disk status, memory status, files and flags unidentifiable files.
Comp  It compares two files for identical content and reports upto 10 mismatches.

1.2.3) Difference between Internal and External Commands:


INTERNAL COMMAND EXTERNAL COMMAND
1) The command which are embedded 1) The commands which are stored as a
inside the command.com is called internal separate file in disk drive are called
command. external command.
2) Short in size. 2) Big in size.
3) Execution is faster. 3) Execution is slower.
4) We cannot change or alter the internal 4) We can change, alter, create or delete the
command. external command.
5) Example- MD, CD, RD, COPY, TYPE, 5)Example- FORMAT, UNFORMAT,
VER, VOL, DIR, CLS, REN, DATE, CHKDSK, SCANDISK, XCOPY,
TIME, LABEL. DISKCOPY, DISKCOMP, SETVER,
SUBST, MSBACKUP, RESTORE,
TREE, DELTREE, etc.
1.3) File Management System in DOS:
1) Root Directory
2) FAT (File Allocation Table)

1.3.1) Root Directory:


Root directory in DOS are maintained in the disk. It contains a list of file
information with a specific format. Each entry in the root drive or directory is 32 bytes
and it contain the following information.

CNO (8), Extension (3), Reserve (10), Attribute (1), Time (2), Date (2), FBN (2),
Size(4)

1.3.2) FILE ALLOCATION TABLE

1.3.2.1) FAT:
It maintains the next block location of a file as a link list manner. Two copies of
FAT are maintained in the disk for security purpose. In floppy disk drive 12 bit FAT are
used. In case of hard disk drive (HDD) either 16 bit or 32 bit FAT are used.

1.3.2.2) FAT32:
FAT 32 is and improved version of the FAT file system that allows disks over
two GB to be formatted as a single drive. FAT 32 also uses smaller clusters than FAT
drives, resulting in a more efficient use of space on large disks. It also contain boot strap
which load the operating system.

1.4)DOS COMMANDS:
1.4.1) To show or create a new date:
C:\>DATE

1.4.2) To show or create a new time


C:\>TIME

1.4.3) To show or create a new version number


C:\>VER

1.4.4) To show a volume


C:\>VOL

1.4.5) To change a label name


C:\>LABEL
1.4.6) To create a file
C:\>COPY CON a.txt

1.4.7)To show the content of a file


C:\>TYPE a.txt

1.4.8) To copy the content of a file


C:\>COPY a.txt p.txt

1.4.9) To rename a file


C:\>REN a.txt new.txt

1.4.10) To delete a file


C:\>DEL a.txt

Another way to view the content of a file


C:\>COPY a.txt CON

1.4.11) To print the contents of a file


C:\>COPY a.txt PRN

1.4.12) To copy the contents of two file into another file


C:\>COPY a.txt + b.txt c.txt

1.4.13) To move files into another location:


C:\> MOVE C:\a.txt D:\

1.4.14) To save the file press


Ctrl + Z (^Z)

1.4.15) To put off the command prompt and show the execution of result
only
ECHO OFF

1.4.16) To echo a line or word


ECHO WELCOME
ECHO [a line]
1.5) REDIRECTION:
C:\>DIR > a.txt
[to save DIR content in file]

C:\>TYPE a.txt
[to display the content]

C:\>DIR /W >> a.txt


[to add new content called double redirection]

C:\> TYPE a.txt > PRN


[to print the content]

(>,>>,<,<<) are the symbols of redirection

1.6) ATTRIB:
Each file in DOS has various attributes attached to it. Thus attributes
decide the fate of the file. Among them are read only, hide, etc. So you can
change the attribute of a file using the command called attrib, and the
options attached to it. The command is:
C:\> Attrib modes path/switches
where path is the path of the file whose attributes you want to change.
Various switches in use are:

Switch Action
+A Changes file setting to archived
-A Changes files to not archived
+H Changes specified file(s) to hidden which means the
file(s) will not be visible to most DOS operations.
-H Makes hidden file(s) visible again
+R Changes specified file(s) to read-only which means
the file(s) cannot be overwritten or erased
+S Marks specified file(s) as DOS system file(s)
-S Removes DOS system file setting
/S Used with the file names that contain wildcard
character or subdirectory names without file names.
This option will include matching files in sub
directories nested below the current directory.
1.7) DIRECTORY MANAGEMENT COMMANDS:

1.7.1) DIR [to work with directory]


1.7.2) MD/MKDIR [to make a directory]
1.7.3) CD [to change directory]
1.7.4) RD [to remove directory]
1.7.5) MOVE [to move directory]
1.7.6) TREE:[to display the structure of the directory]

C:\> MD acc
[to create a new directory]

C:\> CD acc
[to enter in a directory]

C:\acc\> CD..
[to go back 1 step inside the root directory]

C:\>MD c:\acc\a
[to make directory with any position]

C:\>CD c:\acc\a
[to change the path]

C:\acc\a>CD
[to display the current position]

C:\acc\a
[current path is displayed]

C:\acc\a>CD\
[to go back directly to root]

C:\>

Before the use of RD command first remove file, and subdirectory in a


directory. Then only we can delete a directory.
C:\acc\>RD a
C:\acc\>CD..
C:\>RD acc
C:\>
C:\> TREE C:\acc
C:\> MOVE C:\acc A:\bcc
C:\>DIR
C:\>DIR *.txt

If (*) asterisk comes before dot it can represent zero to eight characters but
when present after dot it will represent zero to three characters.

(?)Question mark will represent only one character.

C:\>DIR *.txt
It will list all the files with txt extension

C:\>DIR ?as*.txt
It will list all the files with txt extension having ‘as’ alphabet being present
in all the files after first character.

C:\>DIR/P
It will list all names of the directory and subdirectory in page-wise order.

C:\>DIR/W
It will list all names of the directory and subdirectory in width-wise order.

C:\>DIR/B
It will list only the names of the directory and their size with no more detail.

C:\>DIR/L
[in lowercase order]

C:\>DIR/AH
[all hidden files]

C:\>DIR/AR
[all read only files]
C:\>DIR/AS
[all system files]

C:\>DIR/AD
[all directory files]

C:\>DIR/ON
[ in alphabetical order of name]

C:\>DIR/OE
[in external files wise]

C:\>DIR/OS
[in ascending order of file size]

C:\>DIR/OD
[in date wise order]

C:\>DIR/S
[search recursively]

C:\>DIR/S a.txt
[search a file recursively]

C:\>DELTREE
It will remove or delete all files and folder or entire tree of root directory,
irrespective of the presence or absence of files or folder in the root directory.

1.8) EXTERNAL COMMANDS:


1.8.1) FDISK Command:
This command is used to create partition for a raw disk drive. Using this
command we can also view the list of partition, delete a partition, activates a
particular partition. It’s a menu based command and used by the hardware
personnel to maintain the disk.
C:\>FDISK or A:\>FDISK
They are called UTILITY Command.
1.8.2) FORMAT Command:
It is used to create DOS file system (FAT and root directory) for the DOS
environment. It create the file system for DOS. It cleanup the disk, selects or
find out the BAD cluster and mention it in the FAT chain. We can use
format command in two ways:
I. Quick format – C:\>FORMAT/q
II. Unconditional format – C:\>FORMAT

1.8.3) UNFORMAT Command:


C:\>UNFORMAT
It is found in DOS 6.22 version. We can retrieve (recall) all information lost
by using UNFORMAT command. It performs just opposite operation of
format command. In the DOS version 6.22 or above we found out this
command. If we execute quick format operation in a disk and just after that
operation we execute UNFORMAT command then it can restore the
previous status of the disk.

1.8.4) SCANDISK Command:


C:\>SCANDISK
SCANDISK is one of the most important disk utility tools. It performs a list
of job on a disk:
i. It checks every path of file and directory are correct or not.
ii. It finds out the bad cluster location and fix it.
iii. It resolves the problem of lost chain/cluster.
iv. It also checks the free area of the disk.
v. It also checks and verify the FAT and root directory location.

So it takes very long time to reconfigure the file system of DOS.

1.8.5) CHKDSK Command:


C:\>CHKDSK
CHKDSK is another disk utility command. It produces a report on basis of
FAT and root directory of the disk. The report contain total disk area, free
disk area, total amount of RAM, total amount of available RAM, total
amount of bad cluster, etc. in the form of byte and cluster format. It take
very little time than SCANDISK operation, because it not check the entire
disk but only the portion of disk is being checked.
1.8.6) MEM Command:
C:\>MEM
MEM generates a report and inform us about the conventional memory, used
memory, block, unused memory block, extended memory block, expanded
memory block, etc.

/?:
The inclusion of /? to MEM and SCANDISK command will generate help.
C:\>MEM/?
C:\>SCANDISK/?

1.8.7) MSBACKUP and RESTORE Command:


C:\>MSBACKUP
After DOS version 5.00 we found a new backup command is called
MSBACKUP. It is used for DOS environment. MSBACKUP is another
command for Windows environment. MSBACKUP command maintains a
configuration file to maintain the backup list or files. It also helps for the
administrator to save time for the whole backup process. BACKUP means
user readable format to machine readable format and RESTORE is its vice-
versa.

A same version RESTORE command is required to restore all the files.


RESTORE command performs just opposite operation of BACKUP
command. It converts all machine readable format information to user
readable format. Without BACKUP command we can’t use restore
command.

1.8.8) DISKCOPY Command:


C:\>DISKCOPY
Using DISKCOPY command we can make the image copy of a disk to
another. It is used only on homogeneous type of disk ( i.e. same size and
same format). It operates sector by sector reading and writing from source to
destination disk.
In case of a single floppy disk drive we can perform the disk copy operation
by the following command.
C:\>DISKCOPY A: A:
In this case C drive or the RAM memory is used as an intermediate place to
hold the information about the source disk.
C:\>DISKCOPY/V A: A:
[for verification]
C:\>DISKCOPY/M A: A:

1.8.9) DISKCOMP Command:


C:\>DISKCOMP A: B: [to compare the disk]
DISKCOMP command is used to compare two homogeneous disk one same
or not by the content. Basically it is used after the DISKCOPY operation.
C:\>DISKCOPY/V A: A:
C:\>DISKCOMP A: A:

1.8.10) SETVER Command:


Using SETVER command we can set a version for a specific executable file
in DOS environment. For example,
C:\>SETVER C:\A.EXE 3.00
A.EXE can be executed only in DOS version 3.00, but we are in DOS
version 6.22. To set the version of a.exe file and to set and run the DOS
version a.exe file.

1.8.11) SUBST Command:


SUBST create a virtual disk in DOS environment. It contains its file and
information until the switch is off. To implement it first of all we must save
or set the LASTDRIVE command in config.sys file.
C:\>SUBST C:\XYZ G:\

1.8.12) XCOPY Command:


XCOPY can be used on heterogeneous disk (i.e. floppy to hard disk or vice-
versa). It can copy the entire branch including all subdirectory and file from
source to destination by a single command.
C\>XCOPY/S C:\XYZ A:
It copy the entire content of XYZ folder or subdirectory to floppy disk drive.
This command is an extended command of copy. Here you can copy any
number of files from any place in the hard disk to another place. The
command syntax is written as:
XCOPY source: path target: path [/switches]
where you have to define the path of the source files and similarly define the
path of the target. Various switches used here are listed below:

SWITCH ACTION
/a Copies only those files matching the source specification that
also have their archive bit set.
/d: date Copies files that were modified on or after the specified date.
/e Creates subdirectories on the target location, even if there are
no files in them.
/m Resets the archive bit on a file after making the copy
/p Issues a prompt asking you to confirm the copy of each source
file.
/s Copies files matching the source specification that are found in
sub directories nested below the source subdirectory
/v Performs a verification check against the image of the file in
memory.
/w Causes XCOPY to pause before making copies allowing you
an opportunity to change disk in the source drive if necessary.

1.8.13) Backup Command:


There are times when you need to backup files to another drive to save the
disk space area. The command is used as:
C:\>MSBACKUP file(s)/switches
where file(s) are the files which have to be backed up. Following switch
options are available:

SWITCH ACTION
/BW Starts MSBACKUP in black and white for
monitors that have trouble displaying the screen
colors
/TD Backups up all files named in the specification
file that has changed since the last full backup.
/TF Backups all files named in the specification.
/TI Backups all files named in the specification file
that have changed since the last full backup

1.8.14) RESTORE Command:


Once you backup the file, you must restore them too. The command for this
is:
RESTORE source: path target drive: /switches
where source drive has the files which have been backed up. Various switch
options are:

SWITCH ACTION
/A: mm-dd-yy Restores only those files that were modified on or
after the specified date, where mm is the month,
dd is the day and yy is year.
/B: mm-dd-yy Restores only those files that were modified on or
before the specified date, namely mm-dd-yy.
/D Displays file name(s) on the backup disk but does
not restore them.
/E: hh-mm-ss Restores those files modified at or earlier than the
specified time, where hh is the hour (in 24 hr.
format), mm is the minutes after the hour, and ss
is the seconds.
/L: hh:mm:ss Restores only those files that were modified at or
after the specified time.
/M Restores files that were modified since the last
backup was made
/N Restores files that were deleted since the last
backup
/P Prompts to confirm the restoration of files that
were changed since the last backup or marked as
read-only files.
/S Restores files in sub directories nested below the
specified target subdirectory.

You might also like