dos practicals

55
PRACTICAL NO: 1 OBJECTIVE: Identify key board, mouse, CPU, disk drives, disks, monitor and printer. IDENTIFY KEY BOARD, MOUSE, CPU, DISK DRIVES, DISKS, MONITOR AND PRINTER: KEY BOARD: In computing, a keyboard is typewriter keyboard, which uses an arrangement of buttons or keys, to act as mechanical levers or electronic switches. A keyboard typically has characters engraved or printed on the keys and each press of a key typically corresponds to a single written symbol. However, to produce some symbols requires pressing and holding several keys simultaneously or in sequence. While most keyboard keys produce letters, numbers or signs (characters), other keys or simultaneous key presses can produce actions or computer commands. In normal usage, the keyboard is used to type text and numbers into a word processor, text editor or other program.

Upload: jehanzaib-chughtaee

Post on 04-Apr-2015

177 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Dos Practicals

PRACTICAL NO: 1

OBJECTIVE:Identify key board, mouse, CPU, disk drives, disks, monitor and printer.

IDENTIFY KEY BOARD, MOUSE, CPU, DISK DRIVES, DISKS, MONITOR AND PRINTER:

KEY BOARD:

In computing, a keyboard is typewriter keyboard, which uses an arrangement of buttons

or keys, to act as mechanical levers or electronic switches.

A keyboard typically has characters engraved or printed on the keys and each press of a

key typically corresponds to a single written symbol. However, to produce some symbols

requires pressing and holding several keys simultaneously or in sequence. While most

keyboard keys produce letters, numbers or signs (characters), other keys or simultaneous

key presses can produce actions or computer commands.

In normal usage, the keyboard is used to type text and numbers into a word

processor, text editor or other program. Keyboards are also used for computer gaming,

either with regular keyboards or by using keyboards with special gaming features, which

can expedite frequently used keystroke combinations. A keyboard is also used to give

commands to the operating system of a computer, such as Windows' Control-Alt-

Delete combination, which brings up a task window or shuts down the machine.

Page 2: Dos Practicals

MOUSE:A device that controls the movement of the cursor or pointer on a display screen. A mouse is a small object you can roll along a hard, flat surface. Its name is derived from its shape, which looks a bit like a mouse, its connecting wire that one can imagine to be the mouse's tail, and the fact that one must make it scurry along a surface. As you move the mouse, the pointer on the display screen moves in the same direction. Mice contain at least one button and sometimes as many as three, which have different functions depending on what program is running. Some newer mice also include a scroll wheel for scrolling through long documents.In particular, the mouse is important for graphical user interfaces because you can simply point to options and objects and click a mouse button. Such applications are often called point-and-click programs. The mouse is also useful for graphics programs that allow you to draw pictures by using the mouse like a pen, pencil, or paintbrush.There are three basic types of mice:

1. Mechanical: Has a rubber or metal ball on its underside that can roll in all directions. Mechanical sensors within the mouse detect the direction the ball is rolling and move the screen pointer accordingly.

2. Optomechanical: Same as a mechanical mouse, but uses optical sensors to detect motion of the ball.

3. Optical: Uses a laser to detect the mouse's movement. You must move the mouse along a special mat with a grid so that the optical mechanism has a frame of reference. Optical mice have no mechanical moving parts. They respond more quickly and precisely than mechanical and optomechanical mice, but they are also more expensive.

Page 3: Dos Practicals

CPU:

Pronounced as separate letters it is the abbreviation for central processing unit (CPU). The CPU is the brains of the computer. Sometimes referred to simply as the central processor, but more commonly called processor, the CPU is where most calculations take place. In terms of computing power, the CPU is the most important element of a computer system. The CPU market is dominated by Intel, AMD, and IBM. These manufacturers supply the computer makers such as Dell, HP, and Apple.

On large machines, CPUs require one or more printed circuit boards. On personal computers and small workstations, the CPU is housed in a single chip called a microprocessor. Modern CPUs are small and square and contain multiple metallic connectors or pins on the underside. The CPU is inserted directly into a CPU socket, pin side down, on the motherboard. Modern CPUs also have an attached heat sink and small fan that go directly on top of the CPU to help dissipate heat.Two typical components of a CPU are the following:

The arithmetic logic unit (ALU), which performs arithmetic and logical operations.

The control unit (CU), which extracts instructions from memory and decodes and executes them, calling on the ALU when necessary.

Page 4: Dos Practicals

DISK DRIVE:

A disk drive is a device that reads and/or writes data to a disk. The most common type of disk drive is a hard drive (or "hard disk drive"), but several other types of disk drives exist as well. Some examples include removable devices, floppy, and optical drives, which read optical media, such as CDs and DVDs.

While there are multiple types of disk drives, they all work in a similar fashion. Each drive operates by spinning a disk and reading data from it using a small component called a drive head. Hard drives and removable disk drives use a magnetic head, while optical drives use a laser. CD and DVD burners include a high-powered laser that can imprint data onto discs.

Since hard drives are now available in such large capacities, there is little need for removable disk drives. Instead of expanding a system's storage capacity with removable media, most people now use external hard drives instead. While CD and DVD drives are still common, they have become less used since software, movies, and music can now often be downloaded from the Internet. Therefore, internal hard drives (housed within the computer) and external hard drives (housed in a separate box that connects to the computer) are the most common types of disk drives used today.

Page 5: Dos Practicals

MONITOR:

The term "monitor" is often used synonymously with "computer screen" or "display." The monitor displays the computer's user interface and open programs, allowing the user to interact with the computer, typically using the keyboard and mouse.

