Table of Contents hide

LINKS FOR MORE DOS TRICKS

History

  • DOS (Disk Operating System) was developed by Microsoft Inc. and released it as IBM PC DOS (known as MS-DOS) for the first time on August 21, 1981, as MS-DOS 1.0, which was written by Tim Paterson.
  • It was last updated in April 1994 when MS-DOS 6.22 was released. Today, MS-DOS is no longer used at large scale; however, the command shell, more commonly known as the Windows command line is still used by many users in window OS.
  • It was the first OS for the PC (IBM PC) and is the underlying control program for Windows 3.1, 95, 98 and ME.
  • Windows NT, 2000 and XP emulate DOS in order to support existing DOS applications.

Introduction

  • This OS was written initially in assembly language and later advance version also with C language.
  • The first version of MS DOS was MS DOS 1.x and latest version is MS DOS 7.

Definition

  • DOS is a Free, single-user, single or Uni tasking, earlier, 16-bit, CUI/character based or command line(non-GUI), standalone operating system from Microsoft for the PC that controls and regulates computer’s hardware and peripheral devices behaviour and functionality.

Features

  • DOS contains a master control program that is automatically run when we start our personal computer (PC). DOS stays in the computer all the time letting us run a program and manage files.
  • DOS uses the File Allocation Table (FAT) filesystem. This was initially FAT12 which supported up to 4078 clusters per drive. Later, DOS 3.0 added support for FAT16 which used 16-bit allocation entries and supported up to 65518 clusters per drive.
  • Advantages:
    • DOS (Disk Operating System) was the first widely installed operating system for personal computers.
    • It is Free OS.
    • It does File management works such as creation, updation, deletion of files.
  • Disadvantages:
    • It doesn’t support GUI i.e. it has text based interface.
    • It has Single user OS.
    • It has Uni tasking OS.
    • It is a 16-bit OS.
    • The mouse didn’t work in it.

Terminology

Commands:

  • A command is a set of instructions used to perform a specific task on files or directory.
  • This command is executed/interpreted by OS interpreter to a machine language (0&1).
  • It is unique keyboard recognize by an OS.
  • There are two types of DOS Commands-
(a) Internal DOS commands
    • These commands are loaded during/with the system booting with command.com file and are stayed and executed from the RAM.
    • These commands cannot be created, viewed, updated or deleted by the user because they do not exist in the form of a file rather included in command.com file. 
    • These commands are in-built in DOS and are part of shell.
    • There is no external file to read the internal commands.
    • Examples are – DATE, TIME, VER, VOL, MD, CD, CLS, DEL, CLEAR, COPY CON, REM, RMDIR, TYPE, BREAK, CALL, CMD/COMMAND, COLOR, ECHO, EXIT, CTTY, FOR, GOTO, IF, MD, MKDIR, LOCK, MOVE, PATH, PAUSE, PROMPT, RD, REN, RMDIR, UNLOCK, TITLE etc.
(b) External DOS commands
    • These commands are only loaded from disk to main memory as a file when they are invoked.
    • These commands are loaded after system booting when required and are present and executed from the Disk.
    • It can be invoked whenever necessary.
    • These commands are not in-built in DOS and are part of shell.
    • These commands can be viewed, updated, copied or deleted by the user because external files exist in the form of a file as .exe, .bat, .com etc.
    • Examples are – APPEND, ASSIGN, ATTRIB, CHKDSK, COMPACT, DEBUG, DEFRAG, DELTREE, DISKCOPY, EXTRACT, FDISK, FIND, HELP, IPCONFIG, LABEL, LOGOFF, MORE, NET, NETSH, NETSTAT, PING, POWER , QBASIC, SCANDISK, SHUTDOWN, TELNET, EDIT, SYS, FORMAT, XCOPY, PRINT, SORT, TREE, UNDELETE, UNFORMAT etc.

Directory(Folder):

  • Directory is a file used to store/list  another files and directories(called sub-directory) inside it.
  • It is considered as a catalog of files & directory.
  • There are 3 types of directory used in MS-DOS –
(a) Root Directory
    • A directory which is created automatically when the disk is formatted.
    • For example –
      • For a floppy disk, drive A:\ and B:\ are root directory.
      • For a hard disk, drive C:\, D:\, E:\ etc. are root directory.
(b) Parent Directory
    • Parent directory is a directory which is one level up to the current directory.
    • For example –
      • C:\ Audio\Sad_Songs\01.mp3.
C:\ = Root directory.
Audio = Parent directory.
Sad_Songs = Current or working directory.
01.mp3 = An Audio file.
(c) Current or Working Directory
    • The directory in which a user is working at that moment or currently.
    • For example –
      • C:\ Audio\Sad_Songs\01.mp3.
