Beruflich Dokumente
Kultur Dokumente
Batch processing.............................................................................13
How to create a filename.........................................................13
The Autoexec.bat file..............................................................13
Introduction to DOS.........................................................................2 How to create an Autoexec.bat file.........................................14
Command..........................................................................................3
Attrib [E]...................................................................................3
Chdir (cd) [I].............................................................................3
Cls [I]........................................................................................4
Copy [I].....................................................................................4
Date [I]......................................................................................4
Del [I]........................................................................................4
Deltree [E].................................................................................4
Dir [I]........................................................................................4
Diskcomp [E]............................................................................5
Diskcopy [E].............................................................................5
Exit [I].......................................................................................5
Find[E]......................................................................................5
Format [E].................................................................................5
Label [E]....................................................................................6
Mem [E]....................................................................................6
Mkdir (md) [I]...........................................................................6
More [I].....................................................................................6
Path [I].......................................................................................6
Prompt [I]..................................................................................6
Ren [I].......................................................................................8
Rmdir (rd) [I].............................................................................8
Sort [I].......................................................................................8
Start [E].....................................................................................8
Sys [E].......................................................................................8
Time [I].....................................................................................8
Type [I]......................................................................................9
Ver [I]........................................................................................9
Vol [I]........................................................................................9
Xcopy [E]..................................................................................9
Attrib +r +s +a +h report.txt
Attrib +h book/s
Or
Attrib nmsag.txt +r +s +a +h
Attrib book/s -h
Where /s lets you give attribute to all the
sub-directories and files.
To clear the attribute
Attrib –h –s –a –r nmsag.txt
Example:
C:\cd home
Where home is a directory name.
National Microsystems) Ltdtd. 3
C:\home>cd\ (or cd..)
Here cd\ is use to exit to the root directory. Directorie file
4
MsDOS 8/12/2009
Example: Where exit command is use to exit to
st
Example: 1 example will list all files of working the windows in windows 95 or above version.
directory. 2nd example will display all files of
nmsag directory. 3rd directory will display if there Exit
is the given files or not where bag is a file name
Dir Find[E]
Dir nmsag Syntax:
Dir bag Find[/v][/c][/n] “string”
[[drive:]\[directory]\(filename)]
Diskcomp [E] Where: string is a group of characters you
want to search for.
Syntax:
Diskcomp [drive1:] [drive 2:] Description: The find command looks for
Where drive1 is the source drive. Drive w2 string(Text) in one or more files. After searching
is the target drive. the specified files, find displays any lines it has
found that contain the specified string.
Description: Diskcomp compares the contents
of the disk in the source drive to the disk in the The find command takes following switches:
target drive. It performs a track by track /V Displays all lines NOT containing the
comparison of the disks. It automatically specified string.
determines the number of sides and sectors per /C Displays only the count of lines containing
track based on the format of the source disk. the string.
/N Displays line numbers with the displayed
Example: This example compares the disk in a: lines.
with another disk in a: which it will ask to you. /I Ignores the case of characters when
Diskcomp A: B: searching for the string.
Where B: drive will also indicate drive A:
Example: The following command displays all
Diskcopy [E] lines from file pencil.ad that contain the string
Syntax: “Pencil Sharpener”:
Diskcopy [drive1:] [drive2] Find “pencil sharpener” pencil.ad
Where drive1 is the source drive. Drive2 is the
target drive.
Format [E]
Description: This command copies the contents Syntax:
of the floppy disk in the source drive to a Format [drive:]
formatted or unformatted floppy disk in the target Description: The format command creates the
drive. The size of the disk should be same. directory and the file allocation tables on a disk.
You can use this command when you have doubt
Example: This example copies all files and that your disk has some error.
directories of drive A: to drive B:
Diskcopy A: B: Example:
Format a:
The format command accepts the following
Exit [I] switches
Syntax: /q This switch helps you to do format quickly
Exit /s Transfer the system files (This switch is
available only up to windows 98 version.)
Description: It is used to exit to previous
windows or application from where MS-DOS Warning:
started in Shell mode. Do not use this command to hard disk
drive i.e. c:\>format c: or d:\format d:
it will cause your data lose.
National Microsystems) Ltdtd. 5
Formatting destroys any previously displays one screen of information at a time.
existing data on a disk and it ignores drive More is commonly used to view long files.
assignments created with the assign command. Example: you may use the dir command, the
sort command, or a filename as a source. The
Label [E] more command then pauses and displays the –
Syntax: More—message at the bottom of your screen.
Label [drive:][label] Press any key to display another screen of
Where label is the new volume label, up to information. Then, keep pressing the key until
11 characters. you have read all the data.
Ren [drive][path]\(source filename) [drive]\[path]\(Target Example: the following command reads the
filename) file expenses.txt, sorts it in reverse order,
and displays it on your screen:
Description: The ren command renames all files
Sort/r<expenses.txt
matching source file. However, because you
cannot rename files across disk drives, the en
command ignores any drive name that you Start [E]
specify with new filename. Syntax: Start <filename>
Example: In example 1st new name “ram” is Description: This command is use to open
given to the existing file raj. In 2nd example new windows base file from windows.
name “nmsit” is given to the file nms which is in Example: This example will open the nms.doc
the directory nmsag in c: file from windows directly.
Ren raj ram Start nms.doc
Ren c:\nmsag\nm s nmsit
Ren *.txt *.doc
Sys [E]
Rmdir (rd) [I] Syntax:
Syntax: Sys drive:
Rd [drive:] \ path
Description: The sys command transfers MS-
Description: Rmdir removes an empty directory. DOS system files from the disk in the default
Before you remove the directory you most delete drive to the disk in the specified drive. You must
all files and sub-directories of it. type a drive letter following the sys command. It
will copy io.sys, command.com and msdos.sys
Example: Where hari is an empty directory. files
Rd hari Example: example 1st transfer system files to
drive a: and example 2nd transfer the system to
Sort [I] drive c:
Sys A:
Syntax:
Sys C:
[source]|sort[/r][/+n]
or Note: We use this command when your computer
sort[/r][/+n]<source doesn’t boot and ask for system disk.
where source is a filename or
command. Time [I]
Syntax:
Description: The sort command is a filter Time [hours: minutes[seconds[.hundredths]]]
program that lets you alphabetize a file
accordant to the character in a certain Description: this command allows you to enter
column. or change the time known to the system. MS-
DOS keeps track of time in a 24 hour format, and
8
MsDOS 8/12/2009
uses the time information to update directory /e copies the empty directory
whenever you create or change a file. /s copies the sub-directories also
Example: To set a new time /v copies and verify that the directory is
Time 12:05:00 correctly copied or not
Save
This command is used to save the working
file. If you want to choose other location choose
directory otherwise give filename and press
enter. The dialog box is given in the next page.
Save as
This command is used save the working
file in other location or other name which is
already been saved.
Close
This command is used to close the working
file.
Print
Fig Edit screen This command helps us to print the text
file.
There are different menus in edit command Exit
screen. This command helps use to exit to dos
mode.
File Menu
New
10
MsDOS 8/12/2009
Search Menu:
Find: This command is used to find the text within
the file. The dialog box is given below.
Steps to find the text:
• Give the text to find in filed what space.
• If you want to choose any option given in
the dialog box click to the square bracket
given
• Click to Ok
Access denied
12
MsDOS 8/12/2009
Batch processing
You tried to replace a write- protected, read-only, You may often find yourself repeatedly
or locked file. typing the same sequence of commands to
perform some command task. With MS-DOS you
Bad command or file name can put this command sequence into a special file
that batch file. You don’t need to type the batch
The command cannot find the program you asked file’s extension, even thought all your batch files
it to run. Check to see that you typed the must include the .bat extension in their
command line properly, and that the file or filenames.
command is on the disk or in the command path.
How to create a filename.
Bad or missing Command Interpreter
You can create a batch file by using Edit
MS-DOS cannot find the command.com file on the command by using the copy command, or by
disk; either the file is missing from the root using a word processor that save files as ASCII
directory, or the file is invalid. You also receive text.
this message if command.com has been moved Creating a batch file
from the directory it was originally in when you Suppose, for example, that you want to create a
started MS-DOS. batch fi8le to format and check a new disk. To do
Either restarts the system with a disk that this, you simply furrow the steps:
contains thecommand.com file, or copy the 1. First, type the following:
command.com file from your backup MS-DOS Copy con checknew.bat
master disk onto the disk used to start MS-DOS. Press ENTER. This command tells MS-DOS to
copy the information from the console (key
Duplicate file name or file not found board) to the file checknew.bat.
You tried to rename to a filename that already 2. Next, type the following lines, pressing the
exists, or the name you specified could not be enter key after each:
found. Echo This is a file to format
Echo and check new disks.
File not found Echo It is named checknew.bat
MS-DOS could not find that file that you specified, Pause Insert new disk in drive a:
or you tried to rename a file with a name already Format a:/s
in the directory. Scandisk a:
Check to see that you entered the filename 3. After the last line, press control + z and then
correctly. press enter to save the batch file. MS-DOS
Insufficient disk space displays the message “1 file(s) copied” to
This disk is full and does not contain enough show that is created the file.
room to perform the specified operation. 4. Now to execute the file, simply type:
Invalid directory Checknew
The directory you specified either does not exist
or is invalid. Note:
Unable to create directory • You must name each batch file with an
MS-DOS could not create the directory you extension of .bat.
specified. • To execute a batch file, you type only its
Check to see that there is not a name conflict. filename not extension.
You may have a file with the same name, or the • Batch file can contain name of another
disk may be full. batch file.
Write protect error writing drive x:
You tried to write data on a write-protected disk.
If the disk has a write-protect tab on it, you must The Autoexec.bat file.
remove the tab before you can write on the disk
.If the disk doesn’t have a write protect notch. An autoexec.bat file lets you run programs
You cannot write on the disk. automatically when you start MS-DOS. This is
useful when you want to run a specific application
under MS-DOS, and when you want MS-DOS
16