0% found this document useful (0 votes)
70 views3 pages

MS-DOS Command Basics Manual

This document provides an overview of common MS-DOS commands. It describes how to open the command prompt, view and set the current drive, view directory listings and file contents, manage files and folders by copying, deleting, renaming them, create new folders, view and set the date and time, and more. The document also explains important concepts like the root directory, current directory, wild cards, and provides examples of using commands like DIR, TYPE, CD, MD, COPY, DEL, REN, and EXIT.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views3 pages

MS-DOS Command Basics Manual

This document provides an overview of common MS-DOS commands. It describes how to open the command prompt, view and set the current drive, view directory listings and file contents, manage files and folders by copying, deleting, renaming them, create new folders, view and set the date and time, and more. The document also explains important concepts like the root directory, current directory, wild cards, and provides examples of using commands like DIR, TYPE, CD, MD, COPY, DEL, REN, and EXIT.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CoSc-2042: Operating System MS DOS Lab Manual

MS DOS Commands

Introduction
MS DOS stands for Microsoft Disk Operating System. To open DOS command prompt select
Start|Programs||Accessories|Command Prompt
Or simply type command in the search box and press enter key
The Command Prompt you see on the screen might look like this:
C:\WINDOWS\system32>

Each disc drive attached to a computer system is identified by a name. In MS-DOS, the name
is a single letter followed by a colon. e.g. A:, C:. Traditionally, A: is a floppy drive while C:
is a hard disc drive. They are also described as Drive A and Drive C. The system prompt
C:\WINDOWS\system32> identifies the default drive as drive C. Unless a command
specifies otherwise, it is the default drive which is used by MS-DOS whenever a request to
use a file is received. As is usual in computing, there is alternative name for the default drive.
It is also known as the current drive.

To go to the root directory we use command cd\:


C:\WINDOWS\system32> cd\
The new screen will look like
C:\>

To change the default drive to drive D:, we type:


C:\> D:

The system prompt now changes to D:\>

VOL Command
The disc can be given a volume identification label (or volume for short) when the disc is
formatted. To see the volume of a disc type on the command prompt:
D:\>VOL

LABEL Command
This command is used to give name to the drive. This command prompts you for a name.
D:\>LABEL

Clearing the Screen


CLS command is used to clear the screen:
D:\>CLS

Setting the date and time


If you need to check the date and time you can use two commands: DATE and TIME.
D:\>DATE

Using the command DATE results in output like


Current date is: 23/09/2009
Enter new date (dd-mm-yy):

By [Link] Kumar Mishra Page 1- 1


CoSc-2042: Operating System MS DOS Lab Manual

Pressing <Enter> leaves the computer's version of the date as it is whilst typing 05-04-17
would reset the date to 5th April 2017.
Similarly the command TIME allows you to check and reset the time.
D:\>TIME

The directory
The command DIR will make a listing on the screen of the files on your disc.
D:\>DIR
The following command will display all files with txt extension
D:\>DIR *.txt
* is called a wild card character
Viewing the contents of a large directory
DIR /P causes the output to pause at the end of each screenful. The display will resume when
you press any key.
DIR /W causes the file names to be displayed. Directory names are shown surrounded by [ ]
brackets.
DIR C: causes the directory in drive C to be listed even though the default drive may be
drive A.

The TYPE command


Files containing text can be directly displayed on the screen using the TYPE command.
This command must be followed by the name of the file you want displayed. Not all file
names have an extension. However, if a file name includes an extension, it must be included
when using the TYPE command.
D:\> TYPE [Link]

Changing the current directory


As you can imagine, several layers of directories will lead to very long full names for files.
An alternative strategy is to change the current directory. To make EXERCISE the current
directory we use the command CD or CHDIR:
D:/>CD EXERCISE

CD stands for Change Directory


Notice that the prompt has changed to:
D:\EXERCISE>
The prompt is telling us the current directory along with the current drive.
Now that we are in the EXERCISE directory we can see the directory contents by just using
the command DIR.

Making a new directory


The command MD (standing for Make Directory) or MKDIR is used to make a new
directory. Thus the command:
D:\>MD UOG
will create a subdirectory UOG

Copying files
Copying files is usually a simple matter of creating a duplicate of a file in another directory.
You cannot create a duplicate in the same directory without renaming the file - otherwise the
operating system would not be able to distinguish between them. Sometimes copying files to

By [Link] Kumar Mishra Page 1- 2


CoSc-2042: Operating System MS DOS Lab Manual

another location on your disc makes sense. Perhaps you want to place a copy of a file in an
UOG directory while continuing to work on it in the current directory.
D:\>COPY [Link] [Link]

Deleting files
Files can be removed from a directory by using the DEL command:
D:\>DEL [Link]
removes [Link] from the current directory

