DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands...

38
DOS Commands DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands Internal Internal External External Basic Terms Basic Terms File ( File ( File Types) File Types) Executable File Executable File Non Executable File Non Executable File Directory Directory Root Directory Root Directory Parent Directory Parent Directory

Transcript of DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands...

Page 1: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 2: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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.

Page 3: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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.

Page 4: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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.

Page 5: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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)

Page 6: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 7: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 8: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 9: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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)

Page 10: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 11: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 12: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 13: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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.

Page 14: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 15: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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>

Page 16: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 17: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 18: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 19: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 20: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 21: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 22: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 23: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 24: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 25: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 26: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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]

Page 27: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 28: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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.

Page 29: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 30: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 31: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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:

Page 32: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 33: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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:

Page 34: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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:

Page 35: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 36: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 37: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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

Page 38: DOS Commands What is a command What is a command Types of DOS Commands Types of DOS Commands –Internal –External Basic Terms Basic Terms –File ( File Types)

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