MS-DOS Basics - A Tutorial

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 56

MS-DOS Basics - A Tutorial

This tutorial gives you an opportunity to try basic MS-DOS commands. By following the
procedures in this section, you will learn to:
o View the contents of a directory
o Change from one directory to another
o Create and delete directories
o Change from one drive to another
o Copy files
o Rename files
o Delete files
o Format a floppy disk
The Command Prompt
When you first turn on your computer, you will see some cryptic information flash by.
MS-DOS displays this information to let you know how it is configuring your computer.
You can ignore it for now. When the information stops scrolling past, you'll see the
following:
C:\>
This is called the command prompt or DOS prompt. The flashing underscore next to
the command prompt is called the cursor. The cursor shows where the command you
type will appear.
Typing a Command
This section explains how to type a command at the command prompt and demonstrates
the "Bad command or file name" message.
To type a command at the command prompt
1. Type the following at the command prompt (you can type the command in either

uppercase or lowercase letters):


nul
If you make a typing mistake, press the BACKSPACE key to erase the mistake, and
then try again.
2. Press ENTER.
You must press ENTER after every command you type.
The following message appears:
Bad command or file name
The "Bad command or file name" message appears when you type something that MSDOS
does not recognize. Because nul is not a valid MS-DOS command, MS-DOS
displays the "Bad command or file name" message.
3. Now, type the following command at the command prompt:
ver
The following message appears on your screen:
MS-DOS version 6.22
Viewing the Contents of a Directory
In this section, you will view the contents of a directory by using the dir command. The
dir command stands for "directory."

To view the contents of a directory


1. Type the following at the command prompt:
dir
A list similar to the following appears:
Volume in drive C is MS-DOS_6.22
Volume Serial Number is lE49-15E2
Directory of C:\

WINDOWS <DIR> 09-08-92 10:27p


TEMP <DIR> 05-15-92 12:09p
CONFIG SYS 278 09-23-92 10:50a
COMMAND COM 53014 09-18-92 6:00a
WINA20 386 9349 11-11-91 5:00a
DOS <DIR> 09-02-92 4:23p
AUTOEXEC BAT 290 09-23-92 10:54a
7 file(s) 62931 bytes
8732672 bytes free
This is called a directory list. A directory list is a list of all the files and
subdirectories that a directory contains. In this case, you see all the files and
directories in the main or root directory of your drive. All the files and
directories on your drive are stored in the root directory.
Changing Directories
Look at the list on your screen. All the names that have <DIR> beside them are
directories. You can see a list of the files in another directory by changing to that
directory, and then using the dir command again. In this case, you will change
to the DOS directory.
Before you begin this section, make sure you have a directory named DOS by
carrying out the following procedure.
o To make sure you have a directory named Windows
1.If you do not see a line in the directory list indicating that you have a directory
named Windows, type the following at the command prompt:
dir /s Windows
You will see a message that includes a line such as the following:

Directory of C:\DIRNAME
o To change from the root directory to the WINDOWS directory
To change directories, you will use the cd command. The cd command stands for
"change directory."
1. Type the following at the command prompt:
cd windows
The command prompt changes. It should now look like the following:
C:\WINDOWS>
Next, you will use the dir command to view a list of the files in the DOS directory.
o To view a list of the files in the WINDOWS directory
1. Type the following at the command prompt:
dir
A list of the files in the WINDOWS directory appears, but scrolls by too quickly to read.
You can modify the dir command so that it displays only one screen of information at a
time.
o To view the contents of a directory one screen at a time
1. Type the following at the command prompt:
dir /p
One screen of information appears. At the bottom of the screen, you will see the
following message:
Press any key to continue . . .
2. To view the next screen of information, press any key on your keyboard.
Repeat this step until the command prompt appears at the bottom of your screen.
When you typed the dir command this time, you included the /p switch after the
command. A switch modifies the way MS-DOS carries out a command. Generally, a

switch consists of a forward slash (/) that is followed by one or more letters or numbers.
When you used the /p switch with the dir command, you specified that MS-DOS should
pause after it displays each screen of directory list information. The p actually stands for
"page"
Another helpful switch you can use with the dir command is the /w switch. The /w
switch indicates that MS-DOS should show a wide version of the directory list.
o To view the contents of a directory in wide format
1. Type the following at the command prompt:
dir /w
The directory list appears, with the filenames listed in wide format. Note that only
filenames are listed. No information about the files' size or date and time of creation
appears.
2. If the directory contains more files than will fit on one screen, you can combine the /p
and /w switches as follows:
dir /w /p
Changing Back to the Root Directory
Next, you will change from the DOS directory to the root directory. The root
directory is the directory you were in before you changed to the DOS directory.
Before you begin this section, make sure your command prompt looks like the
following:
C:\DOS>
o To change to the root directory
1. Type the following at the command prompt:
cd \
Note that the slash you type in this command is a backslash (\), not a forward

slash (/).
No matter which directory you are in, this command always returns you to the
root directory of a drive. The root directory does not have a name. It is simply
referred to by a backslash (\).
The command prompt should now look like the following:
C:\>
When your command prompt appears similar to this---that is, when it does not
contain the name of a directory---you are in the root directory.
Creating a Directory
In this section, you will create two directories. Creating a directory is helpful if
you want to organize related files into groups to make them easy to find. Before
you begin this section, make sure the command prompt looks like the following:
C:\>
To create a directory, you will use the md command. The md command stands
for "make directory."
o To create and change to a directory named FRUIT
1. Type the following at the command prompt:
md fruit
You have now creat ed a directory named FRUIT. You won't see the new FRUIT
directory until you carry out the dir command in the next step.
2. To confirm that you successfully created the FRUIT directory, type the
following at the command prompt:
dir
or
dir /p