C:\ = Root directory.
Audio = Parent directory.
Sad_Songs = Current or working directory.
01.mp3 = An Audio file.

Sub-directory (Sub-folder): 

  • A directory is within/inside a directory is called sub-directory.

Wild Card Characters in MS DOS: 

  • Wild Cards are special characters and symbols that represent one or more characters.
  • The wild card characters are – (*) Asterisk – used to represent one or more characters and (?) Question mark – used to represent single character.
  • Wild card is mainly used to search specific pattern of files or directories.

DOS Commands

  • DOS commands are not case sensitive.
How to open DOS in Window XP/7/8.1/10 OS

(a) Press “Window key+r” – Type ”cmd or command” in box – ok.

OR

(b) Right click on Start button – Choose and click “Command prompt or command prompt(admin)”.[In window 10 OS]

NB: command prompt(admin) is used to open DOS in administrator mode.

Batch Command :
  • The batch command is a recovery console command that executes a series of commands written within a file called Batch files.
  • Batch files allow MS-DOS and Microsoft Windows users to create a list of commands to run in sequence once the batch file has been executed.
  • A simple batch file does not require any special programming skills and can be done by users who have a basic understanding of MS-DOS commands.
  • A good example of Batch file is use of Shortcut icon in Windows. Another very good example of Batch file is the use of Autoexec.bat file. (This is a boot batch file loaded each time the computer boots into MS-DOS and early versions of Windows. This batch file contained all the necessary commands and programs used to run MS-DOS and Windows each time the computer booted.).
  • A batch file is executed in two ways – By command prompt and double click on the batch file.
  • Batch files are created through two ways –
    • Using MS-DOS:
      • A basic batch file is created using MS-DOS, the following steps are taken to create –

        1. Open MS-DOS.
        2. Create a new batch file by typing the name of file as edit test.bat at the MS-DOS prompt and then type press enter.
        3. Now, type the require commands:

          pause
          dir c:\windows
          dir c:\windows\system

        4. Now, save the file again.
        5. Once we are back at the MS-DOS prompt(C:\), type: test and press enter. (This will execute the test.bat file and begin running the file. Because the first line is pause, we will first be prompted to press a key. Once we press a key the batch file will run line-by-line; in this case, listing the files in the windows and windows\system directories occurs.)

        NB : Some versions of MS-DOS and bootable diskettes may not have the edit command; if this the case, we would either need to obtain the edit.com file to access this file or use the copy con command to create a new file.

    • Using MS-Windows:
      • A Windows user can use any simple text editor, such as Notepad, to create/save batch files with file extension .bat. For this, we should follow the below steps – 

        1. Open Notepad.
        2. Once notepad is open, type the commands in the file

          @echo off
          echo Batch file is started executing
          pause
          dir c:\windows

        3. Save the file as “test.bat”, and choose “Save as type” option, as “All files”, otherwise it will save as a text file. Once all of this has been done click the Save button and exit notepad.
        4. Now, to run the batch file, by double-clicking on it or run the file like any other program. Once the batch file has completed running it will close the window automatically.

NB: Here, @ symbol avoids echo back the text after the at symbol. This most commonly used as @ECHO OFF to prevent any of the commands in the batch file from being displayed, just the information needed.

In batch file, CALL statement is used to run another batch file within a batch file. When the batch file that is called is completed, the remainder of the original batch file command is completed. And if the called batch file does not exist it will give an error message.

Chdir/Cd Command :
  • This command is used to change/switch and display the current directory.
  • Example:
    • CD directory_name command is used to move to the new directory ahead from current working directory.
    • CD.. command is used to move to the one directory back in one go (i.e., in parent/root directory) from current working directory.
    • CD/ command is used to move to the beginning or first directory back (i.e., in root directory) from current working directory in one go.
    • cd /d command is used to switch from one drive to another drive in one go such as c:\cd / e:\new folder5 to move from c drive to new folder5 directory of e drive in one go.
Chkdsk command :
  • Chkdsk stands for Check Disk.
  • This command is used to check the status of the file system.
  • It scans the disk drive and helps in detecting error, repair and retrieval of data from bad sectors.
  • Syntax:
    • C:\Chkdsk drive_name (Press Enter)
  • Example:
    • C:\Chkdsk d: /r (Press Enter)
    • C:\Chkdsk d: /f (Press Enter)
    • C:\Chkdsk *.* (Press Enter)
Cls command :
  • This command is used to clear/clean the complete previous contents of the screen and leave only a prompt
  • Syntax & Example: 
