Disk Operating System – MS Dos Commands

What is Operating System?

Here, you will find the set of DOS commands, with the help of them, you can work with MS DOS. Operating system is the interface b/w user and h/w. it is the most commonly used system software, it manages the basic operation of a computer. These operations include booting the computer, Manage of all computer resources (all H/w parts).
Thus we can define an O.S. as a master system of programs that manages the overall operations of the computer. O.S. Can be divided into two categories on the basis of the number of users at a time, as follows:-
1. Single User O.S.
2. Multi User O.S.

Single User O.S.:
In this case, only one user can work on computer at a time. These O.S. are suitable for personal computers. Used at homes.
Eg. Windows Xp, Windows 98, Ms- DOS etc
Multi User O.S.:
In Multi User O.S. Environment many users can work on the computer at a time. These are suitable for organizations and educational institutions.
Eg. Windows 2000, Windows NT, Linux, Unix

Operating system as a User Interface:-
There are mainly two types of O.S. as a user interface, these are following:
· Graphical User Interface (GUI)
· Command User Interface (CUI)
Graphical User Interface:-
The GUI allows the user to select the desired option with the help of graphical images. This type of interface uses both images and menu to select commands ar initiate different operations. Generally these graphical images are called Icons, which are small pictorial figures representing different tasks, Procedures and programs.
Command User Interface:- CUI can help the user to interact or communicate with the computer through different commands. In this type of Interface the user has to memorize so many commands or to refer book for different commands. It also takes time to type each commands.

What is MS DOS (Microsoft Disk Operating System)?

DOS stands for DISK OPERATING SYSTEM It is one of the most commonly used O.S. in a single user environment. It runs mainly on personal computers made by different companies, such as Compaq, IBM, HP.
There are two O.S. referred as DOS.
1.) MS DOS (Microsoft Disk Operating System)
2.) PC DOS (Personal Computer Disk Operating System)

List of all DOS Commands.

1) Date Command

This command is used to change or/and display current system date.


C:\>DATE /t
Sun 03/04/2012

C:\>DATE
The current date is: Sun 03/04/2012
Enter the new date: (mm-dd-yy) 04-05-2013

2) TIME Command

This command is used to change or/and display current system time.


C:\>TIME /t
02:48 AM

C:\>TIME
The current time is:  2:48:47.32
Enter the new time: 06:10:00

3) VER Command

This command is used to display the window's version.


C:\>ver
Microsoft Windows [Version 6.1.7600]

4) VOL Command

This command is used to display the disk volume level or serial number.


C:\>vol d:
Volume in drive D is SOFTWARE
Volume Serial Number is 147C-DA89

5) LABEL Command

This command is used to create, update and delete the serial number of particular disk.


C:\>LABEL D:
Volume in drive D: is SOFTWARE
Volume Serial Number is 147C-DA89
Volume label (32 characters, ENTER for none)? IMP_DOCUMENTS

6) ECHO Command

This command is used to display message on command screen, and also turn on/off command-echoing.


Command syntax is : 
C:\> ECHO [ON|OFF]
C:\> ECHO [MESSAGE]

C:\>ECHO "https://www.includehelp.com"
"https://www.includehelp.com"

C:\>ECHO OFF

DATE/T
Sun 03/04/2012

ECHO ON
C:\>

7) PROMPT Command

This command is used to change the command prompt.

Switches:
    $A - & (Ampersand) 
    $B  - | (pipe) 
    $C - ( (Left parenthesis) 
    $D - Current date 
    $E  - Escape code (ASCII code 27) 
    $F - ) (Right parenthesis) 
    $G - > (greater-than sign) 
    $H - Backspace (erases previous character) 
    $L - < (less-than sign) 
    $N - Current drive 
    $P - Current drive and path 
    $Q - = (equal sign) 
    $S  - (space) 
    $T - Current time 
    $$ - $ dollar sign 

C:\>prompt "includehelp.com"

"includehelp.com"DATE/t
Sun 03/04/2012

"includehelp.com"PROMPT $p$g

C:\>

8) TITLE Command

This command is used to change the title of MS DOS screen.


C:\>TITLE includehelp.com

9) MKDIR/MD Command

MKDIR/MD command is used to create directory in particular drive.


