DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands...
-
Upload
branden-gaines -
Category
Documents
-
view
266 -
download
5
Transcript of DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands...
DOS DOS CommandsCommands What is a commandWhat is a command
Types of DOS CommandsTypes of DOS Commands– InternalInternal– ExternalExternal
Basic TermsBasic Terms– File (File (File Types)File Types)
Executable FileExecutable File Non Executable FileNon Executable File
– DirectoryDirectory– Root DirectoryRoot Directory– Parent DirectoryParent Directory
What is a CommandWhat is a Command A command is a set of A command is a set of
instructions used to perform a instructions used to perform a specific workspecific work
Interpreted by the OS interpreter Interpreted by the OS interpreter to a machine languageto a machine language– E.g. <md Ram>,<cd Ram>,etc.E.g. <md Ram>,<cd Ram>,etc.
Types of CommandTypes of Command Internal CommandInternal Command
– Those commands which are already Those commands which are already loaded in the Command.COM file while loaded in the Command.COM file while switching to the MS DOSswitching to the MS DOS
– E.g. E.g. CLSCLS, , VERVER, , DELDEL, etc., etc. External CommandExternal Command
– Those commands which are not loaded Those commands which are not loaded when loading the Program but are when loading the Program but are available in the Disk and can be available in the Disk and can be invoked whenever necessaryinvoked whenever necessary
– E.g. E.g. FORMATFORMAT, , TREETREE, , XCOPYXCOPY, etc., etc.
What is a FileWhat is a File A group of organized data A group of organized data (records)(records)
which are assembled for one which are assembled for one particular purpose and considered particular purpose and considered as one unitas one unit
Stored in permanent storage like Stored in permanent storage like hard disk, diskettes,etc.hard disk, diskettes,etc.
Types of FilesTypes of Files Files can broadly be categorized into Files can broadly be categorized into
two types:two types:– Executable FilesExecutable Files– Non-Executable Files Non-Executable Files (Data Files)(Data Files)
What are EXE FilesWhat are EXE Files Exe Files:Exe Files:
– Program files that run or execute Program files that run or execute themselvesthemselves
– Have either Have either COMCOM or or EXEEXE or or BATBAT as as extensionextension
What are Data FilesWhat are Data Files Non- executable files that contain Non- executable files that contain
only the data that we produceonly the data that we produce Cannot execute themselvesCannot execute themselves Need application program to runNeed application program to run
What is a DirectoryWhat is a Directory A directory is a list of file which is A directory is a list of file which is
itself a file stored in the itself a file stored in the computer’s memory so that users computer’s memory so that users can reference it as it is requiredcan reference it as it is required
Also called a catalog of filesAlso called a catalog of files
Root DirectoryRoot Directory The Root directory is that The Root directory is that
directory that is automatically directory that is automatically created when the disk is created when the disk is formattedformatted
It is the current drive that we It is the current drive that we have been working have been working – E.g. A:\, B:\ E.g. A:\, B:\ (for Floppy Disk Drive)(for Floppy Disk Drive)
– C:\,D:\ etc. C:\,D:\ etc. (for Hard Disk Drive)(for Hard Disk Drive)
Current / Parent DirectoryCurrent / Parent Directory
Current directory is that directory Current directory is that directory in which you are currently in which you are currently working working
Parent directory is that directory Parent directory is that directory which is one level up of the which is one level up of the current directorycurrent directory– E.g. C:\Ram\Hari>E.g. C:\Ram\Hari>
Root directoryParent directory
Current directory
Getting into MS DOSGetting into MS DOS To start MS DOS, To start MS DOS,
click on the Start click on the Start button and choose button and choose RunRun
In the Run dialog In the Run dialog box, type box, type CMDCMD or or COMMANDCOMMAND which which is the EXE file for is the EXE file for MS DOSMS DOS
Click on the Click on the OKOK buttonbutton
Listing the Directories and Listing the Directories and Files in MS DOSFiles in MS DOS
For listing the Sub-directories and For listing the Sub-directories and Files within a directory, we use the Files within a directory, we use the DIRDIR command command
Syntax :Syntax :– DIRDIR [Directory_name] [Directory_name]
– E.g. C:\>DIR NCITE.g. C:\>DIR NCIT Displays all the directories/files within the Displays all the directories/files within the
directory NCITdirectory NCIT
1.1. Dir/p : -Display file and directory page wise.Dir/p : -Display file and directory page wise.2.2. Dir/w :- Display file And directory in horizontal Dir/w :- Display file And directory in horizontal
Style.Style.3.3. Dir/p/ w:- Display file And directories page wise Dir/p/ w:- Display file And directories page wise
and horizontal style also.and horizontal style also.4.4. Dir/ah :-Display all hidden files and directories.Dir/ah :-Display all hidden files and directories.5.5. Dir/a-d : - Display only files.Dir/a-d : - Display only files.6.6. Dir/ad :- Display only Directories.Dir/ad :- Display only Directories.7.7. Dir/a/s:-Display all directory and file with Dir/a/s:-Display all directory and file with
subdirectory.subdirectory.8.8. Dir/a :- Display All Hidden And Non hidden file Dir/a :- Display All Hidden And Non hidden file
and directories.and directories.9.9. Dir n*.* :Display all file and directory starting Dir n*.* :Display all file and directory starting
with ‘ n ’ alphabet.with ‘ n ’ alphabet.
Creating a Directory in MS Creating a Directory in MS DOSDOS
For creating the Directory in MS For creating the Directory in MS
DOS, we use the DOS, we use the MDMD (Make (Make
Directory)Directory)commandcommand
Syntax:Syntax:– C:\> C:\> MDMD NCIT NCIT
Changing a Directory in MS Changing a Directory in MS DOSDOS
For changing the directory in MS For changing the directory in MS DOS, we use the DOS, we use the CD CD (Change Directory)(Change Directory) commandcommand
Syntax:Syntax:– C:\>C:\>CDCD NCIT NCIT
Now it appears as: Now it appears as: – C:\NCIT>C:\NCIT>
Switching between DirectoriesSwitching between Directories
For switching between the For switching between the directories we use the directories we use the CD..CD.. Or Or CD\CD\ commandscommands
The The CD..CD.. Command switches from Command switches from the current directory to the Parent the current directory to the Parent directory whereas the directory whereas the CD\CD\ command switches from the command switches from the current directory to the Root current directory to the Root directory directory
Creating Files in MS Creating Files in MS DOSDOS For creating the files in DOS, the For creating the files in DOS, the
command command COPY CONCOPY CON is usedis used Syntax:Syntax:
– COPY CONCOPY CON filenamefilename
Note: File name should not exceed eight characters Note: File name should not exceed eight characters excluding three characters for extension excluding three characters for extension – E.g. College1.txtE.g. College1.txt
Reading Files in MS Reading Files in MS DOSDOS For reading the Pre-created files For reading the Pre-created files
in MS DOS, we use the in MS DOS, we use the TYPETYPE command. It displays all the command. It displays all the contents that are in the file.contents that are in the file.
Syntax :Syntax :– TYPETYPE FilenameFilename
Renaming FilesRenaming Files
For renaming the files in MS DOS For renaming the files in MS DOS we use the we use the RENREN Command Command
Syntax:Syntax:– REN REN oldfilename newfilename oldfilename newfilename
Deleting Files in MS Deleting Files in MS DOSDOS For deleting files in MS DOS we For deleting files in MS DOS we
use the use the DELDEL command command
Syntax :Syntax :– DELDEL FilenameFilename
Deleting directories in Deleting directories in MSDOSMSDOS
For deleting the directories in MS For deleting the directories in MS DOS we use the DOS we use the RDRD command command
Syntax :Syntax :– RD RD DirectorynameDirectoryname
Note :Note : For removing the directory first the directory For removing the directory first the directory should be emptyshould be empty
Copying Files in MS Copying Files in MS DOSDOS In MS DOS, Files can be copied In MS DOS, Files can be copied
within the same as well as to within the same as well as to another Drive / directoryanother Drive / directory
For copying the files in the same For copying the files in the same drive we use the following drive we use the following syntax :syntax :– COPYCOPY sourcefile destinationsourcefile destination
– E.g. C:\>E.g. C:\>COPYCOPY [c:\]NCIT\file1.txt C:\NCITNGH [c:\]NCIT\file1.txt C:\NCITNGH
Copying Files in MS Copying Files in MS DOSDOS
Files can be copied not only in the Files can be copied not only in the same drive but in different drive, too. same drive but in different drive, too. For copying the files in different drive, For copying the files in different drive, a complete location along with the a complete location along with the Drive specification should be Drive specification should be mentionedmentioned
Syntax :Syntax :– C:\>C:\>COPYCOPY C:\NCIT\file1 D:\NCITNGH\NCIT C:\NCIT\file1 D:\NCITNGH\NCIT
The MOVE CommandThe MOVE Command The The MOVEMOVE Command in MS DOS is used Command in MS DOS is used
to permanently move the files from one to permanently move the files from one location to another.location to another.
The COPY command only copies the files The COPY command only copies the files leaving the original one, whereas the leaving the original one, whereas the MOVEMOVE command does not leave any copycommand does not leave any copy
Syntax :Syntax :– C:\>C:\>MOVEMOVE source_file destination_directory source_file destination_directory
E.g.E.g.– C:\>C:\>MOVEMOVE c:\NCIT\file1 D:\NCIT1\file2 c:\NCIT\file1 D:\NCIT1\file2
The VOL CommandThe VOL Command The The VOLVOL command is used to check command is used to check
the Volume of the Disk-drive. It the Volume of the Disk-drive. It displays the volume of the current displays the volume of the current disk-drivedisk-drive
Syntax :Syntax :– VOLVOL Drivename Drivename
E.g. E.g. – C:\> C:\> VOLVOL
Checking the Version of Checking the Version of OSOS
The The VER VER command is used to command is used to check the version of the Operating check the version of the Operating System that is used in the System that is used in the ComputerComputer
Syntax :Syntax :– C:\>C:\>VERVER
E.g. C:\>E.g. C:\>VERVERReturns the version of OS as Microsoft Windows 2000 [version 5.00.21951]
Checking the Checking the Date/TimeDate/Time
For checking the date from the system For checking the date from the system in MS DOS, we use the in MS DOS, we use the DATEDATE command. command. It returns the current system date.It returns the current system date.
Similarly, theSimilarly, the TIME TIME command returns command returns the current time from the system.the current time from the system.
Syntax :Syntax :– C:\>C:\>DATEDATE
E.g. C:\>E.g. C:\>DATEDATE
External CommandsExternal Commands
Those commands which are not Those commands which are not loaded when loading the loaded when loading the
Program but are available in the Program but are available in the Disk and can be invoked Disk and can be invoked
whenever necessarywhenever necessary
E.g. E.g. FORMATFORMAT, , TREETREE, , XCOPYXCOPY, etc., etc.
The Label CommandThe Label Command The Label command is used to The Label command is used to
check the label of the disk that check the label of the disk that you have been currently workingyou have been currently working
Syntax :Syntax :– LabelLabel [drivename] [drivename]
E.g.E.g.– C:\>C:\>LabelLabel
XCopy CommandXCopy Command Xcopy command is used to copy the files Xcopy command is used to copy the files
from one location to another along with from one location to another along with the directories/sub-directoriesthe directories/sub-directories
Syntax :Syntax :– C:\>C:\>XCOPYXCOPY c:\dir_name d:\[dir_name] c:\dir_name d:\[dir_name]
E.g. E.g. C:\>C:\>XCOPYXCOPY c:\CSE d:\[CSE] c:\CSE d:\[CSE]
Note: For copying all the sub-directories, /S is used
The DISKCOPY CommandThe DISKCOPY Command
The The DISKCOPYDISKCOPY command is used to command is used to copy all the files from one disk to the copy all the files from one disk to the another diskanother disk
It can be used to copy files from one It can be used to copy files from one floppy disk to another floppy disk to another (if two floppy drives exist (if two floppy drives exist in the System)in the System)
Syntax :Syntax :– C:\> C:\> DISKCOPY DISKCOPY first_diskdrive: second_diskdrive:first_diskdrive: second_diskdrive:
E.g.E.g.– C:\> C:\> DISKCOPYDISKCOPY A: B: A: B:
The DISKCOMP CommandThe DISKCOMP Command
The The DISKCOMPDISKCOMP command in MS command in MS DOS compares the contents of two DOS compares the contents of two disks disks (hard disk or floppy disk)(hard disk or floppy disk).. The system The system first reads the contents of one disk first reads the contents of one disk and compares it with the anotherand compares it with the another
Syntax :Syntax :– C:\> C:\> DISKCOMP DISKCOMP A: B:A: B:
For defining the no.of sectors, /no. can be used
The FORMAT CommandThe FORMAT Command The The FORMATFORMAT command prepares a command prepares a
new disk for use by organizing the disk new disk for use by organizing the disk into magnetic tracks and sectorsinto magnetic tracks and sectors
Syntax :Syntax :– A:\>A:\>FORMATFORMAT [Drive_name] [Drive_name]
E.g. E.g. – C:\>C:\>FORMATFORMAT A: A:
The TREE CommandThe TREE Command The TREE command is used to The TREE command is used to
display all directory pathnames display all directory pathnames on the specified diskon the specified disk
Syntax :Syntax :– C:\>C:\>TREETREE [disk_name] [disk_name]
E.g. E.g. – C:\>C:\>TREE TREE A:A:
The EDIT CommandThe EDIT Command The The EDITEDIT command in MS DOS is used command in MS DOS is used
to edit the files. It provides a different to edit the files. It provides a different full screen Editor window with a few full screen Editor window with a few menu options.menu options.
Syntax :Syntax :– C:\>C:\>EDITEDIT [filename] [filename]
E.g.E.g.– C:\>C:\>EDITEDIT file1 file1
The MORE CommandThe MORE Command The The MOREMORE Command in MS DOS is used Command in MS DOS is used
to view the contents of directories or to view the contents of directories or files one line after the another, I.e. it files one line after the another, I.e. it displays one line at one press of return displays one line at one press of return (Enter)(Enter) key key
Syntax :Syntax :– DIR |DIR |MOREMORE
E.g.E.g.– DIR C:\NCIT |DIR C:\NCIT |MOREMORE
A pipeline is used along with the MORE command
The PRINT CommandThe PRINT Command The The PRINTPRINT Command in MS DOS Command in MS DOS
is used to print the text filesis used to print the text files Syntax :Syntax :
– PRINTPRINT Filename Filename E.g.E.g.
– PRINTPRINT File1.txt File1.txt
The PROMPT CommandThe PROMPT Command The The PROMPTPROMPT is used to configure is used to configure
a DOS prompt into our linkinga DOS prompt into our linking
Syntax :Syntax :– C:\ C:\ PROMPTPROMPT Promptname Promptname
E.g.E.g.– PROMPTPROMPT NCIT NCIT
Now, the Prompt will be as NCIT