Understanding DOS
Understanding DOS
DOS, the acronym for Disk Operating System, is an operating system with a command-line
interface used on personal computers. It provides a set of commands that enables the users to access
or manipulate information on their disks, as well as simply interact with their computer.
DOS commands are of two types namely internal commands and external commands.
Internal commands are those which are built into command.com.
External commands are those that must be located from a file loaded by command.com
before it can be executed.
Changing drive
Type drive letter of the drive to which you want to switch to, on the command prompt followed by ‘:’
Wild Cards
DOS recognizes two wild cards:
· The asterisk (*) represents one or more characters that a group of files has in common.
· The question mark (?) represents a single character that a group of files has in common.
Example: c:>dir This will list all the files and subdirectories on drive C, which is
being prompted on screen. If another drive needs to be accessed, first
change the drive, as previously explained and then enters the dir
command.
Example: c:>cd dos This will change the current directory from the root directory to
‘dos’ directory on the prompted drive C.
Result: c:\dos>
Example: c:\dos\subdos>cd.. This will switch back to the directory, ‘dos’ from the current
directory, ‘subdos’ of the prompted drive C.
Result: c:\dos>
· cd\ to switch back to the root drive directory
Prompt on screen: drive:> Syntax: cd\
Example: c:>md neduet This will create a new directory, named ‘neduet’ on the
drive being prompted, in this case drive C.
· rd to remove an directory (rd/s : if directory contains files)
Prompt on screen: drive:>
Syntax: rd drive:\path\dirname
Example: c:\>rd neduet This will delete the directory, named ‘neduet’ from the
prompted drive C.
· tree to view directory listing in a hierarchical structure.
Prompt on screen: drive:> Syntax: tree drive:\path
Example: tree d: This will display the hierarchical directory structure of drive D.
Use /f to display the names of the folders as well as the files in each folder, in a hierarchical manner.
Disk Management
format to format a disk
diskcopy to copy all contents of the floppy disk to another, as it only works for the floppy drive only
chkdsk to get a report on statistics of the disk
diskcomp to verify that two disks are identical by comparing each track of one disk
vol to view a disk’s volume label and it’s serial number
ver to find current version of DOS installed on your system
This will copy the file, named ‘cfile.exe’ from ‘neduet’ directory to
‘windows’ directory with the same name for the new file.
· ren to rename a file
Prompt on screen: drive:>
Syntax: ren drive:\path\old filename drive:\path\new filename
This will rename the file ‘cfile.exe’ to ‘edit.exe’ in the prompted drive C.
· del to delete a file
Prompt on screen: drive:> Syntax: del
drive:\path\filename
Example: c:\>del cfile.exe This will delete the file, ‘cfile.exe’ present in the
prompted drive C.
Wild cards can also be used with any of the above commands to work with group of files.
· type to view a file on the screen. Only text based files can be viewed, as DOS supports only such
files.
Prompt on screen: drive:>
Syntax: type drive:\path\filename
Example: c:\>type cfile.txt This will list ‘cfile.txt’.
Files longer than one screen scroll off to the top. To avoid this, use |more suffix following the command.
· fc to compare files in either ASCII or binary mode. This command displays the contents of both files,
so you can see the differences between the two. Only text based files can be compared, as
DOS supports text files only.
Prompt on screen: drive:>
Syntax: fc drive:\path\filename1 drive:\path\new filename2
time to set time of the system using the 24 hour clock representation Prompt on
screen: drive:>
Syntax: time hh:mm:ss
Example: c:\>time 14:33 This will set current time to 2:33 pm.
Here, attr specifies the color attribute of the console output. Color attributes are specified by two hex
digits. The first corresponds to the background, the second to the foreground. Each digit can be any
of the following values:
0 Black 8 Gray
1 Blue 9 Light Blue
2 Green A Light Green
3 Aqua B Light Aqua
4 Red C Light Red
5 Purple D Light Purple
6 Yellow E Light Yellow
7 White F Bright White
Example: c:\>color 1E This will set the background color to blue and text color
to light yellow.
If only one digit is used with the command, it assumes 0 for the background color, which is black,
and the mentioned digit for the foreground color.
Example: c:\>color 2 This will set the background color to black and text
color to green.
DOS HELP
Type help at the command prompt to display DOS Help table of contents.
Type help followed by the command name to view information about a command.
For example: c:\>help copy This will display information about the ‘copy’
command.
The command name can also be followed by /? to view information about a command.
For example: c:\>copy/? This will display information about the copy command.