To remove all the files in the current directory we use


D:\>DEL *.*
Since removing all the files in a directory is a drastic action, MS-DOS asks you if you are
sure you want to go ahead.

Removing directories
RD command is used to remove a directory. We can only remove directories which contain
no files. Thus to remove ARCHIVE might use this sequence of commands:
D:\>CD ARCHIVE
D:\>DEL *.*
D:\>CD .. (This command moves us up to the parent directory)
D:\>RD ARCHIVE

Renaming a File
We use the RENAME command (REN for short) to change the name of a file. The general
format is:
D:\>REN {oldname} {newname} {ENTER}
e.g.
D:\> REN [Link] [Link]
Will rename file [Link] to [Link]
This will not work if a file with the new name already exists in the current directory.

Exit the Command Prompt


We use the EXIT command to close the command prompt:
D:\>EXIT

By [Link] Kumar Mishra Page 1- 3

Common questions

Powered by AI

Changing directories in MS-DOS is accomplished using the CD (Change Directory) command. For example, entering D:\>CD EXERCISE changes the current directory to EXERCISE, making the prompt D:\EXERCISE>. The system prompt reflects this change by showing the current path, ensuring users know their exact location within the directory structure. This visual cue facilitates file management and navigation, as it constantly updates to display the active directory, thus serving as an ongoing reference for the user's current working context .

Before using the RD (Remove Directory) command in MS-DOS, it must be ensured that the directory is empty, meaning it contains no files. This requirement is necessary because RD cannot remove directories with contents, as this could lead to accidental data loss. Therefore, users typically use the DEL command to clear files within the directory first. This stepwise approach prevents accidental deletion of files and maintains data integrity during directory operations .

MS-DOS determines the default drive by associating it with the system prompt. The default or current drive is the one indicated by the system prompt, such as C:\WINDOWS\system32>, where 'C' represents the default drive. This means that any command executed without specifying a different drive will utilize the default drive. The significance of the system prompt is to provide users with a reference to the current working directory or drive, ensuring that they know where commands will operate unless explicitly stated otherwise .

When using the DEL command, the critical steps include determining the specific files to remove and confirming the deletion, particularly with DEL *.* which deletes all files. This specific command prompts user verification due to its drastic nature, since executing it without caution can lead to comprehensive data loss. The key challenge is ensuring that only intended files are targeted for deletion, necessitating careful review to safeguard against unintentional erasure of critical data .

Wild card characters such as '*' play a crucial role in MS-DOS commands like DIR, affecting file selection by allowing users to specify multiple files or a group of files based on patterns. When employed, a command like DIR *.txt will list all files with a .txt extension in the current directory. This flexibility enables efficient handling of file operations without manually specifying each file, significantly enhancing productivity and simplifying tasks involving numerous files with common characteristics .

The DATE and TIME commands in MS-DOS are used to view and adjust the system's date and time settings. The commands prompt the user with the current settings and request confirmation for changes. To prevent unintentional alterations, pressing <Enter> without entering new values retains the current date or time, serving as a safeguard against accidental modifications. This user confirmation mechanism helps maintain system accuracy while offering flexibility .

The COPY command in MS-DOS duplicates a file and places it in a specified location, potentially renaming it to avoid conflicts in the same directory. For instance, copying HELLO.TXT to HELLO1.TXT ensures each file remains distinct. If both files had identical names, the operating system couldn't differentiate between them, leading to errors during subsequent file operations. By employing different names, MS-DOS preserves the integrity of file operations and avoids overwriting issues, facilitating consistent data management .

In MS-DOS, the DIR command is used to list the contents of a directory. Adding the /P option pauses the output at the end of each screenful of data, requiring user input to continue; this is useful for long listings. Without /P, the data scrolls continuously. By using specific options like /W, the display format changes to a wider view, showing file names in rows. These options customize how the directory contents are displayed, facilitating better user navigation and data comprehension .

Renaming a file to a name already existing in the same directory is not permitted in MS-DOS as it would create ambiguity, with the system unable to distinguish between files sharing an identical name. This constraint prevents potential overwriting and ensures that every file retains a unique identifier within its directory, preserving data integrity and preventing accidental data loss. This rule upholds orderly file management by avoiding actions that could compromise file accessibility or configurations .

Changing the current drive in MS-DOS, done using commands like D: to switch to drive D, alters the focus of subsequent commands, making the new drive the default for file operations unless otherwise specified. This shift means that commands targeting files or directories default to this new drive, impacting workflows by requiring users to adjust their commands if operations need to be conducted on a different drive. Mismanagement of current drive context can lead to errors in file access or modifications, highlighting the importance of context awareness in operations .

You might also like