Look through the directory list. A new entry somewhere in the list should look
similar to the following:
FRUIT <DIR> 09-25-93 12:09p
3. To change to the new FRUIT directory, type the following at the command
prompt:
cd fruit
The command prompt should now look like the following:
C:\FRUIT>
You will now create a directory within the FRUIT directory, named GRAPES.
o To create and work with a directory named GRAPES
1. Type the following at the command prompt:
md grapes
You will not see the new GRAPES directory until you carry out the dir command in the
next step.
2. To confirm that you successfully created the GRAPES directory, type the following at the
command prompt:
dir
A list similar to the following appears:
Volume in drive C is MS-DOS-6
Volume Serial Number is lE49-15E2
Directory of C:\FRUIT
. <DIR> 09-25-93 12:08p
.. <DIR> 09-25-93 12:08p
GRAPES <DIR> 09-25-93 12:10p
3 file(s) 0 bytes

11534336 bytes free


Note that there are three entries in the FRUIT directory. One is the GRAPES directory
that you just created. There are two other entries---one looks like a single period (.) and
the other looks like a double period (..). These directory entries are important to MSDOS,
but you can ignore them. They appear in every directory and cont ain information
relation to the directory structure.
The GRAPES directory is a subdirectory of the FRUIT directory. A subdirectory is a
directory within another directory. Subdirectories are useful if you want to further
subdivide information.
3. To change to the GRAPES directory, type the following at the command prompt:
cd grapes
The command prompt should now look like the following:
C:\FRUIT\GRAPES>
4. To switch back to the FRUIT directory, type the following:
cd ..
The command prompt should now look like the following:
C:\FRUIT>
When the cd command is followed by two periods (..), MS-DOS moves up one
level in the directory structure. In this case, you moved up one level from the
GRAPES directory to the FRUIT directory.
Deleting a Directory
If you no longer use a particular directory, you may want to delete it to simplify
your directory structure. Deleting a directory is also useful if you type the wrong
name when you are creating a directory and you want to delete the incorrect
directory before creating a new one.

In this section, you will delete the GRAPES directory. Before you begin this
section, make sure the command prompt looks like the following:
C:\FRUIT>
To delete a directory, use the rd command. The rd command stands for "remove
directory."
o To delete the GRAPES directory
1. Type the following at the command prompt:
rd grapes
2. To confirm that you successfully deleted the GRAPES directory, type the following at the
command prompt:
dir
The GRAPES directory should no longer appear in the directory list.
Note You cannot delete a directory if you are in it. Before you can delete a
directory, you must make the directory that is one level higher the current
directory. To do this, type cd.. at the command prompt.
Changing Drives
This section describes how to change drives. Changing drives is useful if you
want to work with files that are on a different drive.
So far, you have been working with driveC. You have other drives you can use
to store information. For example, drive A is your first floppy disk drive. The
files and directories on drive A are located on the floppy disk in the drive. (You
might also have a drive B, which contains the files and directories stored on the
floppy disk in that drive.)
Before you begin this section, make sure your command prompt looks like the
following:

C:\FRUIT>
o To change to and view files on a different drive
1. Insert a 3.5" floppy disk in drive A label- side up. Make sure the disk clicks
into the drive.
1. Type the following at the command prompt:
a:
Note that the command prompt changed to the following:
A:\>
This message may appear:
Not ready reading drive A
Abort, Retry, Fail?
If you see this message, the disk may not be inserted properly. Place the disk label-side
up in the disk drive, and make sure the disk clicks into the disk drive. Then, type r for
Retry. If this message appears again, press F for Fail, and then type b: at the command
prompt. If you no longer see this message, type b: instead of a: throughout the rest of the
tutorial.
There must be a floppy disk in the drive that you want to change to.
2. Change back to drive C by typing the following at the command prompt:
c:
Your command prompt should return to the following:
C:\FRUIT>
When you type a drive letter followed by a colon, you change to that drive. The drive
letter that appears in the command prompt shows which drive is the current drive. Unless
you specify otherwise, any commands you type are carried out on the current drive and in
the current directory.

So far, all the commands you typed were carried out on the current drive and in the
current directory. You can also carry out a command on a drive that isn't current. For
example, you can view the files on a disk in drive A without switching to drive A by
following this procedure.
o To view the contents of the WINDOWS directory on drive C
1. Type the following at the command prompt:
dir c:\windows
A list of the files in the DOS directory on drive C should scroll past on your screen.
Copying Files
This section describes how to copy a single file and a group of files. Copying files creates
a duplicate of the original file and does not remove the original file. This is useful for
many reasons. For example, if you want to work on a document at home, you can copy it
from your computer at work to a floppy disk and then take the floppy disk home.
To copy a file, you will use the copy command. When you use the copy command, you
must include two parameters. The first is the location and name of the file you want to
copy, or the source. The second is the location to which you want to copy the file, or the
destination. You separate the source and destination with a space. The copy command
follows this pattern:
copy source destination
Copying a Single File
In this section, you will copy the notepad.exe files from the WINDOWS directory to the FRUIT
directory. You will specify the source and destination of these files in two different ways. The
difference between the two methods is explained at the end of this section.
Before you begin this section, make sure the command prompt looks like the following:
C:\FRUIT>

To copy the NOTEPAD.EXE files from the WINDOWS directory to the FRUIT directory
1. Return to the root directory by typing the following at the command prompt:
cd\
The command prompt should now look like the following:
C:\>
Change to the DOS directory by typing the following at the command prompt:
cd windows
The command prompt should now look like the following:
C:\WINDOWS>
2. Make sure the file you are going to copy, NOTEPAD.EXE, is located in the WINDOWS
directory
by using the dir command followed by a filename.
dir notepad.exe
A list similar to the following appears:
3. To copy the NOTEPAD.EXE file from the WINDOWS directory to the FRUIT directory, type
the
following at the command prompt:
copy c:\windows\notepad.exe c:\fruit
The following message appears:
1 file(s) copied
4. To confirm that you copied the files successfully, view the contents of the FRUIT directory by
typing the following at the command prompt:
dir \fruit
You should see the file listed in the FRUIT directory.
Renaming Files

