Log in ....Tribune


Dot.ComLatest in ITFree DownloadsOn hardware

Monday, August 6, 2001
Software

DOS has command interpreter
Sarabjeet Singh Kanwal

DISK Operating System (DOS), made by Microsoft is a powerful operating system, especially in case when you are in a process of installing other operating system on your system. DOS is included in syllabus of most of the university courses; often the beginners find confusion with some simple concepts and commands of it. Here, we remove those confusions and teach some common commands and concepts.

Case insensitive: DOS is not case sensitive. You can use either upper case or lower case for commands and file names.

CUI and GUI: DOS uses character user interface (CUI), i.e. we give command by using characters and get output in the form of characters. Characters act as interface between user and computer. Windows has graphical user interface (GUI), i.e. picture, graphics and icons act as interface between user and computer.
File and directory (or folder): A file is to store data, music, picture or movie. A folder is a group of files. It contains files and subfolders. The subfolders may contain files and further subfolders.

 


File name: A file name consists of 1-8 characters. File name contains an extension with 1-3 characters. Space and some special characters like "*" are not allowed within a file name. Extension is optional. Windows operating system allows file name having more than 8 characters and extension more than 3 characters and space.

Significance of file extension: A file extension specifies the type of file. Here are some common extensions used in DOS and Windows and their description in braces:

bat (batch file of DOS), exe (program file), com (program file), txt (text file), jpeg, gif, pic, bmp, tiff (all picture files), avi, mpg, dat (all movie files) wav, mp3 (music files), htm, html (web pages), fla (flash files), doc (word documents), c (source code of C-language), obj (compiled C-file) , java (Java source code), class (Java byte code), xls (excel file), ppt (power point file), cdr (Corel Draw file).

"Copy con" and "Md": "Copy con" command creates a file and "md" command makes a directory.

Cd: This command is used to change directory in various ways in different scenarios. "cd <foldername>" is used to enter into a folder. "cd.." is used to come out of a folder and reach its immediate parent folder. Now, suppose your current position is "c:\ dos\ abc\ xyz\ pqr". You want to go to "c:\ dos\ abc", you can do so by using "cd.." twice or by "cd…" only once. To go to "c:\ dos\ bill" from "c:\ dos\ abc", the command used is "cd..\ bill". This command has used relative path technique. We have specified location of bill folder with respect to current folder. "cd..\ bill" command directs computer to come one step out from current position (i.e. to c:\ dos) and then enter bill folder. To go to root directory (i.e. c:\ ) from any folder (e.g.: from c:\ dos\ abc\ xyz\ pqr) in a single step, use "cd\ ". From root directory, you can use "cd dos\ abc\ xyz\ pqr" to reach there in a single step.

Rd, del, deltree: Del command is used to delete a file. Rd is used to delete a folder. Rd command will work if and only if the folder to be deleted is empty. Now, suppose you have to delete a folder "c:\ abc". Most of the users make a funny mistake while using rd command here. They enter into folder abc and give command "rd abc". Since you won’t destroy a room while sitting inside it, similarly no folder can be deleted without coming out of it. In this case, use "rd abc" command from immediate parent folder i.e. from root. Deltree is also used to delete a folder. It will delete all files and subfolders present in that folder.

Front slash (/) and back slash (\ ): Front slash is used for switches. A switch is used with a command so that the command may behave in a particular way. For example, "dir/p" will show contents of a folder with a pause. "/p" is called a switch. DOS allows the usage of multiple switches. We can write "dir/p/s". Back slash is used for path statements in DOS and Windows operating systems. For example we use c:\ dos. In UNIX operating system, front slash is used for path statements. Hence, when we make an HTML document for UNIX based web server, we use front slash for path statements.

Copy, xcopy, move and ren: Copy command is used to copy a file to a new destination. The original (source) file remains unaltered at its position. Move command deletes a file from its original position and shifts it to a new location.

Both commands have similar syntax:

"Copy [source file] [destination]"

"Move [source file] [destination]"

Move is also used with a folder to rename it. The syntax is:
"Move abc xyz"

This command will rename folder abc to xyz. Ren command is used to rename a file. To rename file abc.txt to xyz.txt, following command is given: "Ren abc.txt xyz.txt."

