Pakistan study notes for Matric, Intermediate, B.A, B.COM BSC, M.A, BCS. Free Pakistani Urdu educational school, colleges and University notes.

Internal and external commands of DOS

Q.15. Write function and syntax of some important internal and external commands of DOS.

 

ANS. INTERNAL COMMAND

 

1. CLS COMMAND

Function

CLS is a short of Clear Screen. This command clears the monitor screen and displays the command prompt in the upper left corner of the screen.

Syntax CLS

 

2. DIR COMMAND

Type

Internal Command

 

Function

The DIR command displays a list of the files of a directory on screen. The information DIR displays includes the filename and extension, the size (in bytes), and the date and time the file was last updated. Wildcard characters ? and * can be used for filenames. DIR command has several switches.

Syntax DIR.

 

3. DIR /P

This command displays directory Page wise. The directory display pauses when the screen is full; press any key to display the next screen.

 

4. DIR /W

Display directory in width-wise. Only filenames are displayed, but no other information is shown.

 

Example

DIR*.COM

(Displays all files with extension .COM)

5. DATE Command

Function

DATE command displays the current system date and prompts the user to change date. Press enter if you do not want to change the current date. Or, enter a new date and press Enter key.

Enter only numbers.

The numbers must be in the following ranges:

mm must be from Ito 12

dd must be from 1 to 31

yy must be from 00 to 99

 

The computer’s internal clock is set according to the given date. The file directory then records this date on all files that are created or modified.

 

Syntax

DATE Displays current system date.

DATE [mm-dd-yy} Sets date in American format.

DATE [dd-mm-yy} Sets date in British format.

Example DATE 04-24-03

 

6. TIME Command

Function

TIME command displays the current system time and also allows to set new time. Press Enter if you do not want to change the current time. Or, enter a different time and press Enter key. DOS returns to the commands prompt.

 

Enter the time using only numbers. DOS uses a 24-hour clock so the number must be in the following ranges.

hh must be from 00 to 23

mm must be from 00 to 59

ss must be from 00 to 59

 

Separate the hour and minute entries with a colon.

The computer’s internal clock is set accordingly.

The file directory then records the time on all files when you create or modify them.

 

Syntax

TIME           Displays the current time

TIME           [hh:mm:ss] Sets new time

Example      TIME 14:25:40

 

5. COPY COMMAND:

Copy command copies one or more files to another disk or directory. Files (s) are copied from the destination. Group of files can be copied using wildcard characters. Square brackets indicate an optional entry.

6. PROMPT COMMAND

Functions

The PROMPT command is used to change the appearance of DOS prompt to any string of characters. Typing PROMPT command without any string of characters resets to default DOS prompt. Following characters can be used in the PROMPT command to specify special prompt information. These characters must be preceded with a dollar sign ($) in the string.

Syntax PROMPT [string]

Example

PROMPT Ali $d (Displays Ali with date in the prompt)

PROMPT $n (Displays drive letter in the prompt)

PROMPT (Resets to the default prompt)

CHARACTER

RESULT

$$

Indicated $ character

$d

Current date

$t

Current time

$q

= sign

$p

Current directory of the default drive

$v

DOS version number

$n

Default drive

$g

> greater than character

$l

< less than character

 

 

9. DEL Command

Function

This command can be used to delete a specified file or all the files within a directory. Wild cards can be used to delete group of files. With / P switch the command prompts for confirmation before deletion.

 

Syntax DEL [drive: \][path]\filename[\p]

Example DEL APPLI. TXT

(Deletes a file APPLI.TXT of the current directory or disk)

DEL A:\*.BAK/P

(deletes all files whose extension is .BAK from drive .A and asks for confirmation.)

 

10. REN or RENAME Command

Function

The REN command changes the name of file or group of files if used with wildcards.
Syntax REN [drive:\][path]\old file name new file name

Example REN MATH.BAK TEST.BAS

(changes the name of MATH.BAK file to TEXT.BAS of the current directory.) REN A:\*.TXT*.LST

(renames all files of the drive A whose extension is TXT to the files with extension. LST.)

11. VER Command

Function

VER command displays the DOS version number. This command informs which version of DOS we are using

Syntax VER

12. VOL Command

Function

VOL command displays the volume label of the disk. Syntax VOL [drive:]

Example VOL

VOL A: ( displays volume label of drive of A)

13. TYPE Command

Function

It displays the contents of a file on screen. TYPE command can be used to examine a DOS text file without modifying it. Filename must be specified with this command and wildcard characters are not allowed.

Syntax TYPE [drive] [path] filename

Example TYPE A:\TEST.TXT

(displays the contents of TEXT text file of drive A)

TYPE SAMPLE. TXT>PRN (Redirects output to printer.)

 

14. MD or MKDIR Command.

Function

MD or Make Directory command creates a new directory. When you are in the root directory or one of its subdirectory, you can use MD command to create new subdirectories.

Syntax MD [drive:\] [path] Directory name

Example MD basic (Creates a new directory named BASIC within the current Directory.)

15. CD or CHDIR Command

Function

