ENOTES

Internal and External DOS commands

access_time Aug 28, 2021 remove_red_eye 16737

In Graphical User Interface (GUI) we can directly interact with the computer system through graphical element such as icon, pictures, menus and so on. But in Character User Interface (CUI) or Command Line Interpreter (CLI) we can’t interact with graphical elements. So request or instruction to a computer to do any specific task are done through DOS command . When a command is issued to the computer through an input device, it is processed and implemented by computer accordingly. There are two types of commands in DOS. They are: Internal and external command.

DOS Internal Commands

Internal commands are memory resident commands. They are part of the command interpreter file called COMMAND.COM . Internal commands remain in computer’s main memory (RAM) until we turn off the computer. So, whenever we issue an internal command, it runs immediately.

Some internal commands with their syntax are functions are as follows:
[Note: C: drive is used as DOS prompt here in following syntax and example. Drive can be change according to the requirement]

a) DATE: This command is used to display the system’s date and also allows to set new data.
Syntax: C:\> DATE

b) TIME: This command is used to display the current system time and also allows to change time.
Syntax: C:\> TIME

c) CLS: This command is used to clear the screen
Syntax: C:\> CLS

d) COPY CON: This command is used to create a new text file in MS DOS.
Syntax: C:\> COPY CON readersnepal.txt 
Readersnepal is a online learning website for SEE, NEB and Lok Sewa.
This text can be saved by pressing F6 or ctrl+Z

e) TYPE: This command is used to display the content of text file.
Syntax: C:\> TYPE readersnepal.txt 
This will display
Readersnepal is a online learning website for SEE, NEB and Lok Sewa.

f) REN or RENAME: This command is used to rename a file.
Syntax: C:\> REN readersnepal.txt  readersnp.txt 
This will change the file name readersnepal.txt to readersp.txt

g) DEL or ERASE: This command is used to delete the specified file.
Syntax: C:\> DEL readersnp.txt 
It deletes file named readersnp.txt

h) COPY: This command is used to copy a file from one location to another.
Syntax: C:\> COPY readersnp.txt D:\web 
This command will copy file named readersnp.txt from C: drive to web directory of D: drive

i) MOVE: This command is used to move file from one location to another.
Syntax: C:\> MOVE readersnp.txt D:\web 
This command will move file named readersnp.txt from C: drive to web directory of D: drive

[Note: Using COPY files remains in both source and destination but using MOVE file remains only on destination]

j) MD or MKDIR: MD means Make Directory. It allows us to create a directory in the specified location.
Syntax: C:\> MD readers 
It creates a directory name readers in C: drive

k) CD or CHDIR: CD means Change Directory. It allows us to open or exit from any directory.
Syntax: C:\> CD readers 
This will open directory readers. So, DOS prompt changes to C:\readers>
In order to return to root directory, we use C:\readers> CD

l) RD or RMDIR: RD means Remove Directory. It allows us to delete on empty directory.
Syntax: C:\> RD readers 
This will remove directory readers from C: drive
C:\> RD D:\readers 
This will remove directory readers from D: drive

m) DIR: This command is used to display the list of files and directories.
Syntax: C:\> DIR 
This will display all the files and directories of C: drive
C:\> DIR /S 
This will display all the files and directories from sub directories as well
C:\> DIR *.EXE 
This will display all the files having EXE extension. Here, * is a wildcard

n) VER: This command displays the current MD DOS version number.
Syntax: C:\>VER

o) VOL: This command shows the disk volume label and serial number
Syntax: C:\> VOL A:

p) PROMPT: This command changes MS DOS command prompt
Syntax: C:\>PROMPT $P$G 
This command changes the command prompt with current drive letter and path followed by the greater than sign.

DOS External Command

External command are non memory resident commands. They are stored in secondary storage devices as operate program file. So, they run slower than internal commands. They are specially designed for some specific purposes.

a) ATTRIB: This command is used to set or remove the file attributes.
Syntax: ATTRIB [ ] [drive:] [path] [filename] [/s]
The empty [ ] can be filled with + to Set and + to Remove followed by R, A, S, H depending upon requirements.
Example: C:\> ATTRIB +H D:\*.jpg
This will hide all the file with .jpg extension i.e. images from D: drive.

b) EDIT: This command is used to create a text file in MS DOS. It allows us to edit, save and print the text files.
Syntax: EDIT readersnepal.txt 
It displays the contents of the file readersnepal.txt, if the file doesn’t exist it creates a new file with that name.

c) CHKDSK: This command check the disk status and shows the status report including total disk space, free disk space and so on.
Syntax: C:\> CHKDSK

d) FORMAT: This command is used to format a disk.
Syntax: C:\> FORMAT D: 
This will format D: drive

e) TREE: This command is used to display the tree structure of a drive or path graphically.
Syntax: C:\> TREE 
It will display all the structure of directory or C: drive

f) SYS: This command is used to create a bootable disk by copying system file onto it.
Syntax: C:\> SYS D: 
This will copy system files from C: drive to D: drive to make D: drive bootable.
C:\> SYS D: E: 
This will copy system files from D: drive to E: drive to make E: drive bootable.

g) LABEL: This command is used to display and set the volume table of a disk i.e. name for the disk drive.
Syntax: D:\> LABEL 
This will allow us to enter the volume label of D: drive.

h) SCANDISK: This command is used to scan the disk, check the status of disk and fixes errors if any and gives the detail reports of the disk drive.
Syntax: C:\> SCANDISK

i) XCOPY: This command is used to copy one or more directories including files and sub-directories from one location to another.
Syntax: C:\> XCOPY D:/S E:/V
This command copies all the directories including sub directories of D: drive to E: drive and verifies after copying the files. 
Here, /S copies all sources directories and sub directories that are not empty
/V verifies each files as it is written to the destination file.
 

Click here to know about Operating System, its functions and types.