This section explains how to rename files. You may want to rename a file if the information in it
changes or
if you decide you prefer another name.
To rename a file, you will use the ren command. The ren command stands for "rename." When
you use
the ren command, you must include two parameters.
The first is the file you want to rename, and the second is the new name for the file. You separate
the two
names with a space. The ren command follows this pattern:
ren oldname newname
Renaming a File
In this section, you will rename the README.TXT file.
Before you begin this section, make sure your command prompt looks like the following:
C:\FRUIT>
1. To rename the NOTEPAD.EXE file to PADNOTE.TXT, type the following at the command
prompt:
ren notpad.exe padnote.txt
2. To confirm that you renamed the file successfully, type the following at the command prompt:
dir
Deleting Files
This section explains how to delete, or remove, a file that you no longer want on your disk. If
you dont
have very much disk space, deleting files you no longer use is essential.
To delete a file, you will use the del command. The del command stands for "delete."
Deleting a File
In this section, you will delete two files using the del command.
Before you begin, make sure your command prompt looks like the following:

C:\FRUIT>
To delete the PEARCOM and PEAR.HLP files
1. Delete the PADNOTE.TXT file by typing the following at the command prompt:
del PADNOTE.TXT
2. To confirm that you deleted the files successfully, type the following at the command prompt:
dir
Deleting a Group of Files
In this section, you will use wildcards to delete a group of files.
Before you begin this section, make sure your command prompt looks like the following:
C:\FRUIT>
To delete files in the current directory that end with the extension OLD by using wildcards
1. View all files that end with the extension OLD by typing the following at the command
prompt:
dir *.old
A list of all the files that end with the extension OLD appears. Make sure that these are the files
you want to delete. When you are deleting files by using wildcards, this step is very important. It
will prevent you from deleting files accidentally.
2. Delete all files ending with OLD by typing the following at the command prompt:
del *.old
3. To confirm that all the files with the extension OLD have been deleted, type the following at
the
command prompt:
dir
The FRUIT directory should contain no files.
Now that the FRUIT directory is empty, you can delete it by using the rd (remove directory)
command that

you learned to use in "Deleting a Directory" earlier in this chapter.


To delete the FRUIT directory
1. Return to the root directory by typing the following at the command prompt:
cd \
2. You can see the FRUIT directory in the directory list by typing the following at the command
prompt:
dir or dir /p
3. Remove the FRUIT directory by typing the following at the command prompt:
rd fruit
4. To verify that the FRUIT directory has been removed, type the following at the command
prompt:
dir or dir /p
The FRUIT directory should not appear in the directory list.
DOS COMMANDS
Basic DOS commands
To clear your screen (Type CLS to clear your screen)
C:\>CLS
Fast Help after each command types /? after each commands
C:\>DIR /?
File Management Commands
DIR - to display all your DOS directories
C:\>DIR
DIR switches
DIR switches in details
/P Pauses after each screenful of information.

/W Uses wide list format.


/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date & time (earliest first)
G Group directories first - Prefix to reverse order
A By Last Access Date (earliest first)
/S Displays files in specified directory and all subdirectories.
/B Uses bare format (no heading information or summary).
/L Uses lowercase.
/V Verbose mode.
/4 Displays year with 4 digits (ignored if /V also given).
Switches may be preset in the DIRCMD environment variable.
Override
preset switches by prefixing any switch with - (hyphen)--for example, /W.
To create a directory
C:\>MD or MKDIR example (we just created a directory called
example)
File Naming Convention
All DOS file names have a maximum length of 8 characters followed
by an optional extension with a maximum length of 3 characters.

Example: AUTOEXEC.BAT
The following characters are reserved and cannot be used in an
MS DOS environment
Colon:
Semicolon;
Slashes / \
Spaces
Greater than >
Less than <
Question mark?
Asterisk *
Period.
Dollar sign $
Quotes marks " "
Apostrophes ' '
Pipe sign |
Valid DOS names
AUTOEXEC.BAT, CONFIG.SYS, NAME.DOC, HELLO.TXT
Invalid DOS names
AUTOEXEC233.BAT, <Good>.EXE, NAME$. DOC
To remove a directory
C:\>RD or RMDIR example (removes the example directory)
To change a directory
C:\>CD or CHDIR example (press enter)
C:\>EXAMPLE ( I am now in the example directory)

To go back to the main C:\>


C:\>CD \
To move one level up
C:\>CD..
To remove a Directory and Subdirectory
C:\>DELTREE Example (removes the Example directory and its
subdirectories) (only DOS and Win9X)
C:\> RD /S Example (Windows 2K or XP)
To view the directory in hierarchical mode in DOS
C:\>TREE (only available in DOS 6.x, 2K and XP)
DATE (displays or sets the date)
C:\>DATE
TIME (displays or set the time)
C:\>TIME
VER (displays what version of DOS your running)
C:\>VER
VOL (displays the volume label of your disk)
C:\>VOL drive
LABEL (changes the label of your volume)
C:\>LABEL C: name
FORMAT (makes your drives usable)
C:\>format /?
Formats a disk for use with MS-DOS.
FORMAT drive: [/V[:label]] [/Q] [/F:size] [/B | /S] [/C]
FORMAT drive: [/V[:label]] [/Q] [/T:tracks /N:sectors] [/B | /S] [/C]

FORMAT drive: [/V[:label]] [/Q] [/1] [/4] [/B | /S] [/C]


