WORKING IN DOS ENVIRONMENT


Disk Operating System in a Command Line Interface (CLI) based operating system introduced by Microsoft Cooperation in 1981. Disk Operating System was developed for IMB PC.
Nowadays Disk Operating System is not used in computer. Disk Operating System has been replaced by GUI based operating system. But still GUI based operating system provides facilities of MS-DOS commands. There are some programs they are still based on CLI.

To get the DOS environment i.e. Command prompt in the computer having operating system like Windows 98 or Windows XP, follows these steps.
  • Click on start menu.
  • Point to all programs, Accessories.
  • Click command prompt option.

You can also get DOS prompt (Command Prompt) where you follow these steps.
  • Click on start button.
  • Click on Run command. It open Run dialog box.
  • Type command in the text box if OS is Window 98.
Or,
  • Type cmd in the text box if OS is Windows XP.
In Dos environment, a folder is known as a Directory.

MS-DOS Commands
There are many DOS commands but you will learn very few DOS commands. Every DOS command has its syntax that tells how to write a command in proper order.

1. DIR Command
This command lists all the files and sub-directories of a drive or a directory.
Syntax:
DIR [Drive:][path][filename][/P][/S][/A][:] [Attributes][/O]
Where,
[drive:][path][filename] -------- Specifies drive, directory and files to list.
/P ----------------------------------- Pauses after the each screen full display.
/S ----------------------------------- Displays contents of subdirectories.
/O ----------------------------------- List files in sorted order.
The sorted orders are:
D ------------------------------------ by date and time
E ------------------------------------ by extension
N ------------------------------------ by name
S ------------------------------------ by file size
/A ----------------------------------- Display files with specified attributes.
The attributes are:
D ----------------------------------- Directories
R ----------------------------------- Read only files
H ----------------------------------- Hidden files
S ----------------------------------- System files

Examples:
C:\> DIR
This command lists all the files and directories in the drive C:.

C:\> DIR C:\Documents and Settings
This command lists all the files and directories of Documents and Setting directory.

C:\> DIR QBASIC
This command lists all the files and directories of QBASIC directory.

C:\> DIR/P
This command lists files of drive C pausing after a screenful display.

C:\> WINDOWS>DIR SYSTM\*.INI
Displays files having .INI extension of SYSTEM subdirectory of WINDOWS directory of drive C:

Note:
- A root directory is the initial directory or main directory. The disk drive is indicated as C: or D: which is called root directory.
- Asterisk (*) and question mark (?) are known as wild cards in MS-DOS.
- The asterisk (*) represents one or more characters in a file whereas question mark represents only one character in a file.


2. CD or CHDIR command
This command changes directory from one directory to another.
Syntax:
CD [drive:]
Or
CD … or CD\
Where,
Drive: refers to disk drive like C:, D: or A:
Path: refers to directory.

Examples:
C:\>Documents and Settings\Ratna> CD\
The prompt change to C:\>. It directly changes from any directory to the root directory.

C:\> Nepal>CD….
The prompt changes to C:\>. This indicates that now the working directory is drive C:.

C:\> CD QBASIC
Changes directory to QBASIC of drive C: i.e. C:\QBASIC>. Now QBASIC is the working directory.


3. CLS command
This command clear the screen.
Syntax: CLS


4. MD command
MD command is used to create a directory in a disk.
Syntax: MD [drive:]path

Examples:
C:\> MD Nepal
Creates a directory name Nepal in drive C.

C:\> QBASIC>MD Class
Creates a directory name Class in QBASIC directory of drive C.

C:\> Nepal>MD Koshi
Create a Koshi directory in Nepal directory of drive C.


5. RD command
This command removes an empty directory from a disk.
Syntax: RD[drive:]

Examples:
C:\> RD GAME
Deletes a directory name GAME from the root directory of drive C.

C:\> RD C:\Work\Homework
Deletes a directory Homework from Work directory of drive C.


6. DEL or ERASE command
DEL or ERASE command deletes a file or group of files.
Syntax:
DEL [drive:][path]filename

Examples:
C:\DEL C:\Windows\Temp*.*
Deletes all the files of Temp subdirectory of Windows directory of drive C.

C:\QBASIC>DEL A*.BAS
Deletes all files whose name start with ‘A’ and have extension. BAS from QBASIC directory of drive C.


7. REN or RENAME command
This command renames a file.
Syntax:
REN [drive:][path] old_filename New_filename

Examples:
C:\>REN Nepal.TXT NewNepal.TXT
Renames Nepal.TXT of drive C as NewNepal.TXT.

C:\>REN QBASIC\DIGITSUM.BAS NUMSUM.BAS
Renames DIGITUM.BAS of QBASIC of drive C as NUMSUM.BAS


8. TYPE command
This command displays the contents of a file.
Syntax:
TYPE[drive:] [path]filename

Examples:
C:\>TYPE BABU.txt
Displays the contents of BABU.txt file of drive C.

C:\>QBASIC>TYPE NUMSUM.BAS
Displays the contents of NUMSUM.BAS file of QBASIC directory of drive C.


9. COPY command
This command creates a duplicate of the original files.
Syntax:
COPY[Source-drive:][path]filename [Target_drive:][path]

Examples:
C:\>COPY NAYADESH.TXT D:\
Copies NAYADESH.TXT file of drive C to drive D.

C:\>COPY C:\QBASIC\*.BAS D:\
Copies all files having .BAS extension of QBASIC directory of drive C to drive D.


10. EXIT command
The EXIT command is used to exit from MS-DOS and return to Windows XP.
Syntax: EXIT

Examples:
C:\>EXIT
This exits from DOS environment.


Command

0 comments:

Post a Comment