Command syntax is :
C:\> MKDIR [drive]:\[Directory_Name]
C:\> MKDIR [Directory_Name]
* If you do not enter path [drive or directory],
directory will make in current working drive/directory.


1. C:\>MKDIR D:\Tutorial
2. C:\>MKDIR Tutorial
3. C:\>MKDIR D:\Folder1\Folder2\Folder3

Explanation

1. Directory will create into D: drive
2. Directory will create into C: drive.
3. You can also create directories using sub-direcories, here 3 directories will be created . Folder1 will be created in D: drive then Folder2 will be in Folder1 and Folder3 will be in Folder2.

10) CHDIR/CD Command

CHDIR/CD command is used to change current working direcory.


Command syntax is :
C:\> CHDIR [drive]:\[Directory_Name]
C:\> CHDIR [Directory_Name]

11) CD.. and CD\ Command

CD.. command is used to exit from current working directory.
CD\ command is used to exit from all directories and reaches to current drive.


Command syntax is :
[Current_working_drive\direcotries..\> CD..
[Current_working_drive\direcotries..\> CD\           

1.	C:\>d:
2.	d:\>cd tutorial
3.	d:\Tutorial>cd..
4.	d:\>cd folder1\folder2\folder3
5.	d:\Folder1\Folder2\Folder3>cd\
6.	d:\>cd folder1\folder2
7.	d:\Folder1\Folder2>cd\
8.	d:\>
Explanation

1: Change current drive C: to D: drive.
2: Open tutorial directory .
3: Current working dir. is"D:\tutorial> ", CD.. - exit from tutorial directory.
4: Open folder3 directory. (folder3 exits in "D:\folder1\folder2" No need to write D:\ because current working directory is D:).
5: Current working directory is "folder3". CD\ - exit from all directories.
6: Open folder2 directory .(folder2 is exists in "D:\folder1").
7: Current working directory is "folder2". CD\ - exit from all directories.

12) COPY CON

COPY CON command is used to create a text file.


Command syntax is :
C:\>COPY CON [file_name]
Your text will goes here....
^Z (CTRL+Z) OR F6 .. (to save file)          


C:\>COPY CON about_us.txt
includehelp.com provides online tutorials .
^Z
C:\>

13) TYPE Command

TYPE command is used to display file.


Command syntax is :
C:\> TYPE [FILE_PATH]       


C:\>TYPE about_us.txt
includehelp.com provides online tutorials .
C:\>

14) EDIT Command

EDIT command is used to open DOS Editor to create,display, modify files.
Switches
/B - To open black and white mode.
/R - To open file in read only mode.


Command syntax is : 
C:\>EDIT [/B|/R] [FILE_PATH]

1. C:\>Edit
2. C:\>Edit/B about_us.txt
3. C:\>Edit/R about_us.txt
4. C:\>Edit about_us.txt

Explanation

1: Opens DOS Editor.
2: Opens about_us.txt file in black and white dos editor.
3: Opens about_us.txt file in read only mode.
4: Open about_us.txt file in colored screen.

15) DIR Command

DIR command is used to displays a list of files and subdirectories in a directory.

Switches
/A  Attribute wise filtering ..
        R : Read only files.
        D : Directories only.
        H : Hidden items only.
        S : System files only.
        -D: Files only  
/B  Uses bare format (no heading information or summary).   
/C  Display the thousand separator in file sizes. This is the default. 
    Use /-C to disable display of separator.   
/D  Same as wide but files are list sorted by column.   
/L  Uses lowercase.   
/N  New long list format where filenames are on the far right.   
/O  List by files in sorted order.) 
        S: Size wise sorting.
        N: Name wise.
        D: Date wise.
        E: Extension wise sorting.
                      
/P  Pauses after each screenful of information.   
/Q  Display the owner of the file.   
/S  Displays files in specified directory and all subdirectories.   
/T  Control what time field displayed or used for sorting   
timefield   	C Creation, 
A Last Access, 
W Last Written  
/W  Uses wide list format.   