FORMAT drive: [/Q] [/1] [/4] [/8] [/B | /S] [/C]
/V[:label] Specifies the volume label.
/Q Performs a quick format.
/F:size Specifies the size of the floppy disk to format (such
as 160, 180, 320, 360, 720, 1.2, 1.44, 2.88).
/B Allocates space on the formatted disk for system files.
/S Copies system files to the formatted disk.
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/1 Formats a single side of a floppy disk.
/4 Formats a 5.25-inch 360K floppy disk in a high-density drive.
/8 Formats eight sectors per track.
/C Tests clusters that are currently marked "bad."
FDISK (partitions your drives into sections)
C:\>fdisk /?
Configures a hard disk for use with MS-DOS.
FDISK [/STATUS] /X
/STATUS Displays partition information.
/X Ignores extended disk-access support. Use this switch if you
receive disk access or stack overflow messages.
To create a disk partition
Create Primary Partition first
Set Primary Partition as Active
Create Extended Partition

Create Logical Partition


To delete a disk partition
Delete the Non DOS Partition first if you have one in your drive
Examples
NTFS (Win 2K & NT)
NFS(UNIX/Linux)
HPFS (OS/2)
Delete the Logical Partition first
Delete the Extended Partititon
Delete the Primary Partition
EDIT (a text editor in DOS and use to configure files)
C:\>EDIT
C:\>edit /?
MS-DOS Editor Version 2.0.026 Copyright (c) Microsoft Corp 1995.
EDIT [/B] [/H] [/R] [/S] [/<nnn>] [/?] [file(s)]
/B - Forces monochrome mode.
/H - Displays the maximum number of lines possible for your
hardware.
/R - Load file(s) in read-only mode.
/S - Forces the use of short filenames.
/<nnn> - Load binary file(s), wrapping lines to <nnn> characters wide.
/? - Displays this help screen.
[file] - Specifies initial files(s) to load. Wildcards and multiple
filespecs can be given.
COPY (copies one or more files to another location)

C:>COPY example.txt EXAMPLE(example being a directory)


C:\>copy /?
Copies one or more files to another location.
COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination
[/A | /B]] [/V] [/Y | /-Y]
source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line
To append files, specify a single file for destination, but multiple files
for source (using wildcards or file1+file2+file3 format)
MOVE (to move a file)
C:\>MOVE example.txt NEW (moved the example.txt to the NEW
directory)
To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

[drive:][path]filename1 Specifies the location and name of the file


or files you want to move.
destination Specifies the new location of the file. Destination
can consist of a drive letter and colon, a directory
name, or a combination. If you are moving only one
file, you can also include a filename if you want
to rename the file when you move it.
[drive:][path]dirname1 Specifies the directory you want to rename.
dirname2 Specifies the new name of the directory.
/Y Suppresses prompting to confirm creation of a directory
or overwriting of the destination.
/-Y Causes prompting to confirm creation of a directory or
overwriting of the destination.
The switch /Y may be present in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.
DELETE or ERASE (deletes or erases the files)
C:\>DEL example.txt (WARNING once the files are deleted in DOS its
gone)
UNDELETE (undelete DOS files deleted before only available in
DOS 5.x and 6.x)
C:\>UNDELETE example.txt
RENAME or REN(renames a DOS file)
C:\>REN autoexec.bat autoexec.bak (this will rename autoexec.bat to
autoexec.bak)
XCOPY (copies directories and subdirectories to other

directories)
C:\>XCOPY EXAMPLE NEW (copies example directory into new
directory)
If no date is given, copies only those files whose
source time is newer than the destination time.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Updates the files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/Y Overwrites existing files without prompting.
/-Y Prompts you before overwriting existing files.

/N Copy using the generated short names.


To copy a floppy disk to another disk
C:\>DISKCOPY a: a: (copies source disk to target disk)
C:\>diskcopy /?
Copies the contents of one floppy disk to another.
DISKCOPY [drive1: [drive2:]] [/1] [/V] [/M]
/1 Copies only the first side of the disk.
/V Verifies that the information is copied correctly.
/M Force multi-pass copy using memory only.
The two floppy disks must be the same type.
You may specify the same drive for drive1 and drive2.
To view memory that your computer is using
C:\>MEM
C:\>mem /?
Displays the amount of used and free memory in your system.
MEM [/CLASSIFY | /DEBUG | /FREE | /MODULE modulename]
[/PAGE]
/CLASSIFY or /C Classifies programs by memory usage. Lists the size
of
programs, provides a summary of memory in use, and lists
largest memory block available.
/DEBUG or /D Displays status of all modules in memory, internal
drivers,
and other information.
/FREE or /F Displays information about the amount of free memory left

in both conventional and upper memory.


/MODULE or /M Displays a detailed listing of a module's memory use.
This option must be followed by the name of a module,
optionally separated from /M by a colon.
/PAGE or /P Pauses after each screenful of information.
To find file attributes RASH(R - Read Only A- Attributes S- System
Files H - Hidden)
C:\>ATTRIB Example (lists the attributes of example directory)
C:\>ATTRIB +R Example (adds attribute read only to example
directory)
C:\>ATTRIB -R Example (removes the read only attributes from
example directory)
C:\>attrib /?
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [[drive:][path]filename] [/S]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
/S Processes files in all directories in the specified path.
To run scandisk in DOS
C:\>SCANDISK
To run defrag in DOS