Older computer monitors were built using cathode ray tubes (CRTs), which made them rather heavy and caused them to take up a lot of desk space. Most modern monitors are built using LCD technology and are commonly referred to as flat screen displays. These thin monitors take up much less space than the older CRT displays. This means people with LCD monitors have more desk space to clutter up with stacks of papers, pens, and other objects.

Page 6: Dos Practicals

PRINTER:

In computers, a printer is a device that accepts text and graphic output from a computer and transfers the information to paper, usually to standard size sheets of paper. Printers vary in size, speed, sophistication, and cost. In general, more expensive printers are used for higher-resolution color printing.

Personal computer printers can be distinguished as impact or non-impact printers. Early impact printers worked something like an automatic typewriter, with a key striking an inked impression on paper for each printed character . The dot-matrix printer was a popular low-cost personal computer printer. It's an impact printer that strikes the paper a line at a time. The best-known non-impact printers are the inkjet printer, of which several makes of low-cost color printers are an example, and the laser printer . The inkjet sprays ink from an ink cartridge at very close range to the paper as it rolls by. The laser printer uses a laser beam reflected from a mirror to attract ink (called toner) to selected paper areas as a sheet rolls over a drum.

The four printer qualities of most interest to most users are:

Color: Color quality of the printer. Resolution: Printer resolution (the sharpness of text and images on paper) is

usually measured in dots per inch (dpi ). Speed: Speed of the printer with which it takes out the prints. Memory: Most printers come with a small amount of memory (for example,

one megabyte ) that can be expanded by the user.

Page 7: Dos Practicals

PRACTICAL NO: 2

OBJECTIVE:

Practice for booting up of a computer system with DOS system disk and power off system at DOS prompt.

BOOTING UP COMPUTER WITH DOS DISK:

Booting up computer system with DOS system disk means that you are booting up the computer system through DOS mode. For this purpose you should first insert the bootable disk which has the capability of booting up the computer and for this the DOS system should already be installed in the computer system. When you insert the bootable disk the system starts booting and a message in DOS mode appears as shown below:

Page 8: Dos Practicals

POWER OFF SYSTEM AT DOS PROMPT:

In order to power off the system at DOS prompt you should just simply write “exit” while being in the environment of DOS mode and after that the DOS system turn’s off just as when you turn off your system by plugging off the main switch of the computer system. Image of exiting from DOS mode is shown in figure below:

Page 9: Dos Practicals

PRACTICAL NO: 3

OBJECTIVE:

Practice for CLS, VER, VOL, DATE and TIME commands.

PRACTICE FOR CLS, VER, VOL, DATE AND TIME COMMANDS:

CLS:

Syntax:cls

Purpose:

This is the clear the screen command. All existing text on the screen will be cleared and the prompt placed at the top left hand corner of the screen ready for the next command.

Example:C:\> cls

VER (VERSION)

Syntax:

VER

Purpose:

VER displays the DOS version number for the version of DOS currently active.

Example

To display the currently operating version of DOS, enter

C:\> ver

The program will displayMS-DOS Version (version number)

Page 10: Dos Practicals

VOL (VOLUME)

Syntax: vol [Drive:]

Purpose:Displays the disk volume label and serial number, if they exist. A serial number is displayed for a disk formatted with MS-DOS version 4.0 or later.

Example:

To display the currently operating version of DOS, enter

C:\> vol

The program will displayVolume in C drive has no label.

Volume Serial Number is 3R62-BD15

DATE

Syntax:

Displays or sets the date.

DATE [/T | date]

Parameters:

Type DATE without parameters to display the current date setting anda prompt for a new one. Press ENTER to keep the same date.

If Command Extensions are enabled the DATE command supportsthe /T switch which tells the command to just output thecurrent date, without prompting for a new date.

Example:

C:\Date

Page 11: Dos Practicals

TIME

Syntax:

TIMETIME hh:mm[:ss][.cc][A|P]

Purpose:

Displays current time setting of system clock and provides a way for you to reset the time. You can also enter the time at the same time you enter the time command. Either way, you must enter the time in the following format:

hh:mm:ss.cc

where hh is a one or two digit hours designation, mm is a one or two digit designation of minutes after the hour, ss is a one or two digit designation of seconds after the minute, and cc is a one or two digit designation of the hundredths of a second past the second. The following numbers are allowed:

hh 0-23 for hours mm 0-59 for minutes ss 0-59 for seconds cc 0-99 for hundredths of secondsA|P A.M. or P.M. (default is A.M.)

Only the hour setting and the minute setting are required. The following are allowable settings:

04:234:0311:5:0917:59:02.222:3:2.9

Example:

C:\> time

12:00

Set the time to 12:00

Page 12: Dos Practicals

PRACTICAL NO: 4

OBJECTIVE:

Practice for COPY, REN commands.

PRACTICE FOR COPY, REN COMMANDS:

COPY - COPIES A FILE OR A GROUP OF FILES

Syntax: COPY DRIVE1:\PATH1\ FILE1(S) DRIVE2:\PATH2\ FILE2(S)

Purpose:The COPY command enables you to make copies of files. It may be used to make a copy within a particular directory, to copy from one directory to another and to copy from one disk to another. You can use the command to copy one file by using its filename, or several files by using the DOS wildcard characters * and/or?

Example 1:Copy one file from drive C to drive A

COPY C:\HELLO.BAT A:

Example 2:Make a copy of a file within the same directory. You have to give the copy a different name. e.g. GREETING.BAT

COPY A:\HELLO.BAT A:\GREETING.BAT

Example 3:Copy all the files in the root of A to a directory on the hard drive

COPY A:\*.* C:\DOCS

Now use the DIR command to list the files on drive A again.

Page 13: Dos Practicals