C:\ cls (Press enter)
Copy Command :
  • This command is used to copy a complete file from one location to another.
  • Syntax:

C:\ copy source_file_name destination (press enter)

  • Example:

C:\ copy file1.txt d:\new folder (press enter)

C:\ copy *.txt f:\new folder1 (press enter)

Copy Con command :
  • Copy con command is used to write/create a new or fresh file with certain name in the current/working directory.
  • After the finishing of new file creation, CTRL+ Z button is pressed/required to save & exit from the created file successfully to come again at DOS prompt.
  • This command actually copies the contents from the console and writes into a file.
  • This command does not edit the created file.
  • Syntax : 

C:\ Copy Con Filename (Press enter)

  • Example
C:\ Copy Con File1.txt (Press enter)
——–
——–
———
Ctrl+Z (to save & exit)
Date Command :
  • The date command can be used to display the current date of the system and prompt for a new one. If no date is entered, the current date will be kept.
  • This command is also used to change the date to an alternate date.
  • C:\ date (Press enter)
  • C:\>date
    The current date is: 30-12-2022
    Enter the new date: (dd-mm-yy)
Dir Command :
  • This command is used to display all the non-hidden files & sub-directories present/stored in that current/working directory.
  • In another words, this command is used to view the contents of a directory (directory list=files & directories).
  • Syntax :

C:\ dir (Press enter)

C:\dir/option Directory_name (Press enter)

  • Example : 

(i) C:\ dir (Press enter) [Display all the non-hidden files & sub-directories only from C drive/directory.]

(ii) D:\ dir (Press enter) [Display all the non-hidden files & sub-directories only from D drive/directory.]

(iii) C:\ New Folder\New Folder1\dir (Press enter) [Display all the non-hidden files & sub-directories only from New Folder1 directory.]

(iv) C:\ dir New Folder (Press enter) [Display all the non-hidden files & sub-directories only from New Folder directory of C drive.]

 (v) C:\dir *.exe = To display or list all the non-hidden executables files from C drive.

(vi)  C:\dir *.txt *.docx = To display or list all the .txt and .docx extension files from C drive.

  • There are several options used with dir command to display the contents according to the need. These are –
    • dir/a = Used to display all the hidden and non-hidden files & directories from that current/working directory.
    • dir/ah = Used to display all the hidden files & directories only from that current/working directory.
    • dir/a-d = Used to display all the files only from that current/working directory.
    • dir/ad = Used to display all the directories only from that current/ working directory.
    • dir/a/s = Used to display all the directories with files and sub-directories from that current/working directory.
    • dir ra*.* = Used to display all the files & directories starting with ra alphabets having any extension name from that current/working directory.
    • dir /s = List the files in the directory that we are in and all sub directories after that directory.
    • dir /p = List all the files’ contents page wise.
    • dir /w = List the file and directory related information width wise/horizontally.
    • dir /s /w /p = List all the files and directories in the current directory and the sub directories after that, in wide format and one page at a time.
    • dir /on = List the files in alphabetical order by the names of the files.
    • dir /o-n = List the files in reverse alphabetical order by the names of the files.
    • dir \ /s |find “i” |more = To list all directories on the hard drive, one screen page at a time, and see the number of files in each directory and the amount of space each occupies.
Del (Erase) command:
  • Del command is used to remove one or more files permanently from a directory.
  • Syntax:

C:\Del filename (Press Enter)

  • Example:
    • C:\Del File1.txt (Press Enter)
    • C:\Del *.txt (Press Enter)
DelTree  command:
  • Deltree command is used to remove a directory along with sub-directory and files, if any, in one go, permanently.
  • Syntax:

C:\Deltree Directory_name (Press Enter)

  • Example:
    • C:\Deltree Dir1 (Press Enter)
Echo command:
  • Echo command is used to display messages as we typed or turns command-echoing on or off.
  • Syntax:
    • ECHO [message]
    • ECHO [ON | OFF]
  • Example:
    • C:\>echo Welcome
      Welcome
Edit command:
  • Edit command allows a user to view, create, or modify the text files.
  • Syntax:
    • C:\Edit filename (Press Enter)
  • Example:
    • C:\ Edit File1.txt (Press Enter)
Exit command:
  • This command is used to come out/close/exit from the DOS.
  • It quits the command.com file.
  • Example : 

C:\ exit (Press enter)

Format command:
  • This command is used to format the diskette and fixed disks drive.
  • This command initializes the directory and file allocation tables.
  • Syntax: 

C:\ Format drive_name: (press enter)

Finger command:
  • This command is used to view information about users logged onto a remote computer.
  • This may include their e-mail address, full name, when last time user logged in, read their e-mail etc.
  • Syntax: 