C:\>DEFRAG
To run a diagnostic program in DOS (only available in DOS 6.22)
C:\>MSD
To run an anti-virus program in DOS (only available in DOS 6.22)
C:\>MSAV
TCP/IP Utilities
WINIPCFG - A GUI utility on Windows 9x that allows you to get info
about your IP configuration. It also allows you to release a DHCP
lease and request a new one.
Windows 98 IP Configuration
Host Name . . . . . . . . . : ESCOTAL.rcnchicago.com
DNS Servers . . . . . . . . : 207.229.143.1
207.229.143.2
Node Type . . . . . . . . . : Broadcast
NetBIOS Scope ID. . . . . . :
IP Routing Enabled. . . . . : No
WINS Proxy Enabled. . . . . : No
NetBIOS Resolution Uses DNS : No
Ethernet adapter :
Description . . . . . . . . : PPP Adapter.
Physical Address. . . . . . : 44-45-53-54-00-00
DHCP Enabled. . . . . . . . : Yes
IP Address. . . . . . . . . : 0.0.0.0
Subnet Mask . . . . . . . . : 0.0.0.0
Default Gateway . . . . . . :

DHCP Server . . . . . . . . : 255.255.255.255


Primary WINS Server . . . . :
Secondary WINS Server . . . :
Lease Obtained. . . . . . . :
Lease Expires . . . . . . . :
Ethernet adapter :
Description . . . . . . . . : PPP Adapter.
Physical Address. . . . . . : 44-45-53-54-00-01
DHCP Enabled. . . . . . . . : Yes
IP Address. . . . . . . . . : 0.0.0.0
Subnet Mask . . . . . . . . : 0.0.0.0
Default Gateway . . . . . . :
DHCP Server . . . . . . . . : 255.255.255.255
Primary WINS Server . . . . :
Secondary WINS Server . . . :
Lease Obtained. . . . . . . :
Lease Expires . . . . . . . :
Ethernet adapter :
Description . . . . . . . . : Intel EtherExpress(TM) PRO/100 ISA Adapter
Physical Address. . . . . . : 00-90-27-63-3F-A0
DHCP Enabled. . . . . . . . : Yes
IP Address. . . . . . . . . : 24.148.46.227
Subnet Mask . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . : 24.148.46.254
DHCP Server . . . . . . . . : 216.80.19.53

Primary WINS Server . . . . :


Secondary WINS Server . . . :
Lease Obtained. . . . . . . : 01 22 02 3:40:18 AM
Lease Expires . . . . . . . : 01 22 02 4:40:18 AM
IPCONFIG - Same as above except this utility is used on windows
2000
go to Command prompt
C:\>IPCONFIG /ALL
PING - allows you to test connectivity with another host example PING
www.escotal.com
C:\>ping www.escotal.com
Pinging www.escotal.com [64.224.226.151] with 32 bytes of dat
Reply from 64.224.226.151: bytes=32 time=25ms TTL=238
Reply from 64.224.226.151: bytes=32 time=25ms TTL=238
Reply from 64.224.226.151: bytes=32 time=25ms TTL=238
Reply from 64.224.226.151: bytes=32 time=24ms TTL=238
Ping statistics for 64.224.226.151:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 24ms, Maximum = 25ms, Average = 24ms
C:\>ping /?
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
[-r count] [-s count] [[-j host-list] | [-k host-list]]
[-w timeout] destination-list
Options:

-t Ping the specified host until stopped.


To see statistics and continue - type Control-Break;
To stop - type Control-C.
-a Resolve addresses to hostnames.
-n count Number of echo requests to send.
-l size Send buffer size.
-f Set Don't Fragment flag in packet.
-i TTL Time To Live.
-v TOS Type Of Service.
-r count Record route for count hops.
-s count Timestamp for count hops.
-j host-list Loose source route along host-list.
-k host-list Strict source route along host-list.
-w timeout Timeout in milliseconds to wait for each reply.
TRACERT- This utility allows you to watch the path that information
takes getting from your machine to another one
C:\>: tracert www.escotal.com
Tracing route to www.escotal.com [64.224.226.151]
over a maximum of 30 hops:
1 8 ms 8 ms 9 ms cm-gw0-atm-2-0.psq.enteract.com [24.148.12.252]
2 9 ms 7 ms 7 ms core1-fe-1-1-0.psq.enteract.com [216.80.73.132]
3 8 ms 8 ms 7 ms core0-fe-0-0-0.apm.enteract.com [207.229.141.3]
4 9 ms 9 ms 9 ms Serial3-1.GW2.CHI1.ALTER.NET [157.130.97.129]
5 11 ms 14 ms 14 ms 502.at-2-0-0.XR1.CHI4.ALTER.NET
[152.63.68.210]

6 10 ms 10 ms 11 ms 0.so-3-0-0.TR1.CHI4.ALTER.NET
[152.63.15.234]
7 22 ms 23 ms 24 ms 106.at-6-1-0.TR1.ATL5.ALTER.NET
[146.188.142.33]
8 23 ms 26 ms 24 ms 197.at-1-0-0.XR1.ATL5.ALTER.NET
[152.63.80.241]
9 23 ms 24 ms 26 ms 193.ATM6-0.GW5.ATL5.ALTER.NET
[152.63.82.9]
10 * * * Request timed out.
11 39 ms 25 ms 25 ms 64.224.0.99
12 24 ms 24 ms 26 ms www.escotal.com [64.224.226.151]
Trace complete.
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout]
target_name
Options:
-d Do not resolve addresses to hostnames.
-h maximum_hops Maximum number of hops to search for target.
-j host-list Loose source route along host-list.
-w timeout Wait timeout milliseconds for each rep
Other DOS commands
NSLOOKUP enables you to determine the name of a DNS server
C:\>nslookup www.escotal.com
COMPACT displays or alters the compression of on files on NTFS
partitions
C:\>compact>compact /c

CIPHER displays or alters the encryption on NTFS partitions


Converting FAT to NTFS (go to Command Prompt)
CONVERT C:/FS:NTFS

DOS COMMAND EXAMPLES


1
DIR
Suppose you want to display all files and directories in a directory, including hidden or system
files. To
specify this display, type the following command:

dir /a

