MSDOS Operations
The MSDOS operating system was one of the dominant operating systems until some years back. It is therefore essential for a person to understand certain operations in MSDOS because these operations from the base of other operations which are a click away in the windows operating system.
Some conventions are used while explaining the syntax of a command:
- If certain values are included in square brackets [] the values are optional. It means that it can be omitted while issuing the command. Example [-V]
- The values enclosed within <> and in italics are those values that need to be specified by the user. Example <<drive name>
The MSDOS command can be classified in two categories:
- Internal commands
- External commands
Internal Commands
MSDOS command for which the specifications are available in COMMAND.COM system file are called external command like DIR, CLS, TYPE etc.
External Commands
MSDOS command for which the specifications are available in form of separate files are called external commands like CHKDSK, LABEL etc.
![Opening-Screen-of-MSDOS](https://protechnoinfo.com/wp-content/uploads/2023/09/Opening-Screen-of-MSDOS-1.png)
Directory Commands
The directory commands are the commands that are required while working with directories. Some common commands are CHDIR, MKDIR and RMDIR
The DIR Command
- Purpose
The DIR command is used to view the contents of a disk. Figure 2.3 gives the result of issuing the dir. command.
- Syntax
DIR[<drive name>][<path name>][options]
- Comments
-
- This command, as can be seen in figure gives the file size, date and time of the creation/modification of the file or the directory.
- If <DIR> is included against a name, it means that the name specifies a directory.
- This command also gives the disk space occupied by the contents of the directory and the total free space.
- The volume label is displayed in the first line. In this example, it is ITC.
- The path name that is specified in the command is also displayed in the third line. In figure it can be seen as Directory of C:\
- Options with DIR
DIR / P List the contents full screen at a time
DIR / W List the names of files and directories in multiple Columns.
DIR / AH List the hidden contents
DIR / O [N, S, D, G] List the contents in sorted manner of name, size, Date / time,
grouping of files Place (-) sign for descending order
![Output of the DIR Command](https://protechnoinfo.com/wp-content/uploads/2023/09/DIR-command.png)
The MKDIR or MD Command
- Purpose
This command is used to make a new directory.
- Syntax
MD [<drive name>][<path name>]<directory name>
- Comments
- Multilevel directory structure can be created with this command.
- Wildcard characters cannot be used with this command
- If the drive and the path name are omitted, the new directory is created under the current directory
- Examples:
MD mydir
MD c:\mydir\dir1
The RMDIR or RD Command
- Purpose
This command is used to remove a directory from the multilevel directory structure.
- Syntax
RD [<drive name>] [<path name>]<directory name>
- Comments
- Wildcard characters cannot be used with this command.
- If the drive and the path name are omitted, the directory that has to be removed is searched in the current directory.
- This command can remove a directory that is totally except for the “.” and “..” shorthand symbols.
- Examples
RD mydir
RD c:\mydir\dir1
The CHDIR or CD Command
- Purpose
This command is used to change the working directory.
- Syntax
CD [<drive name>] [<path name>] <directory name>
- Comments
- The drive and the path name can be replaced by “..”, this means that the working directory will be set to the parent of the previous working directory.
- The two dots explained above can be replaced with more dots. The number of dots. The number of dots specifies the number of levels you want to jump to. For example, let use consider that our working directory is “c:\mydir\letters\may”. If we specify “CD..” , then our working directory will be “c:\mydir\letters”. On the other hand, if we specify “CD…”, the working directory will be “c:\mydir”
- Wildcard characters cannot be used with this command.
- The command “CD\” changes the working directory to the root directory.
- Examples
CD mydir
CD c:\mydir\dir1
CD..
CD\
File Commands
These are the commands that are used for managing the files. Some common commands are COPY, DEL, REN etc.
The COPY Command
- Purpose
This command is used to create a new file as well as is used to copy one or more files on the same or different path/disk. Before copy command, the DIR command can be issued to view the contents of the directory. The same can be done after the copy command. It is also used to combine or concatenate contents of two or more files.
Creating a new files:
- Syntax
COPY CON [<drive name>] [<path name>] <file name>
- Comments
- The drive and the path name can be ignored if file has to be created in the working directory.
- Wildcard characters cannot be used with this command.
- The command “COPY CON” overwrites the file if it is already been created and gives an error message if a directory exists with that name.
- Examples
COPY CON ITC
COPY CON c:\mydir\ITC
Copying files:
- Syntax
COPY [<path name>] <source file name> [<path name>] <destination file name>
- Comments
- Wildcard characters can be used with the copy as and when necessary,
- The first parameter specifies the source file(s) that has to be copied. If the path of the source file is omitted then the operating system assumes that the file is in the current directory.
- The second parameter specifies the destination file name. If the path is omitted, the destination file is created in the current directory.
- The copy command also allows appending files. To do this the files that are to be appended must be separated with a plus (+) sign.
- Examples
COPY file1.dat c:\mydir
COPY c:\ file1.dat c:\data\file1.dat
COPY names1.txt + names2.txt + names3.txt allnames.txt
The TYPE Command
- Purpose
The purpose of this command is to display the contents one or more text files specified by the drive and pathname.
- Syntax
TYPE [<drive name>] [<path name>] <file name>
- Comments
- Wildcard cannot be used with this command.
- If the type command is used with a file that has tabs. then the tabs are expanded to 8 spaces wide.
- This command, when used with binary files, shows strange characters.
- Examples
TYPE ITC
TYPE c:\mydir\ITC
![Output of the TYPE command](https://protechnoinfo.com/wp-content/uploads/2023/09/type.png)
The DEL or ERASE Command
-
Purpose
The purpose of this command is to delete the file(s) specified by the drive and pathname.
- Syntax
DEL [<drive name>] [<pathname>] <file name>
- Comments
- Wildcard can be used to delete more than one file at a time.
- If *.* is given for file names, then all the files in the path will be deleted. This command will prompt “Are you sure?” before MSDOS actually deletes the files.
- Once deleted, a file cannot be recovered back.
- If no path is specified, the file will be searched in the current directory.
- Examples
DEL ITC
DEL c:\mydir\ITC
ERASE *. tmp
The REN Command
purpose
The purpose of this command is to rename one or more files specified by the drive and pathname.
Syntax
REN [<drive name > ] <file name > <new file name>
Comments
- Wildcards can be used with this command.
- This command renames all the files matching the first file name.
- This command ignores the pathname specified for the new file name.
Examples
REN ITC try.txt
The Move Command
purpose
The move command is used to move one or more files on the same or different path/disk.
Syntax
MOVE [<path name>] <source file name > [<path name>] <destination file name>
Comments
- Wildcard characters can be used with the move as and when necessary,
- The first parameter specifies the source file(s) that has to be moved. If the path of the source file is omitted then the operating system assumes that the files is in the current directory.
- The second parameter specifies the destination files name. If the path is omitted, the destination file is created in the current directory.
Examples
MOVE file 1. dat c:\mydir
MOVE c:\file 1. dat c:\data\files 1.dat
MOVE names 1. txt + names2.txt + names3.txt allnames.txt
Other commands
There are commands that are to be used for various other purposes. For example, commands are available to set the system date and time, changing volume label etc.
The CLS Command
purpose
This command is used to clear the terminal screen
Syntax
CLS
The DATE Command
purpose
This command is used to set the system date.
Syntax
DATE <date>
Comments
- The date that has to be entered must be in the format mm-dd-yy.
- The date, month and year can be separated by hyphen (-) or slash(/).
- MS-DOS automatically handles the date change and leap years.
Example
DATE
![Output of DATE command](https://protechnoinfo.com/wp-content/uploads/2023/09/DATE.png)
The TIME Command
purpose
This command is used to set the system time.
Syntax
TIME<time>
Comments
- The system time can be changed from the DOS prompt or from a batch file.
- MSDOS does not prompt for the time when this command is used in the autoexec.bat file.
- The time that has to be entered must be in the format hh:mm:ss:ms A or P.
- MS-DOS automatically handles the date changed and leap years.
![Output of Time command](https://protechnoinfo.com/wp-content/uploads/2023/09/time.png)
Example
TIME
The PROMPT Command
purpose
This command is used to changed the MS-DOS command prompt.
Syntax
PROMPT [<text>] [$<character>…]
Comments
- If the text and “$” characters are omitted, MS-DOS changes the prompt to default value that is the default value that is the default drive designation.
- The prompt can be customized to suit the user needs.
- The following “$” characters are possible:
$ The doller ($) character
T Current time
D Current date
P Working directory of the default drive
V Version Number
N Default drive
G The “>” character
L The “<” character
- Examples
PROMPT My command
PROMPT $p$g
PROMPT $t $d $p $g
PROMPT
The VER Command
- Purpose
This command is used to display the Operating System Version Number.
- Syntax
VER
- Comments
The operating system version is version is a sequence of numbers and characters which denotes the modifications from the previous version.
- Example
VER
The VOL Command
- Purpose
This command is used to display the volume identification label of the disk.
- Syntax
VOL
- Comments
The volume label of the disk is sequence of numbers and characters which denotes the name or label for the disk.
- Example
VOL
The LABEL Command
- Purpose
This command is used to create, change or delete the volume identification label on a disk.
- Syntax
LABEL [<drive>] [<label>]
- Comments
- The label name can be up to 11 characters in length.
- The label name may have spaces but not contains any symbol.
- When the label name is not specified in the command, MS-DOS prompts the user for label name.
- If no label is specified, a message appears for Delete current volume label (Y / N)?
- Examples
LABEL
![Output of LABEL command](https://protechnoinfo.com/wp-content/uploads/2023/09/label.png)
The PATH Command
- Purpose
When we give a command, the MS-DOS searches for the corresponding executable file in the current directory, it is often the necessity that certain commands need to be given from any directory. The executable file corresponding to these command search path. It means that if the executable file is not found in the working directory, it will be searched in the directories that are listed in the path.
- Syntax
PATH [<drive name>] [<path>] [:[<drive name>][<path>]…]
- Comments
- If the options are omitted, this command displays the current path.
- Null path can be set by the command path.
- Examples
PATH=c:\windows; c:\windows\command
PATH;
The PRINT Command
- Purpose
The purpose of this command is to print a text file on a printer.
- Syntax
PRINT [<drive>] [<pathname>]<filename> [/d:<device name>]
- Comments
- Wildcard can be used with this command.
- This command prints a file in the background. Other commands can be issued after issuing the print command.
- The print command prints to the printer attached to the computer by default. The /d option can be used to prompt the user to enter the print device. If no print device is specified, the default device PRN, which is the first parallel printer connected to the computer, is used.
- Examples
PRINT myprog.c
PRINT c:\mydir\myprog.c