Technical Fresh Guru

Technical Fresh Guru

MS-DOS Operating System | External Commands

 

In this post, we discuss on External Commands of the MS-DOS Operating System step-by-step. 

We’ll discuss and cover the above topic: Vist my “MS-DOS Operating System Playlist” videos on our youtube channel.

MS-DOS Complete Course

Explore to All MS-DOS Lessons:


Let’s go started!

External Commands

External commands in MS-DOS are commands that are not built
into the operating system and are typically stored in separate executable
files. These commands can be used to perform various functions, including file
management, system management, and data management.

External Commands with Examples and Syntax

Here are some of the most commonly used external commands in MS-DOS, along with their syntax and examples:

Format Command

The “format” command is a common external command
in MS-DOS that is used to format a disk for use with MS-DOS. The format command
can be used to format floppy disks, hard disks, and other removable media. The
syntax for the format command is as follows:

FORMAT drive: [/V[:label]] [/Q] [/F:size] [/C] [/X]

where:

drive: is the letter assigned to the drive you want to
format (e.g., A, B, C, etc.).

/V[:label] is an optional switch that allows you to specify
a volume label for the disk. The label can be up to 11 characters long and must
not contain any spaces.

/Q is an optional switch that performs a quick format. This
switch skips the check for bad sectors and is faster than a regular format, but
may result in less reliable disks.

/F:size is an optional switch that allows you to specify the
size of the disk to be formatted. The size can be either 360K, 720K, 1.2M,
1.44M, 2.88M, or larger for hard disks.

/C is an optional switch that allows you to format multiple
diskettes by automatically requesting you to insert new diskettes as needed.

/X is an optional switch that forces the format command to
dismount the drive if it is in use, which allows you to format the disk even if
files are still open.

Example:

FORMAT C: /V:MYDISK /Q

This example formats the C: drive, assigns the volume label
“MYDISK” to the disk, and performs a quick format.

 Xcopy Command

The “xcopy” command is a commonly used external
command in MS-DOS that is used to copy files and directories from one location
to another. The xcopy command is more advanced than the basic “copy”
command, as it allows you to copy entire directories, subdirectories, and all
their contents, in addition to individual files. The syntax for the xcopy
command is as follows:

XCOPY source destination [/A | /M] [/D[:date]] [/P] [/S]
[/E] [/V] [/W]

where:

Source is the location of the files or directories you want
to copy.

Destination is the location where you want to copy the files
or directories.

/A is an optional switch that allows you to copy only those
files with the archive attribute set.

/M is an optional switch that allows you to copy only those
files with the archive attribute set and then resets the archive attribute.

/D[:date] is an optional switch that allows you to copy only
those files that have been modified on or after the specified date.

/P is an optional switch that prompts you to confirm that
you want to overwrite an existing file.

/S is an optional switch that allows you to copy
subdirectories, in addition to files.

/E is an optional switch that allows you to copy directories
and subdirectories, including empty ones.

/V is an optional switch that verifies the copy operation by
comparing the source and destination files after they have been copied.

/W is an optional switch that causes the xcopy command to
wait for you to insert a disk when the disk becomes full during the copy
operation.

Example:

XCOPY C:data D:backup /S /E /V

This example copies all files and subdirectories from the
C:data directory to the D:backup directory, including empty directories, and
verifies the copy operation by comparing the source and destination files after
they have been copied.

Sort Command

The “sort” command is an external command in
MS-DOS that is used to sort the contents of a text file. The sort command reads
the contents of a file and sorts its lines in a specified order, such as
alphabetically or numerically, and then outputs the sorted contents to the screen
or to another file.

The syntax for the sort command is as follows:

SORT [/R] [/+n] [/M n] [drive:][path]filename

where:

/R is an optional switch that sorts the lines in reverse
order.

/+n is an optional switch that specifies the starting
character position for the sort.

/M n is an optional switch that specifies the maximum number
of characters to sort on.

[drive:][path]filename is the location of the file you want
to sort.

Example:

SORT C:datanames.txt /R > C:sortednames.txt

This example sorts the contents of the file
C:datanames.txt in reverse order and outputs the sorted contents to a file
named C:sortednames.txt.

Find Command

The “find” command is an external command in
MS-DOS that is used to search for a specified string of text within one or more
files. The find command searches through the contents of a file, line by line,
and outputs any lines that contain the specified text.

The syntax for the find command is as follows:

FIND [/V] “string” [drive:][path]filename

where:

/V is an optional switch that reverses the search and
returns lines that do not contain the specified string.

“string” is the text string you want to search
for.

[drive:][path]filename is the location of the file or files
you want to search.

Example:

FIND “John” C:datanames.txt

This example searches for the string “John” within
the file C:datanames.txt and outputs any lines that contain the string.

CHKDSK
(Check Disk) Command

The “chkdsk” command is an external command in
MS-DOS that is used to check the integrity of a disk and repair any errors it
finds. The chkdsk command scans the disk and identifies any bad sectors, lost
clusters, and other disk errors. If errors are found, chkdsk attempts to repair
them.

The syntax for the chkdsk command is as follows:

CHKDSK [drive:] [/F] [/V]

where:

[drive:] is the drive you want to check (for example,
“C:”).

/F is an optional switch that causes chkdsk to fix any
errors it finds.

/V is an optional switch that displays the name of each file
as it is checked.

Example:

CHKDSK C: /F /V

This example checks the disk in drive “C:” for
errors and attempts to fix any errors it finds. The names of each file as it is
checked will be displayed on the screen.

Move Command

The “MOVE” external command in MS-DOS is used to
move one or more files from one directory to another or to rename a file or
directory.

Syntax:

MOVE [source] [destination]

Example:

MOVE C:old_folderfile.txt C:new_folderfile.txt

In this example, the file “file.txt” is moved from
the “old_folder” directory to the “new_folder” directory.
If a file with the same name already exists in the destination folder, it will
be overwritten. The source and destination parameters can also be used to
specify different drive letters.

It’s important to note that the MOVE command can only be
used to move files within a single file system, so it cannot be used to move
files between a floppy disk and a hard drive.

Diskcopy Command

The “DISKCOPY” external command in MS-DOS is used
to copy the contents of one floppy disk to another floppy disk. It is a disk cloning
utility that creates an exact copy of a disk, including all data and system
files.

Syntax:

DISKCOPY [source_disk] [destination_disk]

Example:

DISKCOPY A: A:

In this example, the contents of the floppy disk in drive A:
are copied to another floppy disk in drive A:. The source and destination disks
must be the same type of disk, such as both being 5.25-inch or 3.5-inch floppy
disks.

It’s important to note that DISKCOPY can only be used to
copy floppy disks and cannot be used to copy hard drives or other types of
storage media. Also, since the command is designed for floppy disks, it does
not provide any error correction or data compression features.

MS-DOS Complete Course

Explore to All MS-DOS Lessons:

Leave a comment