Suppose you want DIR to display one directory listing after another, until it has displayed the
listing for
every directory on the disk in the current drive. Suppose also that you want DIR to alphabetize
each
directory listing, display it in wide format, and pause after each screen. To specify such a display,
be sure
the root directory is the current directory and then type the following command:

dir /s/w/o/p
DATE
MS-DOS records the current date for each file you create or change; this date is listed next to the
filename
in the directory.

Syntax

DATE [mm-dd-yy]

Parameter

mm-dd-yy
Sets the date you specify. Values for day, month, and year must be separated by periods (.),
hyphens (-), or
slash marks (/). The date format depends on the COUNTRY setting you are using in your
CONFIG.SYS
file. The following list shows the valid values for the month, day, and year portions of the mmdd-yy
parameter.

mm 1 through 12

dd 1 through 31

yy 80 through 99 or 1980 through 2099


TIME
To set your computer's clock to 1:36 P.M., use either of the following commands:

TIME 13:36

TIME 1:36p

FORMAT
To format a new floppy disk in drive A using the default size, type the

format a:

To perform a quick format on a previously formatted disk in drive A, type the following
command:

format a: /q

To format a floppy disk in drive A, completely deleting all data on the disk, type the following
command:
DOS COMMAND EXAMPLES
2

format a: /u

To format a 360K floppy disk in drive A and copy the operating system files to the disk to make
it a system
disk, type the following command:

format a: /f:360 /s

To format a floppy disk in drive A and assign to it the volume label "DATA", type the following
command:

format a: /v:DATA

SYS
To copy the MS-DOS system files and command interpreter from the disk in the current drive to
a disk in
drive A, type the following command:

sys a:

To copy the MS-DOS system files and command interpreter from a disk in drive B to a disk in
drive A,
type the following the command:

sys b: a:
PROMPT
The following example sets the command prompt to display the current drive and path followed
by the
greater-than sign (>):

prompt $p$g

The following command displays a two-line prompt in which the current time appears on the
first line and
the current date appears on the second line:

prompt time is: $t$_date is: $d


DISKCOMP
If your system has only one floppy disk drive, drive A, and you want to compare two disks, type
the

following command:

diskcomp a: a:
COPY
The following command copies a file and ensures that an end-of-file character is at the end of the
copied
file:

copy memo.doc letter.doc /a

To copy the NOTE.TXT file from the current drive and directory to the directory MYNOTES,
and to
prevent MS-DOS from prompting you before overwriting the destination file (if it already
exists), type the
following command:

copy note.txt mynotes /y

DOS COMMAND EXAMPLES


3
To copy a file named ROBIN.TYP from the current drive and directory to an existing directory
named
BIRDS that is located on drive C, type the following command:

copy robin.typ c:\birds

If the BIRDS directory doesn't exist, MS-DOS copies the file ROBIN.TYP into a file named
BIRDS that is
located in the root directory on the disk in drive C.

To copy several files into one file, list any number of files as source parameters on the COPY
command
line. Separate filenames with a plus sign (+) and specify a filename for the resulting combined
file, as the
following example shows:

copy mar89.rpt + apr89.rpt + may89.rpt report

This command combines the files named MAR89.RPT, APR89.RPT, and MAY89.RPT from the
current
drive and directory and places them in a file named REPORT in the current directory on the
current drive.
When files are combined, the destination file is created with the current date and time. If you
omit
destination, MS-DOS combines the files and stores them under the name of the first specified
file. For
example, if a file named REPORT already exists, you can use the following command to
combine all four
files in REPORT:

copy report + mar89.rpt + apr89.rpt + may89.rpt

You can also combine several files into one by using wildcards, as the following example shows:

copy *.txt combin.doc

This command combines all files in the current directory on the current drive that have the
extension .TXT
into one file named COMBIN.DOC, also in the current directory on the current drive.

If you want to combine several binary files into one by using wildcards, include the /B switch, as
the
following example shows:

copy /b *.exe combin.exe

This prevents MS-DOS from treating CTRL+Z as an end-of-file character.

CAUTION: If you combine binary files, the resulting file might not be usable due to internal
formatting.

In the following example, COPY combines each file that has a .TXT extension with its
corresponding .REF
file. The result is a file with the same filename but with a .DOC extension. Thus, COPY
combines
FILE1.TXT with FILE1.REF to form FILE1.DOC. Then COPY combines FILE2.TXT with
FILE2.REF to
form FILE2.DOC, and so on.

copy *.txt + *.ref *.doc

The following COPY command combines first all files with the .TXT extension, then all files
with the
.REF extension into one file named COMBIN.DOC:

copy *.txt + *.ref combin.doc

Copying information from the keyboard

The following COPY command copies what you type at the keyboard to the OUTPUT.TXT file:
DOS COMMAND EXAMPLES
4

copy con output.txt

After you type this command and press ENTER, MS-DOS copies everything you type to the file
OUTPUT.TXT. When you are finished typing, press CTRL+Z to indicate that you want to end
the file. The
CTRL+Z character will appear on the screen as "Z". You can also end a COPY CON command
by pressing
the F6 key. When you press F6, it generates the CTRL+Z character, which appears on the screen
as Z.

The following example copies information from the keyboard to the printer connected to LPT1:

copy con lpt1


REN

Suppose you want to change the extensions of all the filenames in the current directory that have
the
extension .TXT; for example, suppose you want to change the .TXT extensions to .DOC
extensions. To
make this change, type the following command:

ren *.txt *.doc

To rename a file named CHAP10 (on drive B) to PART10, type the following command:

ren b:chap10 part10

The newly renamed file PART10 remains on drive B.


DEL
To delete the CAT.TMP file from the TEST directory on drive C, you can use either of the
following
commands:

del c:\test\cat.tmp

erase c:\test\cat.tmp

To delete all the files in a directory named TEST on drive C, you can use either of the following
commands:

del c:\test