RENAME OR REN - RENAMES FILES

Command Syntax:REN DRIVE: \PATH\ FILE1 FILE2

Or

REN {oldname} {newname} {ENTER}

Purpose:

The RENAME or REN command is used to rename a file or a group of files. The file contents and the location of the renamed files remains the same.

Example 1:Rename a single file

REN C:\HELLO.BAT MESSAGE.BAT

Example 2:Rename a group of files to have a common file extension

REN A:\TEMP-DIR\*.BAT *.BAK

Page 14: Dos Practicals

PRACTICAL NO: 5

OBJECTIVE:

Practice for DEL, TYPE, PATH, PROMPT, COPY CON, MD, CD, RD commands.

PRACTICE FOR DEL, TYPE, PATH, PROMPT, COPY CON, MD, CD, RD COMMANDS.

DEL OR ERASE - DELETES A FILE OR A GROUP OF FILES

Syntax:DEL DRIVE: \PATH\FILE(S) /P

Purpose:The DEL or ERASE commands perform the same operation; you can use either.The P switch causes DOS to prompt the user with the name of the file to be deleted, to confirm that this is really his intention, before actually carrying out the deletion.If the P switch is omitted then the deletion is carried out silently.

Example 1:Prompt the user with the name of each file in the current directory that has the extension .BAK, and ask him to confirm whether it should be deleted

DEL *.BAK /P

Example 2:Delete the file HELLO.BAT from the DOCS directory

DEL C:\DOCS\HELLO.BAT

Example 3:Delete all files in the root of A

DEL A:\*.*

Whenever the wildcard character is used in this manner, the user is always reminded that all files in the directory will be deleted, and asked to confirm Yes or No.

Page 15: Dos Practicals

WARNING

NEVER delete the file COMMAND.COM file since it is the file which enables DOS commands to run.

Be very careful when using wildcard characters with the DEL/ERASE command, as you will not be asked to confirm the deletion of individual files when using it (unless you use the /P switch) and so may delete a file which you really need to keep. You should always use DIR to list the contents of the directory before you start deleting using wildcards, to see exactly what files will be affected.

TYPE

Syntax:

TYPE [d:][path]filename

Purpose: Displays the contents of a file. When you use the TYPE command, the file is displayed with limited on-screen formatting. Tabs are expanded and generally displayed as eight spaces wide. If you display files that contain special (non-text) characters, these characters may have unpredictable effects on your display. Wild card characters (? and *) cannot be used with this command in either the filename or the extension.

Example:

To display the contents of the file LETTER3.TXT on drive B, enter

C:\>type b:letter3.txt

PATH

Syntax:

PATH;PATH [d:]path[;][d:]path[...]

Purpose: Sets or displays directories that will be searched for programs not in the current directory. PATH tells DOS which directories should be searched for external commands after DOS searches your working directory. DOS searches the paths in the order specified in the PATH command.

Page 16: Dos Practicals

If you enter the PATH command without options , the program will display the currently set path designations.

Examples:

To tell DOS to search for external DOS commands and other executable programs in the PROGRAM directory that is within the root directory on drive C, enter

path c:\program

You can tell DOS to search more than one path by specifying several pathnames separated by semicolons. For example:

path \program;\files\sales;\data2

To reset the path designation so that DOS will search only the current directory, enter

path ;

PROMPT

Syntax:

PROMPT [prompt text][options ]

Purpose: Changes the DOS command prompt. You can change the DOS prompt (the indicator that DOS is ready for input) to almost any type of special prompt you want. For example, you can use this command to make the prompt display the current time, the date, or the current directory. You can also use combinations of the special prompt characters to create custom prompts.

Examples:

To change the prompt to display the current drive and directory and a greater-than symbol, enter

prompt $p$g

You can also create more complicated prompts. For example, to use the same prompt as above, with two added spaces and the characters TIME= followed by a display of the current time, enter

Page 17: Dos Practicals

prompt $p$g TIME=$t

The resulting prompt (if you are working in the DOS directory on drive C) will look like this:

C:\DOS> TIME=11:07:54.23

COPY CON

Purpose:An internal command for creating a quick batch files in DOS or Windows.

Example: to create the WRITE batch file, type:

copy con write.bat

After pressing Enter, you'll get a blank line. Type your text and press Enter to end the line. When done, press F6 (ctrl-Z), then press Enter.

Copy Con works a line at a time. You cannot go back and change lines, but you can use backspace to delete characters on the same line.

MD OR MKDIR - CREATES A DIRECTORY

Syntax:MD DRIVE: \PATH\DIRECTORY

Purpose:The MD or MKDIR command is used to create subdirectories in the root directory or other subdirectories.

Example 1:Create a subdirectory named DOCS in the root directory of C

MD C:\DOCS

Example 2:Create a subdirectory of the DOCS subdirectory called WORK

Page 18: Dos Practicals

MD C:\DOCS\WORK

Example 3:Create a subdirectory of WORK called TEMP

MD C:\DOCS\WORK\TEMP

Example 4:If you were already in the WORK directory (see next section re changing directory) the following would be sufficient to create the TEMP subdirectory

MD TEMP

CD OR CHDIR - CHANGES DIRECTORY

Syntax:CD DRIVE: \PATH Or CD

Purpose:The CD or CHDIR command is used to move from one directory to another; or to show the current directory path (i.e. the hierarchy of directories from the root directory to the one you are currently working in). The directory you are currently in is known as the current or default directory. When you move to another directory it becomes the current directory. Once your system has booted your initial current directory will normally be the root.

DOS uses the following ‘special’ characters to reference particular directories within the directory structure and these can also be used with the CD command.

