0% found this document useful (0 votes)
66 views12 pages

Understanding DOS

DOS is an operating system with a command-line interface used on personal computers. It provides commands to access and manipulate disks and interact with the computer. DOS commands are either internal commands built into DOS or external commands located in files. Important commands include DIR to view directory contents, COPY to copy files, DEL to delete files, and MD to create directories. DOS also includes commands to manage disks, view and compare files, set system properties, and recall previously used commands.

Uploaded by

Manniel E Erfe
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)
66 views12 pages

Understanding DOS

DOS is an operating system with a command-line interface used on personal computers. It provides commands to access and manipulate disks and interact with the computer. DOS commands are either internal commands built into DOS or external commands located in files. Important commands include DIR to view directory contents, COPY to copy files, DEL to delete files, and MD to create directories. DOS also includes commands to manage disks, view and compare files, set system properties, and recall previously used commands.

Uploaded by

Manniel E Erfe
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/ 12

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.

A brief description of important DOS commands is given below:

Changing drive
Type drive letter of the drive to which you want to switch to, on the command prompt followed by ‘:’

Example: c:>a: This will change the current drive from C to A.


Result: a:>

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.

Working with Directories


· dir to view the contents of a directory Prompt
on screen: drive:> Syntax: dir

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.

Use wild cards to display selected lists. For example:


- dir *.* Displays all files and subdirectories on the drive
- dir ?????.com Displays all files having names up to five characters and
extension ‘com’
dir command can be modified using these wild cards and other switches as follows so that only one
screen of selected information is displayed at a time.

- dir/p Lists the directory contents page wise.


- dir/w Lists the directory contents in a wider format, that is, only file names
and extensions.
- dir/w/p Lists the directory contents in a wider format, page wise.
· cd to change from one directory to another
Prompt on screen: drive:>
Syntax: cd drive:\path

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>

· cd.. to switch back one level up in the directory


structure Prompt on screen: drive:> Syntax: cd..

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:\dos\subdos>cd\ This will switch back to the root drive, C


Result: c:\>

· md to create a new directory Prompt on


screen: drive:> Syntax: md drive:\path\
dirname

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

Working with Files


· copy to copy a file from one directory or drive to another
Prompt on screen: drive:>
Syntax: copy drive:\source path\filename
drive:\destination path\ filename

Example: copy c:\neduet\cfile.exe c:\windows

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

Example: c:\>ren cfile.exe edit.exe

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.

Example: c:\>type cfile.txt |more

· 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

Example: c:\>fc command.txt newfile.txt


This will compare the two files, ‘command.txt’ and ‘newfile.txt’ to see their listings.
DOS CONFIGURATION COMMANDS

 date to set date of the system


Prompt on screen: drive:>
Syntax: date mm/dd/yy (or use ‘-’ in place of ‘/’)
Example: c:\>date 11-16-2013 This will set date to November 16, 2013.

 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.

 cls to clear the screen


Prompt on screen: drive:> Syntax:
cls
Example: c:\>cls This will clear the screen and bring the cursor to the top.

 pro mpt to se t sy s te m prompt


Prompt on screen: drive:>
Syntax: prompt prompt name
Example: c:\>prompt neduet: This will set the current prompt to neduet:
Result: neduet:
To get back to standard default system prompt, type prompt without parameters.
Use the following switches anywhere in the prompt command to incorporate special information:
- $t to get the current time
- $d to get the current date
- $p to get both the active drive and directory
- $n to get the active drive only
- $g to represent the character ‘>’
- $l to represent the character ‘<’
- $b to represent the character ‘|’
Example: c:\>prompt time is $l$t$g Result: time is <14:02:10>

 path to set the default command search path Prompt


on screen: drive:>
Syntax: path drive:\pathname1
Use ‘;’ to specify more than one search paths
Example: c:\>path c:\neduet;c:\float
This will tell DOS to search for programs in neduet directory, then in float directory.

 doskey to recall previously generated DOS commands, first it should be enabled,


which is done by using doskey command.
Prompt on screen: drive:>
Syntax: doskey
Example: c:\>doskey This will install doskey.
Now use UP and DOWN ARROWS to recall commands; ESC clears command line; F7 displays
command history; ALT+F7 clears command history; F8 searches command history; F9 selects a
command by number. Make sure the Office key is disabled on keyboard; otherwise these keys will
not perform the tasks correctly.

 color sets the default console foreground and background color


Prompt on screen: drive:>
Syntax: color [attr]

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.

 exit to exit from DOS sh ell


Prompt on screen: drive:>
Syntax: exit
Example: c:\>exit This will close the DOS window

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.

You might also like