del c:\test\*.*
UNDELETE
The following command specifies that UNDELETE is to recover all deleted files in the current
directory
one at a time, to prompt for confirmation on each file, and to use the highest available level of
delete
tracking:

undelete

The following command specifies that UNDELETE is to recover all deleted files with the .BAT
extension
in the root directory of drive C, without prompting for confirmation on each file:

undelete c:\*.bat /all

DOS COMMAND EXAMPLES


5
The following command loads the memory-resident portion of the UNDELETE program into
memory,
creates a hidden directory named SENTRY, and specifies that UNDELETE move files you delete
on drive
C to that directory:

undelete /sc

The following command loads the memory-resident portion of the UNDELETE program into
memory and
creates a PCTRACKER.DEL file to track up to 400 deleted files on drive C:

undelete /tc-400
MD
Suppose you want to create a directory on the disk in the current drive and use the directory to
store all
your tax information. To create a directory named TAXES, type the following command:

mkdir \taxes

You could also type this command with the same results:

md \taxes

Now suppose that the TAXES directory is the current directory and that you want to create a
subdirectory
of TAXES named PROPERTY. To create the PROPERTY directory, type the following
command:

mkdir property
CD
Either of the following commands changes your current directory to the directory named
PRIMETIME:

chdir \primetime

cd \primetime

Suppose you have a directory named SPECIALS with a subdirectory named SPONSORS. To
change your
current directory to \SPECIALS\SPONSORS, type the following command:

cd \specials\sponsors

Or, if your current directory is \SPECIALS, you can use the following command to change to the
\SPECIALS\SPONSORS directory:

cd sponsors

To change from a subdirectory back to the parent directory, type the following command:

cd..

To display the name of the current directory, you can use CHDIR or CD without a parameter. For
example,
if your current directory is \PUBLIC\JONES on the disk in drive B, type CHDIR to see the
following
response:

B:\PUBLIC\JONES

DOS COMMAND EXAMPLES


6
If you are working on drive D and you want to copy all files in the \PUBLIC\JONES and
\PUBLIC\LEWIS
directories on drive C to the root directory on drive D, type the following commands:

chdir c:\public\jones
copy c:*.* d:\
chdir c:\public\lewis
copy c:*.* d:\

If, instead, you want to copy all files in the \PUBLIC\JONES and \PUBLIC\LEWIS directories
to your
current location on drive D, type the following commands:

chdir c:\public\jones
copy c:*.* d:
chdir c:\public\lewis
copy c:*.* d:
RD
To delete a directory named \USER\SMITH, first ensure that the directory is empty, as in the
following
example:

dir \user\smith /a

MS-DOS should display only the "." and ".." symbols.

Then, from any directory except \USER\SMITH, type the following command:

rmdir \user\smith

You can type the following command with the same result:

rd \user\smith
PATH
The following command specifies that MS-DOS is to search three directories to find commands
(the three
paths for these directories are C:\USER\TAXES, B:\USER\INVEST, and B:\BIN):

path c:\user\taxes;b:\user\invest;b:\bin
TREE
To display the names of all the subdirectories on the disk in your current
drive, type the following command:

tree \

To display, one screen at a time, the files in all the directories on drive C, type the following
command:

tree c:\ /f | more

To print the same list that the previous example displayed, type the following command:

tree c:\ /f > prn


DOS COMMAND EXAMPLES
7
MOVE
Suppose C:\LETTERS is a directory. To move the files ED.TXT and SIGRID.TXT from the
current
directory to the LETTERS directory on drive C, type the following at the command prompt:

move ed.txt,sigrid.txt c:\letters

To move the BILL.TXT file from the current directory to the LETTERS directory on drive C and
rename it
ANN.TXT, type the following at the command prompt:

move bill.txt c:\letters\ann.txt

To rename the THISYEAR directory on drive C to LASTYEAR, type the following at the
command
prompt:

move c:\thisyear c:\last year


DELTREE
To delete the TEMP directory on drive C, including all files and subdirectories of the TEMP
directory, type
the following at the command prompt:

deltree c:\temp
CHKDSK
To find out how much data is stored on drive C and how much space is still free, and to check the
disk for
errors, type the following command:

chkdsk c:

CHKDSK pauses and displays messages if it encounters errors.

To redirect the output of CHKDSK to a file named STATUS, type the following command:

chkdsk a: > status

Because the output is redirected, MS-DOS does not repair errors it encounters during the check;
but it
records all the errors in a report file. Afterward, you can use CHKDSK with the /F switch
without
redirection to correct any errors noted in the status report.
SCANDISK
To check and fix the current drive, type the following:

scandisk

Suppose that DriveSpace is installed, but is unable to mount your compressed drive because of
problems

with the drive. The drive's compressed volume file is called DRVSPACE.000 and is located in
the root
directory of drive C. To repair the volume file, type the following:

scandisk c:\DRVSPACE.000

The DriveSpace volume file must be located in the root directory of the drive.

DOS COMMAND EXAMPLES


8
To check both drive C and drive E, type the following:

scandisk c: e:

To check all your drives, type the following:

scandisk /all

This will check all your hard disk partitions, in addition to all mounted DriveSpace drives (if
DriveSpace is
installed).

Suppose you created an Undo disk, did not change the contents of the checked drive since you
created the
Undo disk, and placed the Undo disk in drive A. To undo the changes made by ScanDisk, type
the
following:

scandisk /undo a:
UNFORMAT
To determine whether UNFORMAT can restore a formatted disk in drive A, type the following
command:

unformat a: /test

To restore a formatted disk in drive A, listing all files and subdirectories, type the following
command:

unformat a: /l
DEFRAG
To load DEFRAG into conventional memory and specify that DEFRAG sort files according to
the date
they were created, from latest created to earliest created, type the following command:

defrag c: /f /sd- /skiphigh

