Sie sind auf Seite 1von 6

DOS

(Disk Operating System)

File
A file is a collection of related information. Files can be of three types –
1# Text Files
Text files are data files that contain characters, numbers and symbols.
2# Command Files
A set of DOS commands put together to perform a specific task which can later be put
together in a text file are called Command Files.
3# Application Program Files
Any application program such as Word Processor is stored in a command file which
stores our work such as a document in data files.

File Name
A string of characters used to identify a document is termed as File Name. Assigning a name
to a file requires two things – File Name & Extension such as –
Report.doc Letter.txt Setup.exe
The extension part that is .doc, .txt, .exe gives information about the type of file. For instance
Report.doc is a document file with file named Report. Similarly Letter.txt is a text file with
file named Letter and Setup.exe is an application program file with file named Setup.

Directory
A directory is one where files can be kept. A directory keeps record about the files being kept
such as –
Date when file was created Time Size Type File/Directory
last modified Name
12/09/08 09:32 PM 8 Kb work1.txt
07/08/08 07:48 AM 1024 Kb <DIR> Box

Volume Label
Any diskette or fixed disk can be assigned a name or volume label to identify its contents.
An 11 Character name can be assigned at the time of formatting.

System Prompt
The first thing you’ll see when you open DOS is the system prompt. Something as follows
C :\> _ or D :\> _ C, D, E, F etc shows the default disk drive where
DOS has been installed.
It also shows the current determined location such as –
D:\Rahul\Various>_
It shows that your current location or you are in a subdirectory named ‘Various’ that is inside
a directory named ‘Rahul’ of ‘D’ drive.

Created by Rahul Mandal -1-


Date Command
This command is used to display or to modify the system’s date. Command line will be
C:\>date after pressing the enter key will show or output –
The current date is: Sun 09/21/2008
Enter the new date: _
If you want to modify or change the current date enter the new
date in the above second line in the following format mm/dd.yy or simply press Enter to keep
the Old date unchanged.

Time Command
This command is used to see or to modify the system’s time. The command line will be
C:\>time after pressing the enter key will output –
The current time is: 15:10:44.09
Enter the new time: _
In the above second line leave blank and press enter key to keep
the current time or type the new time in the following format hh:min:sec to change your
system’s time.

Dir Command
This command is use to see the directories or files of any drive or location. Command line -
C:\>dir Shows the directories in ‘C’ drive.

C:\>dir D:\
D:\>dir Shows the directories in ‘D’ drive.

C:\>dir D:\Rahul\
D:\Rahul>dir Shows directories of Rahul directory of ‘D’ drive.

Switches with Dir Command


Dir/p pause the screen after every screenful of information.
Dir/w displays directories or files in wide format.
Dir/s shows all files and subdirectories nested below the
specified directory.
Dir/b size, date and time information are not displayed.
Dir/l shows only the directories or files named in lowercase.
Dir/c columnwise information are displayed. (Default Switch)
Dir FileName.Ext displays the information of particular file. For instance -

C:\>dir D:\Ivan.doc shows the information of a file named


Ivan.doc of ‘D’ drive.
Dir *.Ext to see the information of all files with the specified
Extension. For instance –

C:/>dir D:\*.txt shows all the files with the extension .txt of
‘D’ drive.

Created by Rahul Mandal -2-


Mkdir or MD Command
This command is used to create or make a directory. Full name of MD is Make Directory.
The illustration for MD command is as follows –
C:\>Mkdir Rahul
C:\>Mkdir C:/Rahul creates a directory named ‘Rahul’ in ‘C’ drive.
C:\>MD D:\Rahul
D:\>MD Rahul creates a directory named ‘Rahul’ in ‘D’ drive.

Chdir or CD Command
This command is used to logon or access a directory. Full name of CD is Change Directory.
CD command can be used as follows –
C:\>CD Rahul will output as follows –
C:\Rahul>_ which shows that you have accessed to directory
named Rahul of ‘C’ drive.

Logging On to a Drive
Logging On to a drive means to change the drives so as to access its contents or to do some
particular function. You have to type the drive letter followed by a colon and after pressing
Enter key you are on the drive. The following illustration explains this –
If you are in system prompt i.e. C:\>_ then typing drive letter ‘D’ which refers to ‘D’
drive followed by a colon will output D:\>_ which means you have now access to ‘D’ drive.

Ex. C:/>D: <┘ will show D:\>_ D:\>E: <┘ will show E:\>_
E:\>F: <┘ will show F:\>_ F:\>C: <┘ will show C:\>_

Moving Out of a Logged Directory


Moving Out of a logged directory means to leave the directory and to move one level back
from you current directory structure. The following will make it more clear to you.

C:\Rahul3\Rahul2\Rahul1>_ It shows that your current position is inside a


directory named Rahul1 which is inside another directory named Rahul2 which is again
inside another directory named Rahul3 of drive ‘C’.
So to move out of the directory named Rahul1 and to go one step back that is to the
directory named Rahul2 you have to type ‘cd’ followed by two dots as follows –

C:\Rahul3\Rahul2\Rahul1>cd.. after pressing Enter key output will be –


C:Rahul3\Rahul2>_
Similarly typing cd.. will let you out of the directory named Rahul2 & Rahul3.

Created by Rahul Mandal -3-


Rmdir or RD Command
This command is used to delete a directory. Full Form of RD is Remove Directory.
Imp Note – RD command is applicable only when the specified directory is empty that is no
files or directories should be present in it. Following example will explain this.
If a directory structure is as follows E:\Rahul\Sachin So if you want to remove the
directory named Rahul using RD command an error message will occur describing that the
specified directory is not empty because a subdirectory named Sachin is present inside it but
if you want to remove the directory named Sachin the command will be successful bcoz the
directory is empty.For removing directory named Sachin the command line will be –

