DOS Commands
What is a command
Types of DOS Commands
– Internal
– External
Basic Terms
– File (File Types)
Executable File
Non Executable File
– Directory
– Root Directory
– Parent Directory
What is a Command
A command is a set of instructions
used to perform a specific work
Interpreted by the OS interpreter to a
machine language
– E.g. <md Ram>,<cd Ram>,etc.
Types of Command
Internal Command
– Those commands which are already loaded
in the [Link] file while switching to
the MS DOS
– E.g. CLS, VER, DEL, etc.
External Command
– Those commands which are not loaded when
loading the Program but are available in the
Disk and can be invoked whenever necessary
– E.g. FORMAT, TREE, XCOPY, etc.
What is a File
A group of organized data (records)
which are assembled for one particular
purpose and considered as one unit
Stored in permanent storage like hard
disk, diskettes,etc.
Types of Files
Files can broadly be categorized into two
types:
– Executable Files
– Non-Executable Files (Data Files)
What are EXE Files
Exe Files:
– Program files that run or execute
themselves
– Have either COM or EXE or BAT as
extension
What are Data Files
Non- executable files that contain only
the data that we produce
Cannot execute themselves
Need application program to run
What is a Directory
A directory is a list of file which is itself
a file stored in the computer’s memory
so that users can reference it as it is
required
Also called a catalog of files
Root Directory
The Root directory is that directory
that is automatically created when the
disk is formatted
It is the current drive that we have
been working
– E.g. A:\, B:\ (for Floppy Disk Drive)
– C:\,D:\ etc. (for Hard Disk Drive)
Current / Parent Directory
Current directory is that directory in
which you are currently working
Parent directory is that directory which
is one level up of the current directory
– E.g. C:\Ram\Hari>
Current directory
Parent directory
Root directory
Getting into MS DOS
To start MS DOS,
click on the Start
button and choose
Run
In the Run dialog
box, type CMD or
COMMAND which is
the EXE file for MS
DOS
Click on the OK
button
Listing the Directories and
Files in MS DOS
For listing the Sub-directories and Files
within a directory, we use the DIR
command
Syntax :
– DIR [Directory_name]
– E.g. C:\>DIR NCIT
Displays all the directories/files within the
directory NCIT
1. Dir/p : -Display file and directory page wise.
2. Dir/w :- Display file And directory in horizontal
Style.
3. Dir/p/ w:- Display file And directories page wise
and horizontal style also.
4. Dir/ah :-Display all hidden files and directories.
5. Dir/a-d : - Display only files.
6. Dir/ad :- Display only Directories.
7. Dir/a/s:-Display all directory and file with
subdirectory.
8. Dir/a :- Display All Hidden And Non hidden file
and directories.
9. Dir n*.* :Display all file and directory starting
with ‘ n ’ alphabet.
Creating a Directory in MS DOS
For creating the Directory in MS DOS, we
use the MD (Make Directory)command
Syntax:
– C:\> MD NCIT
Changing a Directory in MS DOS
For changing the directory in MS DOS,
we use the CD (Change Directory) command
Syntax:
– C:\>CD NCIT
Now it appears as:
– C:\NCIT>
Switching between Directories
For switching between the directories
we use the CD.. Or CD\ commands
The CD.. Command switches from the
current directory to the Parent directory
whereas the CD\ command switches
from the current directory to the Root
directory
Creating Files in MS DOS
For creating the files in DOS, the command
COPY CON is used
Syntax:
– COPY CON filename
Note: File name should not exceed eight characters excluding
three characters for extension
– E.g. [Link]
Reading Files in MS DOS
For reading the Pre-created files in MS
DOS, we use the TYPE command. It
displays all the contents that are in the
file.
Syntax :
– TYPE Filename
Renaming Files
For renaming the files in MS DOS we
use the REN Command
Syntax:
– REN oldfilename newfilename
Deleting Files in MS DOS
For deleting files in MS DOS we use
the DEL command
Syntax :
– DEL Filename
Deleting directories in MSDOS
For deleting the directories in MS DOS
we use the RD command
Syntax :
– RD Directoryname
Note : For removing the directory first the directory should
be empty
Copying Files in MS DOS
In MS DOS, Files can be copied within
the same as well as to another Drive /
directory
For copying the files in the same drive
we use the following syntax :
– COPY sourcefile destination
– E.g. C:\>COPY [c:\]NCIT\[Link] C:\NCITNGH
Copying Files in MS DOS
Files can be copied not only in the same
drive but in different drive, too. For copying
the files in different drive, a complete
location along with the Drive specification
should be mentioned
Syntax :
– C:\>COPY C:\NCIT\file1 D:\NCITNGH\NCIT
The MOVE Command
The MOVE Command in MS DOS is used to
permanently move the files from one location
to another.
The COPY command only copies the files leaving the
original one, whereas the MOVE command does not
leave any copy
Syntax :
– C:\>MOVE source_file destination_directory
E.g.
– C:\>MOVE c:\NCIT\file1 D:\NCIT1\file2
The VOL Command
The VOL command is used to check the
Volume of the Disk-drive. It displays the
volume of the current disk-drive
Syntax :
– VOL Drivename
E.g.
– C:\> VOL
Checking the Version of OS
The VER command is used to check the
version of the Operating System that is
used in the Computer
Syntax :
– C:\>VER
E.g. C:\>VER
Returns the version of OS as Microsoft Windows 2000
[version 5.00.21951]
Checking the Date/Time
For checking the date from the system in MS
DOS, we use the DATE command. It returns
the current system date.
Similarly, the TIME command returns the
current time from the system.
Syntax :
– C:\>DATE
E.g. C:\>DATE
External Commands
Those commands which are not
loaded when loading the Program
but are available in the Disk and can
be invoked whenever necessary
E.g. FORMAT, TREE, XCOPY, etc.