This example fully optimizes drive C, but slows DEFRAG


MSAV
To start MSAV using a black and white color scheme, and to specify that MSAV check all drives
except
drives A and B, type the following command:

msav /bw /a

To write a simple batch program named VIRUS that supports the MSAV exit code and the /S
switch to
scan the current drive, you can type the following commands by using MS-DOS Editor:

echo off
rem Smith's msav command
msav /s /n
if errorlevel 86 goto virus
if not errorlevel 86 goto none
:virus
DOS COMMAND EXAMPLES
9
echo MSAV has detected a virus on your current drive!
goto exit
:none
echo MSAV found no viruses on your current drive.
goto exit
:exit
VSAFE
To specify that VSAFE not check for formatting that could erase all data on the hard disk, that
VSAFE
warn of attempts to write to the boot sector of a floppy disk, and that ALT+T be assigned as the
hot key to
display the VSAFE screen, type the following command:

vsafe /1- /7+ /At

To specify that VSAFE not check for formatting that could erase all data on the hard disk, that
VSAFE
warn of attempts to write to the boot sector of a floppy disk, and that ALT+T be assigned as the
hot key to
display the VSAFE screen, type the following command:

vsafe /1- /7+ /At


MSD
Starting the MSD program

If you wanted to examine some of the technical information about your


computer before calling Microsoft Product Support Services, you would start
the MSD program by typing the following at the command prompt:

msd

The MSD program has an interface that makes it easy for you to access detailed technical
information
about your computer.

Creating a report

Before calling Microsoft Product Support Services, you could create a file called
COMPUTER.TXT that
contains a detailed technical report about your computer. To do this, you could type the following
at the
command prompt:

msd /p computer.txt

The COMPUTER.TXT file would contain the information about your computer.

If you want MSD to create a detailed report about your computer and you wanted the report to
include such
information as your name, company, address, and phone number, you would type the following
at the
command prompt:

msd /f computer.txt

The MSD program will prompt you for the information.


DOS COMMAND EXAMPLES
10
ATTRIB
To display the attributes of a file named NEWS86 located on the current drive, type the
following
command:

attrib news86

To assign the Read-Only attribute to the file REPORT.TXT, type the following command:

attrib +r report.txt

To remove the Read-Only attribute from files in the \PUBLIC\JONES directory on a disk in
drive B and
from files in any subdirectories of \PUBLIC\JONES, type the following command:

attrib -r b:\public\jones\*.* /s

As a final example, suppose you want to give an associate a disk containing all files in the
default directory
on a disk in drive A except files with the .BAK extension. Because you can use <XCOPY> to
copy only
those files marked with the Archive attribute, you need to set the Archive attribute for those files
you want
to copy. To do this, you would use the following two commands to set the Archive attribute for
all files on
drive A and then to clear the attribute for those files with the .BAK extension:

attrib +a a:*.*

attrib -a a:*.bak

Next, use the XCOPY command to copy the files from the disk in drive A to the disk in drive B.
The /A
switch in the following command causes XCOPY to copy only those files marked with the
Archive
attribute:

xcopy a: b: /a

If you want XCOPY to clear each file's Archive attribute after it copies the file, use the /M switch
instead
of /A, as in the following example:

xcopy a: b: /m
XCOPY
The following example copies all the files and subdirectories (including any empty
subdirectories) from the
disk in drive A to the disk in drive B:

xcopy a: b: /s /e

The following example uses the /D: and /V switches:

xcopy a: b: /d:01/18/93 /s /v

In this example, only files on the disk in drive A that were written on or after 01/18/93 are copied
to the
disk in drive B. Once the files are written to the disk in drive B, the XCOPY command compares
the files
on the two disks to make sure they are the same.

DOS COMMAND EXAMPLES


11
You can create a batch program to perform XCOPY operations and use the batch IF command to
process

the exit code in case an error occurs. For example, the following batch program uses replaceable
parameters for the XCOPY source and destination parameters:

@echo off
rem COPYIT.BAT transfers all source
rem files in all directories on the source
rem drive (%1) to the destination drive (%2)

xcopy %1 %2 /s /e
REPLACE
Suppose that several directories on drive C contain different versions of a file named
PHONES.CLI, which
contains client names and phone numbers. To replace all of these files with the latest version of
the
PHONES.CLI file from the disk in drive A, type the following command:

replace a:\phones.cli c:\ /s

Suppose you want to add new printer device drivers to a directory on drive C named TOOLS,
which
already contains several printer device-driver files for a word processor. To do this, type the
following
command:

replace a:*.prd c:\tools /a

This command searches the current directory on drive A for any files that have the extension
.PRD and then
adds these files to the TOOLS directory on drive C. Because the /A switch is included,
REPLACE adds
only those files from drive A that do not exist on drive C.
MEM
Getting general program and memory information

Suppose your system has both expanded memory and extended memory. To display a summary
of your
system's total memory conventional, expanded, extended, and upper and to display a list of
programs
currently loaded into memory, type the following command:

mem /classify

MEMMAKER
To run MemMaker in batch mode and to direct it not to reserve any upper memory for Windows
translation
buffers, use the following command:

memmaker /batch /w:0,0

To have MemMaker restore your previous system configuration, use the following command:

memmaker /undo

Suppose you use a disk-compression program. Your startup disk is drive C, but after the
compression
driver starts, drive C becomes your main compressed drive. Your startup files are now on drive
D. Because
of this drive-letter swapping, you would start MemMaker by using the following command:
DOS COMMAND EXAMPLES
12

memmaker /swap:d

This command specifies that the current drive D was originally the startup drive and contains
your
CONFIG.SYS and AUTOEXEC.BAT files.
Note: You do not need to use the /SWAP switch if you are using Microsoft DoubleSpace disk
compression
or the Stacker 2.0 disk-compression program.

You might also like