\ - the Root Directory. - the Current Directory.. - the Parent Directory of the current directory

Example 1:Move to the subdirectory TEMP (assuming it exists)

CD C:\DOCS\WORK\TEMP

Example 2:Display the path to the current directory (i.e. Current Directory Path)

Page 19: Dos Practicals

CD

Example 3:Move to the parent directory of the current directory

CD ...

Example 4:Move back to the subdirectory TEMP (this example assumes you are currently in subdirectory WORK; use example 2 to check before moving)

CD TEMP

Example 5:Move to the root directory. (This will make the root the current directory)

CD \

RD OR RMDIR - REMOVES A DIRECTORY

Syntax:

RDDRIVE: \PATH\DIRECTORY

Purpose:RMDIR or RD is used to remove a directory. This command will only work if the directory concerned is empty.

Example:Remove the empty subdirectory of C:\DOCS\WORK called TEMP

RD C:\DOCS\WORK\TEMP

Page 20: Dos Practicals

PRACTICAL NO: 6

OBJECTIVE:

Practice of the practical’s at S. No. 3, 4, 5.

PRACTICE OF THE PRACTICAL’S AT S. NO. 3, 4, 5:

CLS:C:\> cls

VER:C:\> ver

VOL:C:\> vol

DATE:C:\Date

TIME:C:\> time

COPY:

Copy one file from drive C to drive A

COPY C:\HELLO.BAT A:

REN:Rename a single file

REN C:\HELLO.BAT MESSAGE.BAT

DEL:Delete the file HELLO.BAT from the DOCS directory

DEL C:\DOCS\HELLO.BAT

TYPE:

Page 21: Dos Practicals

To display the contents of the file LETTER3.TXT on drive B, enter

C:\>type b:letter3.txt

PATH:To tell DOS to search for external DOS commands and other executable programs in the PROGRAM directory that is within the root directory on drive C, enter

C:\>path c:\program

PROMPT:To change the prompt to display the current drive and directory and a greater-than symbol, enter

C:\>prompt $p$g

COOY CON:to create the WRITE batch file, type:

copy con write.bat

MD:Create a subdirectory named DOCS in the root directory of C

MD C:\DOCS

CD:Move to the subdirectory TEMP (assuming it exists)

CD C:\DOCS\WORK\TEMP

RD:Remove the empty subdirectory of C:\DOCS\WORK called TEMP

RDC:\DOCS\WORK\TEMP

PRACTICAL NO: 7

Page 22: Dos Practicals

PRACTICAL NO: 7

OBJECTIVE:

Practice for FORMAT commands with /s,/4,/u switches.

PRACTICE FOR FORMAT COMMANDS WITH /S, /4, /U SWITCHES.

FORMAT - FORMATS A DISK

Syntax:

FORMAT DRIVE /SWITCHES

Where SWITCHES are

S - Create a DOS system/boot disk - i.e. Format the disk and automatically install the DOS system files (IO.SYS,

MSDOS.SYS and COMMAND.COM) on it

F:x - where x is the floppy disk size i.e. one of 160, 180, 320, 360, 720, 1.2, 1.44, 2.88

The F switch is most commonly needed if formatting a DD (Double Density) disk in a HD (High Density) drive. Specifically, formatting a 3.5” 720 KB disk in a 3.5” 1.44 MB drive, e.g.

FORMAT A: /F:720

If you use the FORMAT command without switches on a 3.5” disk in a HD (1.44 MB) drive, DOS will attempt to format that disk to 1.44 MB even if it is a DD disk. This will result in a disk which is unreadable on DD drive machines. By using the F:720 switch the disk will be readable on both types of machine.

Other SWITCHES

T:t - where t is the number of tracks per disk sideN:s - where s is the number of sectors per track

Together these provide an alternative to the F:x switch for specifying the size of the disk being formatted, e.g.

Page 23: Dos Practicals

FORMAT A: /T:80 /N:9

can be used to perform the same format as using F:720 above.

Remember - a machine with a HD drive can read and format both HD and DD disks.a machine with a DD drive can read and format only DD disks.

Purpose:A disk must be formatted for a particular operating system before it can be read from or written to by that operating system. DOS formatting creates a new root directory and file allocation table on the disk, it also destroys anything already on the disk. Therefore do not format a disk until you are sure there is nothing on the disk that you want to preserve.

You will not normally need to format a disk a second time (i.e. after your initial format of a blank disk). If you do reformat a disk, all existing data on it will be destroyed.

Example:

Examples using the FORMAT command -

Example 1: Format a HD floppy disk in a HD drive

FORMAT A:

Example 2: Format a disk as a DOS System disk

FORMAT A: /S

Example 3: Format a 3.5” DD 720 KB disk in a 3.5” HD 1.44 MB drive

FORMAT A: /F:720/T:80 /N:9

When the FORMAT operation is complete, the system will ask if you wish to FORMAT more diskettes. It will show the following message:

Format another (Y/N)?If you are working with only one diskette, answer N (No) and carry on with you work. If you wish to FORMAT several diskettes, answer Y (Yes) until you have finished formatting all your diskettes.

Page 24: Dos Practicals

PRACTICAL NO: 8

OBJECTIVE:

Practice for DISCOPY, DISKCOMP commands.

PRACTICE FOR DISCOPY, DISKCOMP COMMANDS:

Syntax:DISKCOPY [d:] [d:] [/1] [/V] [/M]

Where/1 - Copies only the first side of the diskette, even if the target diskette is double sided./V - Verifies that the source data was copied correctly onto the destination drive. Selecting this option will slow down the copying process./M - Forces DISKCOPY to use only conventional memory for interim storage during the copy procedure.

OR