Command syntax is :
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L]...

    1)  C:\> DIR D:
        (display all directories and files of d: drive).
    2)  Using "A" attribute:-
        C:\> DIR/AD D:
        (display direcotries (folders) only of d: drive).
        C:\> DIR/A-D D:
        (display only files of d: drive).
        C:\> DIR/AH D:
        (display all hidden items of d: drive).
    3)  C:\> DIR/A-D/AR D:
        (display all files(only) with read only property).
    

Using wild characters:
1) To find all .txt (text) file from d:\folder1
C:\>DIR D:\folder1\*.txt
2) To display all .docx (ms word files) starting with "A" filename.
C:\>DIR D:\folder1\A*.docx
3) To display all files of E: drive starting with "A" but third charcter of file name must be "C" (of any type/extension).
C:\>DIR D:\A?C*.*
4) To display all files with all extenstions of E:\.
C:\>DIR E:\*.*

16) TREE Command

This command is used to display files and sub directories of particular directory.
Switches
F : Displays the name of the files in each folder.
A : Use ASCII instead of extended characters.


Command syntax is : 
C:\>TREE/[SWITCH] [DRIVE:]\[DIRECTORY]
C:\>TREE D:\test
Folder PATH listing for volume iHelp's  Personal Data
Volume serial number is 00000002 147C:DA89
D:\TEST
├───folder1
├───folder2
│   └───SubFolder1
│       ├───SubFolderA
│       └───SubFolderB
└───folder3

C:\>


C:\>TREE/F D:\test
Folder PATH listing for volume iHelp's  Personal Data
Volume serial number is 00000002 147C:DA89
D:\TEST
│   file1.txt
│   file2.txt
│
├───folder1
├───folder2
│   │   file-A.txt
│   │   file-B.txt
│   │
│   └───SubFolder1
│       │   t.txt
│       │
│       ├───SubFolderA
│       └───SubFolderB
└───folder3

C:\>

17) DEL/ERASE Command

DEL/ERASE command is used to delete one or more than one file at a time.


Command syntax is :
C:\> Del [/Switch] [File Path] 

Following switches can be use with this command.

  1. /P : Display the confirmation message.
  2. /F : Force deleting of read only files.
  3. /A : Select file to delete based on attributes :
    • S : System files
    • R : read only files
    • H : Hidden files
    • A : ready for archiving


C:\>ERASE/P D:\includehelp.txt
D:\includehelp.txt, Delete (Y/N)? y

Explanation : above command will delete includehelp.txt file from D:\ drive, with confirmation message "D:\includehelp.txt, Delete (Y/N) ? " Press Y to delete..


1)	C:\> Del MyFile.Txt 
2)	C:\> Del/AH *.jpg
3)	C:\> Del D:\Ram\Shyam\F1.Doc

Explanation

1) Delete MyFile.txt from C drive.
2) Delete all hidden files with extension .jpg( JPEG image files).
3) Delete F1.Doc from D:\Ram\Shyam folder..

18) RM/RMDIR Command

This command is used to removes (deletes) a directory (folder).

Command syntax is :
C:\> RD [/Switch] [Path] 

Following switches can be use with this command.

  • /S : Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree.
  • /Q : Quiet mode, do not ask if ok to remove a directory tree with /S.


1.	C:\>TREE d:\examples
2.	Folder PATH listing for volume Mike's  Personal Data
3.	Volume serial number is 00000002 147C:DA89
4.	D:\EXAMPLES
5.	├───include
6.	│   └───Debug
7.	└───loop_Ex

8.	C:\>RD/S d:\examples
9.	d:\examples, Are you sure (Y/N)? y
10.	C:\>

Explanation

1. Command to display d:\examples directory.
8. Command to delete d:\examples directory.
9. Confirmation message to delete ...

19) SHUTDOWN Command

Shutdown command is used to shuts down the window.

Switches

/S Shuts down the window. /F Forcely shut down the window. /C Display dialog with comment and then shutdown. /T Shutdown time in XX seconds. /A Abort the shutdown command. /I To displai GUI window for remote shutdown.


1) C:\> SHUTDOWN -S
2) C:\> SHUTDOWN -F
3) C:\> SHUTDOWN -S -C "Windows is shutting down due to virus.."
4) C:\> SHUTDOWN -S -T 30
5) C:\> SHUTDOWN -A
6) C:\> SHUTDOWN -I