Xcopy command has similar syntax like copy command. It also copies subfolders if we apply "/s" switch to the command.

Diskcopy and diskcomp: Diskcopy command will copy contents one floppy to another floppy. The condition is that both floppies must have same capacity. The syntax is:

Diskcopy a: a:
First we insert source floppy into floppy drive (a:) and then destination floppy in same drive as prompted by the system. Destination floppy can be compared by with source floppy by using diskcomp command in similar way. The syntax is:

Diskcomp a: a:

Fc: This command compares two files to check whether they are perfectly same or different. The syntax is:

Fc dos\ abc.txt windows\ map.txt

Executable files: An executable file is that file which contains a program, which is executed in an operating system. The program runs in DOS by writing the file name and pressing enter key. It runs in Windows by double clicking the file name/icon. There are three types of executable files. They have extension exe, com and bat. The exe and com files are made using different programming languages. Bat files are made in DOS using "copy con" or edit command. A bat file contains a group of DOS commands, which execute one by one in a particular sequence. A simple bat file (say abc.bat) may contain following commands:

Dir/p
pause
type file1.txt
pause
doskey

Each commands is written in a different line.

Path:

Path is a variable, which describes location of various folders on a computer, where the operating system (OS) should search for executable files. Suppose you have a DOS-based game - Pcman.com in games folder. To run this game, first you have to go to games folder, then type Pcman and press enter. If you give command "Path c:\ games", you need not go to games folder. You can run the game from any folder by typing Pcman and pressing enter.

Make a list of all the folders, where you have placed frequently used executable files. Include path of all these folders in path command separated by semicolons as described below:

Path c:\ ;c:\ dos;c:\ windows\ command;c:\ games;c:\ java\ bin

If you include this command in your autoexec.bat file, the search path will be set automatically whenever you start your PC. After setting path, whenever you type Pcman and press enter from any folder, following incidents occur:

1) OS will look for presence of file Pcman with extension exe, com or bat in current folder but can't find it out.

2) OS will look for presence of the same file in all the folders mentioned in path command. It finds a file Pcman.com in games folder and runs it.

Type "path ;" to clear all search-path settings and direct OS to search only in the current directory. Type "path" without parameters to display the currently set search-path.

Internal and External commands: DOS come with inbuilt command interpreter called command.com. This interpreter understands only some DOS commands called internal commands. The commands not understood by DOS interpreter are known as external commands. External commands are present in form of exe and com files. These files are present either in c:\ dos folder or in c:\ windows\ command folder. Command.com is always resident in memory. It makes internal commands available all the time. External commands need the presence of their exe or com file and proper path setting to the folder in which they are located, lest you will get "Bad command or file name" error.

Bootable disk: Any disk (floppy, hard disk or compact disk) that contains files to start (boot) computer is known as bootable disk. A bootable disk contains 3 system files — Io.sys, Msdos.sys and Command.com. To make a disk bootable, "sys" command is used. The syntax is:
Sys c: a:

Where c: is the source disk that already contains 3 bootable files. The command will make disk a: bootable.

It is always recommended to keep a few bootable floppies with you. In case of failure to boot from hard disk, a bootable floppy will help to start the system. Besides system files, it is good to keep autoexec.bat, config.sys, scandisk.* and anti-virus files in a bootable disk. These files will help you to customise your system and remove disk errors and viruses. A bootable floppy should be made write protect by sliding down a small switch present at the bottom left of the floppy. Making write protect ensures protection from viruses. Booting from a virus infected floppy may prove fatal, as it may infect all other programs running in the memory. Note down the number of bytes occupied by command.com file. Any change in number of bytes of this file may be a sure indication of virus infection.

Doskey

This command makes DOS user friendly. It allows you to repeat previous commands without retyping them. To install doskey, type "doskey" at DOS prompt and press enter key. You will get a message "doskey installed". After that, you won’t need to retype commands. You will get previous commands by pressing up arrow and down arrow keys. Try some other options by pressing F7 and F9 keys yourself.

For more knowledge about any command, type "/?" after name of command and press enter at DOS prompt.


Home

Top