DISKCOPY DRIVE1: DRIVE2: (Source disk) (Destination disk)

Purpose:

Makes an exact copy of a diskette. This command is used only for copying diskettes, not hard disks.

The first drive you specify is the drive for the source diskette. The second is the drive for the target diskette. DISKCOPY checks to determine if the disk in the target drive has been previously formatted. If not, DISKCOPY will format it before it starts the copy (except in early versions of DOS).

If the target drive is the same as the source drive (or if you do not enter a drive designator), the copying will be done using one drive. The program will prompt you when to insert each diskette.

Example:

Let's use DISKCOPY!  From your C drive MS-DOS Prompt, do this:

Page 25: Dos Practicals

1.     DISKCOPY A: A:  {ENTER} 

2. When this message appears:                Insert SOURCE diskette in drive A:                Press any key when ready...Insert the source diskette and press any key when ready!

3. When this message appears:                Insert TARGET diskette in drive A:                Press any key when ready...

Remove the SOURCE diskette and insert the TARGET diskette into drive A: and press any key again.

4. When copying is complete this prompt appears:                Copy another diskette (Y/N)?

Type Y (for yes) to copy another diskette, N (for no) to exit from the DISKCOPYcommand.

DISKCOMP

Syntax:

DISKCOMP [d:] [d:][/1][/8]

Where/1 - Causes only the first side of the disk to be compared (even if the disk is double-sided).

/8 - Causes only 8 sectors per track to be compared (even if the disk contains a different number of sectors per track).

Purpose:

DISKCOMP compares two disks, track by track, and displays the numbers of tracks that are not identical.

If you enter only one drive designation, DISKCOMP compares with the disk in the currently active drive.

