Saturday, 24 December 2022

MS-DOS Commands


There are two types of commands used in DOS.
  1. Internal Command
  2. External Command

Internal Command

The commands which are written inside file and loaded into the memory during booting (Starting) of DOS are called internal command.

for example Date, time, ver, cls, exit, etc.
when you start MS-DOS, the following text will appear on the screen.
C:\User\hp>_  (Command Prompt)
\ - Back Slash (File Address)
/- Front Slash (Command)

Internal Commands

1- Date

Purpose:- used to view and reset the system date setting.
Syntax :- date [mm-dd-yy] US date format
Example:- C:\windows> Date         (Press Enter Key)

2- Time

Purpose:- Used to view and reset the system time setting.
Syntax:- Time [hh:mm:ss.fs]
Example:- C:\windows> Time                 (Press Enter Key)

3- Cls (Clear Screen)
Purpose:- Used to clear the screen.
Syntax:- cls
Example:- C:\windows> cls                    (Press Enter Key)

4- Ver (Version or Edition)
Purpose:- used to view the edition of the operating system
Syntax:- ver
Example:- C:\windows> Ver            (Press Enter Key)

5- Exit
Purpose:- Used to close the DOS session.
Syntax:- exit
Example:- C:\windows> exit            (Press Enter Key)


There are two types of files.
Simple File
Directory File
Simple File:- (In DOS Environment)
The file which contains any data, instruction, and information in form of text
Naming of File
A file name is divided into two parts 
Primary Name and Secondary or extension name
                      (DOT or Period)
Msdos. sys
Rules to name a file
The primary name should be of 8 characters and the extension 
The name should of 3 characters. (8:3)
Example., kanti.bat, srimanta.exe, muni.xls (Valid name)
Manoranjan.mallik (invalid name) manora~1.mal (8:3)
There should not be any duplicacy while naming a file.
Special characters are prohibited for naming.
Example, .,?,<,>,{,},[,],*,(,) etc. 

6- Copy con 
Purpose – Used to create a simple file in DOS.
Syntax – copy con [Drive:]<file name>
c:\windows> copy con ictsm (press enter key)
Information Technology (press ctrl+z) and press enter key
Here C: (C drive) The 1st partition of hard disk

Disk - We can write into and read from a disk. (like Compact Disk)
Drive- which helps us to write into and read from the disk (like CD Drive)

7 - Type 

Purpose - Used to read the text file in DOS
Syntax- Type [Drive:]<file name>
Example- c:\windows> Type ictsm (Press enter key)
                   Information Technology
D:\> Copy con a   (press enter key)
Computer (press ctrl +z or F6) (enter key)
1 files copied.
D:\> Copy con b
Institute (ctrl +z) (enter key)
1 files copied
D:\> Type a
D:\> Type b

How to work with disk drive?

HDD (Hard Disk Drive)
In a CUIs all disk drive has some identification letter. For example in the case of HDD, the identification letter starts from the letter C always. 

It depends on how many partitions are there on the hard disk. If a hard disk has 4 partitions, then the first partition will be assigned with letter C, then the second with letter D, the third with letter E, and the last one with letter F.

(POST – Power On Self Test)

CDD (Compact Disk Drive)

The identification letter for CDD is also dependent upon HDD partition. In the above case, where HDD has 4 partitions, the CDD will be assigned with the letter G.

PEN Drive

The identification letter for the PEN drive will be H.

How to change the working drive position?

Ans- Type the identification letter for the drive on which you want to work on (D), then type colon symbol (:), and press the enter key.
For example, C:\windows\system32> D: (Press enter key here)
     D:\> E: (Press enter key here)
     E:\> F: (Press enter key here)

8- copy

Purpose – Used to create a duplicate file
Syntax- copy [source drive:]<Source file name> [Target Drive:]<Target File name>
Example – D:\> copy ABC def (Press enter key here)
D:\> copy e:\bbb f:\ccc (Press enter key here)

9- REN (Rename)

Purpose – Used to change the name of a file.
Syntax – ren [drive:]<old file name> <new file name>
Example-    d:\> ren abc def  (Press enter key here)
D:\> ren e:\bbb ccc (Press enter key here)

   10- DIR (Disk Information Report)

   Purpose – to list details of a disk on the screen. It will display all file details of the disk.
   Syntax-  DIR [/p][/b][/w][/l\][/s] [drive:]<directory filename>
    Example- D:\> dir (Press enter key here)
    D:\> Dir E: (Press enter key here)
    D:\> DIR c:\windows (Press enter key here)
/p : display you the list of files in page wise mode
/b : display you the name of files without any details
/l: display the name of files in lower case
/w- list the name of files width-wise (in 5 columns)
/s- list all directories along with subdirectories.

11- Directory File  

This is another kind of file that can contain directory files as well as simple files inside it.

MD (Make Directory)

Purpose – Used to create a directory file
Syntax – md [drive:]<file name>
Example – 1- d:\> md ICT (Press enter key)
d:\> md e:\ICT1 (Press enter key) e:\ICT1

12- CD (Change Directory)

Purpose – used to change the working directory position
Syntax – cd [drive:]<file name>
Example- 1- d:\> cd ICT (Press enter key)    (Entry)
2- d:\ict> cd.. (Press enter key)    (exit)   

External Command

The commands which reside inside secondary storage devices like hard disk, cd, micro disks, etc., called external commands. These are also called disk-resident commands. Such type of commands are very powerful in nature and performs the complex nature of the task. These are not easily executable commands.

1- Label 

Purpose: This helps to view and assign a disk-level name. It also deletes the label name.
Syntax : label [drive:]
Example: D:\> label (Press enter key)
        D:\> label E: (Press enter key)

2- EDIT (not for Windows 10)

Purpose: This is a multi-color, column, and menu-based text editing program. It helps to create, view, and edit a text file.
Syntax : edit [drive:] <files name>
Example : d:\> edit (Press enter key)


D:\> notepad ABC (Press enter key)

3- Xcopy

Purpose : This will copy multiple files from source to target
Syntax : xcopy [/s] [/e] [source drive:]<source file name> [target drive:]<target file name>
Example: d:\> xcopy /s /e *.* e:\backupD (Press enter key)
/s : Here this switch will copy all sub directories without empty one.
/e : This switch will copy all empty directory.

4- Attrib

Purpose – This will let you view and reset (add or remove) attributes for files.
Note: There are 4 types of attributes 
  • Archive
  • Hidden
  • Read-only 
  • System

Syntax : attrib [+ - h] [+ -r] [drive:]<file name>
 Example: d:\> attrib ictsm (Press enter key) (To check the attribute of ICTSM file) 
 D:\> attrib +h ictsm (Press enter key)   (To hide ICTSM file) 
 D:\> attrib –h ictsm (Press enter key) (To unhide ICTSM file)
 D:\> attrib +r ictsm (Press enter key)  (To make ictsm file read-only )
 D:\> attrib –r ictsm (Press enter key) (To off the read-only attribute)

Post a Comment