C:\ finger -l user@ localhost (Press enter)

Help command:
  • Help command is used to give the information about the given keyword from a MS-DOS prompt.
  • Syntax:
    • C:\ keyword -help
or
    • C:\keyword /?
  • Example:
    • C:\dir -help
      or
      C:\dir /?  [Gives the full detail about dir command]
    • C:\help dir (Press enter)
    • C:\help dir (Press enter)
    • C:\help date (Press enter)
    • C:\date /? (Press enter)
Hostname command:
  • Hostname command is used to display the name of current Host.
  • Syntax & Example:
    • C:\ hostname (Press enter)
Ipconfig command:
  • ipconfig command is used verify a network connection or view network settings.
  • Syntax & Example:
    • C:\ ipconfig (Press enter)
    • C:\ ipconfig /all (Press enter)
Mkdir or MD Command :
  • This command is used to create a new & blank directory in the current working directory with unique name.
  • Syntax: 

C:\ mkdir directory_name(Press enter)

C:\ md directory_name(Press enter)

  • Example : 

C:\ mkdir India (Press enter)

C:\ md India (Press enter)

More Command :
  • More command is used to display information or file contents to be displayed one page at a time.
  • Example:
    • C:\dir | more (Press enter)
    • C:\file1.txt | more (Press enter)
Move Command :
  • This command is used to cut/move a complete file from one location to another.
  • This command is also used in renaming the files, sub-directories and directories.
  • Syntax:
    • C:\ move source_file_name destination (press enter)
    • C:\ move old_file_name new_file_name (press enter)
  • Example:

C:\ move file1.txt d:\new folder (press enter)

C:\ move *.txt f:\new folder1 (press enter)

Net Command :
  • Net command is used to manage, set, view and determine network settings.
  • Example:
    • C:\net view (Press enter)
    • C:\net config (Press enter)
Netstat Command :
  • Netstat command is used to display the TCP/IP network protocols statistics and information.
  • Example:
    • C:\netstat (Press enter)
    • C:\netstat -a (Press enter)
Ping Command :
  • Ping command is used to determine whether the network is able to communicate with the network or not. 
  • Syntax:
    • C:\ping IP_address/web_address (Press enter)
Prompt Command :
  • Prompt command is used to change the MS-DOS prompt letter.
  • Syntax:
    • C:\prompt normal_text (Press Enter)
  • Example:
    • C:\prompt raj (Press Enter)
    • raj_
  • Some special characters are not used as prompt using normal characters rather it is used specifically such as for –
    • equal sign(=) use $Q.
    • dollar sign ($) use $$
    • Current time use $T
    • Current date use $D
    • Current drive use $N
    • Pipe symbol (|) use $B
    • Greater than symbol (>) use $G
    • Smaller than symbol (<) use $&
  • Type PROMPT without parameters to reset the default prompt again.
RM command:
  • Remove command is used to remove files permanently from a directory.
  • This command works similar as Del/Erase command.
  • Syntax:

C:\rm filename (Press Enter)

  • Example:
    • C:\rm File1.txt (Press Enter)
    • C:\rm *.txt (Press Enter)
Rmdir/RD Command :
  • This command is used to remove a blank directory from the root/parent/current working directory.
  • Syntax: 

C:\ rd directory_name(Press enter)

  • Example: 

C:\ rd folder1(Press enter)

Ren/Rename Command :
  • Ren command is used to rename files and directories from the original name to a new name.
  • Unlike the move command, this command cannot be used to rename sub-directories or rename file across drivers or cannot specify a new drive etc.
  • Syntax:
    • C:\ren directory_name or File_name (Press enter)
  • Example:
  • C:\ ren raj raj1 (press enter)
  • C:\ ren *.txt *.bak (press enter)
  • C:\ ren file1.txt file2.txt (press enter)