If you enter one drive designation that is the same as the current drive (or if you don`t

Page 26: Dos Practicals

enter a drive), the comparison will take place on one drive. DISKCOMP will prompt you when it is time to insert each disk to be compared.

Disks copied using the DISKCOPY command should be reported to be identical when checked using this command; however, disks copied using the COPY command may not be identical since DOS may not copy files to the same locations on the disk.

Example:C :\> DISKCOMP X: Z/1It will compare the side of X: with that of B:

If differences are found on a track, the program will display an explanatory message. For example, if track eight on side one are not the same, DOS will display

Compare error(s) on track 8, side 1

Page 27: Dos Practicals

PRACTICAL NO: 9

OBJECTIVE:Practice FOR SCANDISK, XCOPY, DELTREE, TREE, LABEL commands.

PRACTICE FOR SCANDISK, XCOPY, DELTREE, TREE, LABEL COMMANDS:

SCANDISK

Syntax:

SCANDISKSCANDISK [d: [d: . . .]|/all][/checkonly|/autofix[/nosave]|/custom][/surface][/mono][/nosummary]SCANDISK volume-name[/checkonly|/autofix[/nosave]|/custom][/mono][/nosummary]SCANDISK /fragment [d:][path]filenameSCANDISK /undo [undo-d:][/mono]

Parameters:

/all - Used to check and repair all local drives.

/autofix - This option will fix any errors it encounters without prompting you first. By default, when you use the /AUTOFIX option, ScanDisk will save any lost clusters it finds as files in the drive`s root directory. If you want ScanDisk to delete lost clusters instead of saving them, include the /NOSAVE option. Using the /AUTOFIX option, ScanDisk will also prompt you for an Undo disk unless you include the /NOSUMMARY option. The /AUTOFIX command can be used in conjunction with the /CHECKONLY and /CUSTOM options.

/checkonly - Use this option if you want to check a drive for errors without repairing the damage. You cannot use this switch with the /AUTOFIX or /CUSTOM options .

/custom - Use this option if you want to run ScanDisk using the configuration settings in the Custom section of the SCANDISK.INI file. This is useful for running ScanDisk from a ba Also prevents u cannot use this option in conjunction with the /AUTOFIX and /CHECKONLY options.

Page 28: Dos Practicals

/mono - Use this osurface scan after checking other areas of a drive. During a surface scan of an unSPLAY=MONO line in your SCANDISK.INI file if can be realiably written and read from the drive being scanned. During a surface scan of a DoubleSpace drive, ScanDisk confirms that data can be decompressed. It is a good idea to periodically do a surface scan of all drives.

Purpose:

Starts the Microsoft Scan Disk program which is a disk analysis and repair tool used to check a drive for errors and correct any problems that it finds (new with DOS Version 6.2).

The ScanDisk program checks and fixes the problems in the following areas:

File allocation table (FAT)File system structure (lost clusters, crosslinked files)Directory tree structurePhysical surface of the drive (bad clusters)DoubleSpace volume header (MDBPB)DoubleSpace volume file structure (MDFAT)DoubleSpace compression structureDoubleSpace volume signaturesMS-DOS boot sector

ScanDisk can be used to check for errors on the following types of drives:

Hard drivesDoubleSpace drivesFloppy disk drivesRAM drivesMemory cards

The ScanDisk program cannot be used with CD-ROM drives, network drives, drives

Examples:

If you want to check and fix the current drive, enter

scandiskTo check all your drives, enter

scandisk /allThis will check all your hard disk partitions, as well as all mounted DoubleSpace drives.

h drive. Also prevents ScanDisk from prompting you for an Undo disk if it finds errors.

Page 29: Dos Practicals

/surface - Automatically performs a surface scan after checking other areas of a drive. During a surface scan of an uncompressed drive, SCANDISK confirms that data can be realiably written and read from the drive being scanned. During a surface scan of a DoubleSpace drive, ScanDisk confirms that data can be decompressed. It is a good idea to periodically do a surface scan of all drives.

XCOPY

Xcopy Copies files and directories, including subdirectories.

Syntax:xcopy Source [Destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d[:mm-dd-yyyy]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a|/m}] [/n] [/o] [/x] [/exclude:file1[+[file2]][+[file3]] [{/y|/-y}] [/z]

Parameters:

Source Specifies the location and names of the files you want to copy. This parameter must include either a drive or a path. Destination Specifies the destination of the files you want to copy. This parameter can include a drive letter and colon, a directory name, a file name, or a combination of these. /w Displays the following message and waits for your response before starting to copy files: Press any key to begin copying file(s)

/p Prompts you to confirm whether you want to create each destination file. /c Ignores errors. /v Verifies each file as it is written to the destination file to make sure that the destination files are identical to the source files. /q Suppresses the display of xcopy messages. /f Displays source and destination file names while copying. /l Displays a list of files that are to be copied. /g Creates decrypted destination files. /d[:mm-dd-yyyy] Copies source files changed on or after the specified date only. If you do not include a mm-dd-yyyy value, xcopy copies all Source files that are newer than existing Destination

Page 30: Dos Practicals

files. This command-line option allows you to update files that have changed. /u Copies files from Source that exist on Destination only. /i If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory. /s Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory. /e Copies all subdirectories, even if they are empty. Use /e with the /s and /t command-line options. /t Copies the subdirectory structure (that is, the tree) only, not files. To copy empty directories, you must include the /e command-line option. /k Copies files and retains the read-only attribute on destination files if present on the source files. By default, xcopy removes the read-only attribute. /r Copies read-only files. /h Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files. /a Copies only source files that have their archive file attributes set. /a does not modify the archive file attribute of the source file. For information about how to set the archive file attribute by using attrib, see Related Topics. /m Copies source files that have their archive file attributes set. Unlike /a, /m turns off archive file attributes in the files that are specified in the source. For information about how to set the archive file attribute by using attrib, see Related Topics. /n Creates copies by using the NTFS short file or directory names. /n is required when you copy files or directories from an NTFS volume to a FAT volume or when the FAT file system naming convention (that is, 8.3 characters) is required on the destination file system. The destination file system can be FAT or NTFS. /o Copies file ownership and discretionary access control list (DACL) information. /x Copies file audit settings and system access control list (SACL) information (implies /o). /exclude:filename1[+[filename2]][+[filename3]] Specifies a list of files containing strings. /y Suppresses prompting to confirm that you want to overwrite an existing destination file.

Page 31: Dos Practicals

/-y Prompts to confirm that you want to overwrite an existing destination file. /z Copies over a network in restartable mode. /? Displays help at the command prompt.

RemarksUsing /v Windows XP does not use this command. It is accepted only for compatibility with MS-DOS files.

Using /exclude List each string in a separate line in each file. If any of the listed strings match any part of the absolute path of the file to be copied, that file is then excluded from the copying process. For example, if you specify the string "\Obj\", you exclude all files underneath the Obj directory. If you specify the string ".obj", you exclude all files with the .obj extension.

Using /z If you lose your connection during the copy phase (for example, if the server going offline severs the connection), it resumes after you reestablish the connection. /z also displays the percentage of the copy operation completed for each file.

Using /y in the COPYCMD environment variable You can use /y in the COPYCMD environment variable. You can override this command by using /-y on the command line. By default, you are prompted to overwrite, unless you run copy from within a batch script.

Copying encrypted files Copying encrypted files to a volume that does not support EFS results in an error. Decrypt the files first or copy the files to a volume that does support EFS.

Appending files To append files, specify a single file for destination, but multiple files for source (that is, by using wildcards or file1+file2+file3 format).

Examples: To copy all the files and subdirectories (including any empty subdirectories) from drive A to drive B, type:

xcopy a: b: /s /e

To include any system or hidden files in the previous example, add the/h command-line option as follows:

Page 32: Dos Practicals

xcopy a: b: /s /e /h

To update files in the \Reports directory with the files in the \Rawdata directory that have changed since December 29, 1993, type:

xcopy \rawdata \reports /d:12-29-1993

To update all the files that exist in \Reports in the previous example, regardless of date, type:

xcopy \rawdata \reports /u

To obtain a list of the files to be copied by the previous command (that is, without actually copying the files), type:

xcopy \rawdata \reports /d:12-29-1993 /l > xcopy.out

The file Xcopy.out lists every file that is to be copied.

To copy the \Customer directory and all subdirectories to the directory \\Public\Address on network drive H:, retain the read-only attribute, and be prompted when a new file is created on H:, type:

xcopy \customer h:\public\address /s /e /k /p

DELTREE

Syntax:

DELTREE [/Y] [d:]path [d:]path[...]

Parameters: /Y - Carries out the DELTREE command without providing a prompt to confirm the deletion.

Purpose:

Deletes (erases) a directory including all files and subdirectories that are in it (new with DOS Version 6).

Unlike the RMDIR command, the DELTREE command allows you to delete a directory even if it contains files and subdirectories. All files and subdirectories subordinate to the

Page 33: Dos Practicals

directory you are deleting will also be deleted regardless of any attributes. This means that even if a file has hidden, system, read-only, or other attributes, it will still be deleted. You can specify more than one directory for deletion.

Examples: To delete the directory LETTERS including all files and subdirectories containedin it, enter

DELTREE c:\letters

TREE - DISPLAYS THE DIRECTORY STRUCTURE

Syntax:TREE DRIVE:\PATH /SWITCH

Where SWITCH is

F - Display the names of files in each directory

Purpose:The TREE command enables the user to obtain a graphical view of the structure of directories and subdirectories on a disk.

Example 1:Display the structure of the DOCS directory

TREE C:\DOCS

Example 2:Display the directory structure and files of C

TREE C: /F

LABEL

Syntax: label [Drive:][label]

label [/MP][volume][label]

Parameters:Drive: Specifies the drive letter (followed by a colon) of the disk you want to name.

Page 34: Dos Practicals

label Specifies the name for the volume. /MP Specifies that the volume should be treated as a mount point or volume name. volume Specifies the drive letter (followed by a colon), mount point, or volume name. If a volume name is specified, the /MP parameter is unnecessary. /? Displays help at the command prompt.

Purpose:

Label Creates, changes, or deletes the volume label (that is, the name) of a disk. Used without parameters, label changes the current volume label or deletes the existing label..

Label command messages If you do not specify a label when you use the label command, label displays a message in the following format:Volume in drive A is xxxxxxxxxxx Volume Serial Number is xxxx-xxxx Volume label (11 characters, ENTER for none)?

The "Volume Serial Number" part of the message is not displayed if the disk has no serial number.

You can type the volume label you want or press ENTER to delete the current label. If a disk has a label and you press ENTER for none, label prompts you with the following message:

Delete current volume label (Y/N)?

Press Y to delete the label; press N to keep the label.

Limitations on volume label names A volume label can contain as many as 32 characters for NTFS volumes and as many as 11 characters for FAT volumes and can include spaces but no tabs.

FAT volume labels cannot contain any of the following characters:

* ? / \ | . , ; : + = [ ] < > "

This limitation does not apply to NTFS volumes.

For FAT volumes, volume labels are stored as uppercase regardless of whether they contain lowercase letters. NTFS volume labels retain and display the case used when the label was created.

Examples:To label a disk in drive A that contains sales information for July, type:

label a:sales-july

Page 35: Dos Practicals

PRACTICAL NO: 10

OBJECTIVE:Practice for PRINT, UNDELETE commands.

PRACTICE FOR PRINT, UNDELETE COMMANDS:

PRINT

Syntax:

PRINT [/B:(buffersize)] [/D:(device)] [/M:(maxtick)] [/Q:(value] [/S:(timeslice)] [/U:(busytick)] [/C][/P][/T] [d:][path][filename] [...]

Parameters:

/C - Provides a way to select which files to cancel. A filename already in the print queue that precedes this option will be suspended. Names of files (already in the print queue) that follow this option will be canceled. You can also list more files to print as part of the same PRINT command by entering the /P option followed by the filenames to print.

/P - Sets the print mode. The preceding filename and all following filenames will be added to the print queue. You can also list files to cancel as part of the same PRINT command by entering the /C option followed by the filenames to cancel.

/T - Deletes all files in the print queue (those waiting to be printed). After the print files are canceled, the program displays a cancellation message. If a file is being printed as the PRINT command is used with this option, the printing will stop immediately.

The following options are allowed only the first time you run the PRINT command:

/D (device) - Specifies the print device. If not specified, PRINT will prompt you to enter the name of a print device. The default is PRN.

/B (buffersize) - This parameter sets the size (in bytes) of the amount of memory used by the PRINT buffer. Increasing this value speeds up the operation of the PRINT command. If you do not use the /B option, the PRINT buffer will be set to 512 bytes.

/M (maxtick) - Specifies how many computer clock ticks PRINT can have to print a file. The value of /M can be from 1 to 255. If you do not use the /M option, this parameter will be set to 2.

Page 36: Dos Practicals

/Q (value) - Specifies the maximum number of files that are allowed in the print queue (from 4 to 32). If you do not use the /Q option, this parameter will be set to 8.

/S (timeslice) - Specifies the time slice (the interval of time used by DOS to schedule PRINT jobs). If you do not use the /S option, this parameter will be set to 8.

/U (busytick) - Specifies the number of computer clock ticks that DOS will wait for a printer that is not available. If the wait is longer than this value, DOS gives up its time slice (refer to option /S above). If you do not use the /U option, this parameter will be set to 1.

Purpose:

Using the PRINT command, you can set up one or more files to print and continue to use other programs (often referred to as background printing).

If you use the PRINT command without entering any options , the current contents of the print queue is displayed. This does not change the status of the files currently in the PRINT queue. If you do not enter any of the forward slash options (/), the /P option is assumed.

The first time you use the PRINT command, the following prompt appears (unless you specify the /D parameter):

Name of list device [PRN:]

Whatever device you enter becomes the PRINT output device. Press the Enter key to accept the default (PRN).

During use of the PRINT command, one or more messages may be displayed. Each message and its meaning are summarized below.

Message: List output is not assigned to a device

Meaning: The name of the printer you specified was not valid.

Message: PRINT queue is full

Meaning: You attempted to enter more than 10 files in the PRINT queue.

Message: PRINT queue is empty

Meaning: There are no files in the print queue.

Message: No files match d:(filename)

Page 37: Dos Practicals

Meaning: No files match the filename specification you entered.

Message: All files canceled by operator

Meaning: You entered the /T (terminate) option to cancel all the files currently in the PRINT queue.

Message: File canceled by operator

Meaning: You entered the /C (cancel) option to cancel the file currently in the PRINT queue.

Example: to print the file letter.txt, type

C :\> PRINT C:\LETTER.TXT

To stop printing and cancel the print queue, enter

print /t

To remove the files LETTER.TXT, START.EXE, and RATE.COM (all on drive B) from the PRINT queue, enter

print b:letter.txt/c b:start.exe b:rate.com

To remove the file SALES.DOC from the PRINT queue and, at the same time, add the files OLDSALE.DOC and NEWSALE.DOC, enter

print sales.doc/c oldsale.doc/p newsale.doc

UNDELETE

Syntax:

UNDELETE [d:][path][filename] [/DT|/DS|/DOS]UNDELETE [/list|/all|/purge[d:]|/status|/load|/U|/S[d:]|/Td:[-entries]]

Purpose: It is used to recover files that have been previously erased. The UNDELETE command can only recover deleted files if no new files or changes have been made on the disk since the deletion. Therefore, if you accidentally delete a file that you want to keep, stop what you are doing immediately and use the UNDELETE command to retrieve the file.

Page 38: Dos Practicals

Parameters: /all - Automatically recovers all of the files you specify.

/list - All available files are listed (but files are not recovered).

/DOS Restricts recovery to those files that meet the file specifications (filespec) in the disk directory table.

/DT - Restricts recovery to those files found in the Delete Tracking File.

/DS - Restricts recovery to those files found in the SENTRY directory.

/load - Loads the Undelete memory-resident program into memory using information defined in the UNDELETE.INI file.

/unload - Unloads the memory-resident portion of the Undelete program from memory, turning off the capability to restore deleted files.

/purged[d] - Deletes the contents of the SENTRY directory.

/status - Displays the type of delete protection in effect for each drive.

/S[d] - Enables the Delete Sentry level of protection and loads the memory-resident portion of the UNDELETE program.

/Tdrive[-entries] - Enables the Delete Tracker level of protection and loads the memory-resident portion of the UNDELETE program. The optional entries parameter specifies the maximum number of entries in the deletion-tracking file (PCTRACKR.DEL). It must be a value in the range 1 through 999 with the default value determined by the type of disk being tracked.

Examples:

To undelete all recoverable files in the LETTERS directory, enter

undelete \letters\*.* /all

To undelete all recoverable files in the current directory using the delete-tracking file, enterundelete /dt

Page 39: Dos Practicals

PRACTICAL NO: 11

OBJECTIVE:Practice for practical’s at S.No. 8, 9, 10, 11.

PRACTICE FOR PRACTICAL’S AT S.NO. 8, 9, 10, 11:

DISKCOPY:

Let's use DISKCOPY!  From your C drive MS-DOS Prompt, do this:

1. DISKCOPY A: A:  {ENTER}

DISKCOMP:it will compare the side of X: with that of B:

C :\> DISKCOMP X: Z/1

SCANDISK:If you want to check and fix the current drive, enter

C :\> scandisk

XCOPY:

To copy all the files and subdirectories (including any empty subdirectories) from drive A to drive B, type:

C :\> xcopy a: b: /s /e

DELTREE:

To delete the directory LETTERS including all files and subdirectories contained in it, enter

C :\> DELTREE c:\letters

TREE:

Display the structure of the DOCS directory

C :\> TREE C:\DOCS

Page 40: Dos Practicals

LABEL:

To label a disk in drive A that contains sales information for July, type:

C :\> label a: sales-July

PRINT:

to print the file letter.txt, type

C :\> PRINT C:\LETTER.TXT

UNDELETE:

To undelete all recoverable files in the LETTERS directory, enter

C :\> undelete \letters\*.* /all

Page 41: Dos Practicals

PRACTICAL NO: 12

OBJECTIVE:Practice for creating a batch file.

PRACTICE FOR CREATING A BATCH FILE:

BATCH FILES

Batch files are a way to automate commands or groups of commands which are routinely executed from the command line.

Some benefits of batch files include:

Saving time and effort Simplification of operations for inexperienced users Simplification of complex commands for experienced users

Common uses for batch files include:

Copying or deleting files Creating the proper environment for an application Setting environmental variables

Batch files are files containing DOS commands or other valid external commands. Each command must be placed on its own line and the file must be text only - use Notepad, EDIT, or any other pure-text editor to create and modify them.

A common practice is to place all batch files in one directory and then PATH to that directory. This centralization of batch files makes it easier to modify them should that become necessary.

This rather odd method of execution can be demonstrated with the following batch file:

@echo off cls echo this is the test.bat batch file pause cls echo echo hey! look at this! >>test.bat cls echo this is the last line of the test.bat... or is it? Pause

Page 42: Dos Practicals

BATCH FILE EXAMPLES

The following batch file examples can be pasted into a text editor and modified to match your environment. If you paste them into a word processor, be sure that you Save As a plain text file.

Displaying a text file:

When large amounts of text are to be displayed to the screen from within a batch file, a more convenient alternative to ECHOing text to the screen is to place the text in a separate file and then display the contents of that file:

TYPE afile.txtOr, when there is more text that can fit on one screen: MORE < afile.txt

The second example takes advantage of redirection, see below.

Deleting Temporary Files:

Place the following lines in an AUTOEXEC.BAT to clean out temporary files during the boot. (Note the use of redirection, covered in detail below).

del c:\windows\recent\*.* < d:\batch\yes del c:\windows\internet temporary files\cookies*.* < d:\batch\yes

Control a Printer:

Use a one-line batch file like this one to issue a form feed to a HP laser printer:

@echo off rem feed.bat rem issues a form feed to a HP laser printer on LPT1 rem represents ascii char #27, control character for printers echo .&l0H > lpt1

Find a Disk File:

A batch file like the following one can be used to find a disk file from the command line.

The /v switch for CHKDSK is for "Verbose", which will list all files on the specified disk. That output is piped (|) through the FIND filter.

The replaceable parameters %1 and %2 stand in for the drive designation and the filename being searched for and make the batch file more flexible. (See replaceable parameters below for more information about them).

Page 43: Dos Practicals

rem FF.bat, findfile.bat rem Usage: FF D: filename.ext CHKDSK %1 /v | FIND "%2"