CD or Change Directory command changes or displays the current directory.

Syntax CD [drive:\] path

Example CD basic (Changes the directory to BASIC from within the current directory.)

(displays the contents of TEXT file of drive A)

CD.. (Changes to the parent directory)

CD\ (Changes to the root directory from within any subdirectory.)

16. RD or RMD1R Command

Function

RD or Remove Directory command removes a directory from a directory structure. The directory to be removed must be empty.

Syntax RD [drive:\] path

Example RD BASIC

(Removes directory BASIC from within the current directory.)

CD\ (Returns to root directory from within any subdirectory.)

 

17. PATH Command

Function

The PATH command searches in a list of specified subdirectories for commands or program files. DOS searches the directories in the path until it finds the command to be executed. PATH stays in effect until you reset the system or set another path.

Syntax PATH [drive:\] path [drive…..]

Example PATH (Displays the current path)

PATHC: \WORD\WS;\ WINDOWS

EXTERNAL COMMAND

1. FORMAT Command

Function

The FORMAT command prepares a disk in the specified drive for storing files. Formatting initializes the directory and files Allocation Tables (FAT) and destroys any data on the disk if it is reformatted. All new disks must be formatted before using them.

Syntax FORMAT target drive: [/S] [Q] [/U]

Example FORMAT A: (Formats the disk in drive A)

FORMAT A:\S

(Formats the disk in drive A with system files and make it a bootable disk)

FORMAT A:/Q/U

(Quick and Unconditional formatting the disk in drive A)

2. CHKDSK Command

Function

The CHKDSK command checks the floppy disk or hard disk and displays a status report. In the report it specifies the number of files, the amount of total disk space and the space still available for use and the amount of internal memory available. This command also reports the possible disk errors. If it founds any error, optionally, corrects them.

 

Syntax CHKDSK target drive: [/F] [/V]

Example CHKDSK (Checks the default disk drive)

CHKDSK A:\F

(Checks the disk in drive A and selects fix mode and attempts to correct the directory.) CHKDSK A:/V

(Checks the disk in drive A and selects verify mode and displays filenames, directories and messages.)

3. DISKCOPY Command

Function

The DISKCOPY command copies the full contents of one floppy disk to another. This command can be used for floppy diskettes only. You cannot use this command to copy to a hard disk or any portion of hard disk to a floppy disk. D1SKCOPY checks to see if the destination disk is formatted and in the same format as the source disk. If the destination disk is not formatted, DISKCOPY formats the disk.

Syntax DISKCOPY source _drive: target _ drive:

Example D1SKCOPY A:B:

(copies the entire contents of disk in drive A to the disk in drive B.)

4. LABEL Command

Function

LABEL command creates, changes, or deletes a volume label on a disk. Labels are used to identify the disks. The label can be up to 11 characters long.

Syntax LABEL [target drive]: [volume label]

Example LABEL (Labels the default drive.)

LABEL A:LETTERS

(Labels LETTERS to the disk in drive A)

5. DOSKEY Command

Function

DOSKEY is a memory resident program, once installed it creates a special memory space where all DOS commands being entered are stored. Each time a command is entered it is added to the DOSKEY’s command memory buffer. These commands are recalled by pressing the up and down-arrow keys. DOSKEY remains in memory as long as computer is switched on Syntax DOSKEY

6. SYS Command

Function

SYS command transfers the system files to the specified disk and makes a DOS bootable disk. Syntax SYS target _drive

Example SYS A: (Copies the systems files to the disk in drive A.)

7. EDIT Command

Function

EDIT is a text editor program. This program is used to create, modify and print text files, batch files and DOS config. files.

Syntax EDIT [drive:] [path] [filename]

Example EDIT (loads the edit program and creates a new file in default directory) EDIT TEXT.BAT

(loads the edit program with a batch file called TEXT.BAT)

8. PRINT Command

Function

PRINT command prints a text file on printer.

Syntax PRINT [drive:] [path] filename

Example PRINT TEST.TXT (Prints a file TEXT.TXT on printer)

9. XCOPY Command

Function

XCOPY command selectively copies one or more files including subdirectories from one disk to another or to the same disk. A group of files by indicating a path using wildcards can be copied with this command, XCOPY differs from COPY command in that you can cop; subdirectories and, if necessary, create them as you copy. It has a number of switches.

Syntax XCOPY [source _drive:\] path \ filename [target _drive:\] [path]\[filename] /S/P/V

Example XCOPY C:\ A:\ /S

(Copy all the files including all the subdirectories of drive C to drive A)

XCOPY C:\ WORK A:\ HOME /V

(Copies all files from the WORK subdirectory of drive C to HOME directory of drive A. If this directory is not found in drive A, XCOPY creates it and verifies copy.)

10.  DELTREE Command

Function

DELTREE command deletes directories and their contents (files and Subdirectories.)

Syntax DELTREE directory name

Example DELTREE WORK

(Deletes a directory WORK and all its contents.)

Related posts:




Leave a Reply

Content Protected Using Blog Protector By: PcDrome. & GeekyCube.