Sfc Command :
  • Sfc command scans all protected system files and replaces incorrect versions with correct Microsoft versions.
  • This is a great command to run when we are running into an issue that is difficult to troubleshoot.
  • Syntax:
    • C:\ sfc (press enter)
  • Example:
    • C:\ sfc (press enter)
    • C:\ sfc /SCANNOW (press enter) [Scans all protected system files immediately.]
    • C:\ sfc /SCANONCE (press enter)[Scans all protected system files once at the next boot.]
    • C:\ sfc /SCANBOOT( press enter) [Scans all protected system files at every boot.
Systeminfo Command :
  • This command displays the complete system information for installed OS and network hardware used in our computer.
  • Syntax & Example:
    • C:\ Systeminfo (press enter)
Time Command :
  • Time command is used to allow the user to view and edit the computer’s time.
  • Syntax:
    • C:\time
  • Example:
    • C:\time (press enter)
      The current time is: 11:12:49.96
      Enter the new time:
Title Command :
  • Title command enables a user to change the title of their MS-DOS window i.e., sets the window title for the command prompt window.
  • Syntax:
    • C:\Title String (press enter)
  • Example:
    • C:\ Title Window DOS (press enter)
Tree Command :
  • Tree command is used to allow the user to view a listing of files and folders in an easy-to-read listing mode.
  • It usually lists in tree form of the current drive files and folders.
  • To stop the Tree view in the middle of the screen, press Ctrl+C.
  • Syntax:
    • C:\Tree Drive_letter (press enter)
  • Example:
    • C:\Tree (press enter)
    • D:\Tree (press enter)
Type Command :
  • Type command allows the user to see the contents detail of a file.
  • Syntax:
    • C:\Type filename (press enter)
  • Example:
    • C:\Type file1.txt (press enter)
    • C:\Type D:\file2.txt (press enter)
Ver Command :
  • Ver command is used to displays the version of MS-DOS or if running Windows 95 or above the version of Windows.
  • Syntax:
    • C:\ver (press enter)
  • Example:
    • C:\ver (press enter)

      Microsoft Windows [Version 10.0.17763.3770]

Vol Command :
  • Vol Command is used to display the volume information about the designated logical drive.
  • Syntax:
    • C:\vol (press enter)
  • Example:
    • C:\vol (press enter)
      Volume in drive C is WIN 10 OS NEW
      Volume Serial Number is K2E7-X516
Xcopy Command :
  • Xcopy Command is used to copy one or more files and directories including sub-directories from one location to another.
  • Syntax:
    • C:\Xcopy sourcefile destinationfile (press enter)
  • Example:
    • C:\Xcopy c:\dirname1 d:\ (press enter)

MS DOS File System

  • The booting process of DOS involves three main system files of DOS into memory. These files are IO.SYS, MSDOS.SYS and COMMAND.COM.
  • The operating files of MS DOS are broadly categorized into –
    • System files
    • Command-line Interpreter/Shell file
    • User Configuration files
System files
  • System files are high priority files performing system tasks.
  • System files may be a plain text file or binary(bin) files.
  • There is no way to open a .sys file. It’s a driver file that is processed by an OS automatically.
IO.SYS (or IBMBIO.COM) file:
    • It was an essential part of MS-DOS and Windows 9x systems but is not used in newer versions of Windows. 
    • IO. SYS is an Input- Output System files.
    • IO. SYS is a hidden, executable, binary file which processes instructions when the operating system is booted.
MSDOS.SYS (or IBMDOS.COM) file:
    • This file contains the DOS kernel which is the main components of DOS OS.
    • This file manages the hardware, device drivers, file & directory management, memory & program management.
Command-line Interpreter/Shell 
  • Command COM file :
    • COMMAND.COM file is responsible for user’s command (Interactive mode) and batch files (Batch mode) interpreter. Hence, this file is called the default command line interpreter for MS-DOS, Windows 95, Windows 98 and Windows Me OS.
    • This file uses the DOS API to communicate with the disk operating system.
    • Internal commands reside in the COMMAND.COM file as binary file.
    • It is also called MS DOS Prompt.
User Configuration files
  • CONFIG.SYS File: 
    • CONFIG.SYS means Configuration System file.
    • It is a text file that contains commands and instructions (i.e. settings) to load drivers, shell, buffers etc. for a DOS system.
    • This file is also used to load programs in memory to manage memory, hardware, printer, mouse, keyboard and other peripherals.
    • It is executed during system boot.
    • After executing the command of the config.sys file, the autoexec.bat file is executed.
    • This is a primary or main configuration file for OS/2 and DOS OS.
    • The CONFIG.SYS file is read every time when a DOS system is booted. The system then reads that file and executes the command following it.
    • Users can easily make changes in this file, if required, as per their requirements in the system by simply saving the changes made in the CONFIG.SYS file. Since it is a text file, it can be edited it in any simple editing program.
    • This file is located in the root directory of the drive; from where system is booted.
    • The most common commands of the CONFIG.SYS file are:
      • BUFFERS = This command is used to specify the buffer size.
      • FILES = This command is used to determine the number of files that a user can open simultaneously.
  • AUTOEXEC.BAT
    • This is a special plain-text batch file that is executed after system boot.
    • With the help of this command, we can run commands, programs and batch files automatically at the time of startup or booting of the system, by adding them to this file.
    Categories: DOS

    0 Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.