C:\>RD E:\Rahul\Sachin <┘


Or E:\Rahul>RD Sachin <┘

Copy con Command


This command is used to create or to make a file. Command syntax will be –
C:\>Command Location FileName.Ext

C:\>Copy con E:\Rahul.txt after pressing the enter key you will see a
cursor blinking to the next line. This means that you can now write data in your file and
when u have finished writing press Control Key and Z together to save the contents after that
you have been output a message 1 file copied followed by the system prompt in the next line.
This will make you a file named Rahul.txt in ‘E’ drive.

Del Command
This command is used to delete a file. Command syntax is as follows –
C:\>Command Location FileName.Ext

C:\>Del E:\Rahul.txt will delete the file named Rahul.txt from ‘E’
or E:\>Del Rahul.txt drive.

Tree Command
This command shows the directory structure like the branches of a tree.
C:\>Tree <┘ will show the directory tree of ‘C’ drive.

C:\>Tree D: <┘
Or D:\>Tree <┘ will show the directory tree of ‘D’ drive.

C:\>Tree D:\Rahul <┘


Or D:\Rahul>Tree <┘ will show the directory tree of directory named
Rahul of ‘D’ drive.

Switch with Tree Command


Tree/f will also display the files in the directory tree
Structure.
Ex. C:\>Tree/f D:\Rahul will display the tree structure of directory named
Rahul of ‘D’ drive along with the files.

Created by Rahul Mandal -4-


Type Command
This command is used to see the contents of a file. Command Syntax is as follows –
C:\>Command Location FileName.Ext

C:\>Type E:\Rahul.txt this shows the contents of the file named Rahul.txt
Or E:\>Type Rahul.txt of ‘E’ drive.

C:\>Type D:\Bag\maths.txt will show the contents of a file named


Or D:\Bag>Type maths.txt maths.txt which is inside a directory named Bag of
‘D’ drive.

Copy Command
The command is used to copy or make duplication of files. Command syntax is –

C:\>COMMAND SOURCE TARGET


The command used to copy files ┘ └Location of those Files which you want to copy

Location where you want to keep the copied files

C:\>Copy E:\Rahul.txt D:\ will copy a file named Rahul.txt of ‘E’ drive
Or E:\Copy Rahul.txt D:\ to ‘D’ drive.

C:\>Copy E:\Bag\maths.txt D:\Box\ will copy a file named maths.txt


Or E:\ Bag>Copy maths.txt D:\Box\ which is situated inside a directory
named Bag of ‘E’ drive, to a directory named Box
of ‘D’ drive.

Switches with Copy Command

Copying all files with same extension from one drive to another.
C:\>Copy E:\*.txt D:\ copies all files having extension .txt of ‘E’ drive to
Or E:\>Copy *.txt D:\ ‘D’ drive.

Copying all files with same extension from one location to another.
C:\>Copy E:\Bag\*.txt D:\Box\ copies all files having extension .txt from a
Or E:\Bag>Copy *.txt D:\Box\ a directory named Bag of ‘E’ drive to a
directory named Box of ‘D’ drive.

Copying a file having some filename from a location to another location with some
other file name.
C:\>Copy E:\Bag\Old.txt D:\Box\New.txt
Or E:\Bag>Copy Old.txt D:\Box\New.txt
Copies a file named Old.txt which is inside a directory named Bag of ‘E’ drive to a
Directory named Box of ‘D’ drive with file named New.txt

Created by Rahul Mandal -5-


Copying the contents of all files with same extension from a location in a file with some
other file name to another location.
C:\Copy E:\Bag\*.txt D:\Box\All.txt
Or E:\Bag>Copy *.txt D:\Box\All.txt
Copies the contents of all files having extension .txt from a directory named Bag of
‘E’ drive to a directory named Box of ‘D’ drive with file named All.txt

Copying the contents of two files with same extension from a location in one file with some
other filename to another location.
If R1.txt & R2.txt are two files located inside a directory named Rahul of ‘E’
drive, whose contents should be combined into a new file named Combined.txt in ‘D’ drive
then the command used should be –
E:\Rahul>copy R1.txt+R2.txt D:\Combined.txt

Note: - To use the command correctly you must log on up to the location or position of the
files whose contents are to be combined. Have a look – if you just typed the location of the
files from the root for SOURCE files then it shows an invalid message. The following
command line will make it more clear to you.

C:\>Copy E:\Rahul\R1.txt+R2.txt D:\Combined.txt is INVALID!


E:\>Copy Rahul\R1.txt+R2.txt D:\Combined.txt is INVALID!

Ren Command
This command is use to Rename a file. Command syntax will be –
C:\>Command <Location><Old filename.ext> <New filename.ext>

C:\>Ren E:\Bag\Old.txt Bigbang.txt will rename the file named Old.txt which is
Or E:\Bag>Ren Old.txt Bigbang.txt inside a directory named Bag of ‘E’ drive to
A new filename named Bigbang.txt

Move Command
This command is use to move files from one location to another location. Command syntax
will be –
C:\>Command <Source Location> <Target Location>

C:\>Move E:\Bag\*.txt F:\Box\


Or E:\Bag>Move *.txt F:\Box\
The above command line will move all the files having extension .txt from a directory named
bag of ‘E’ drive to a directory named Box of ‘F’ drive.

C:\>Move E:\Bag\Old.txt F:\Box\


Or E:\Bag>Move Old.txt F:\Box\
The above command will move a file named Old.txt from a directory named Bag of ‘E’ drive
to a directory named Box of ‘F’ drive

Created by Rahul Mandal -6-

Das könnte Ihnen auch gefallen