Basic DOS commands

To clear your screen (Type CLS to clear your screen)



Fast Help after each command types /? after each commands
C:\>DIR /?

File Management Commands

DIR - to display all your DOS directories


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.

The following characters are reserved and cannot be used in an MS DOS environment
Slashes / \
Greater than >
Less than <
Question mark?
Asterisk *
Dollar sign $
Quotes marks " "
Apostrophes ' '
Pipe sign |

Valid DOS names

Invalid DOS names

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


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)


TIME (displays or set the time)


VER (displays what version of DOS your running)


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.


/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
NTFS (Win 2K & NT)

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 /?

MS-DOS Editor Version 2.0.026 Copyright (c) Microsoft Corp 1995.

EDIT [/B] [/H] [/R] [/S] [/] [/?] [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.
/ - Load binary file(s), wrapping lines to 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 /?
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


To run defrag in DOS

To run a diagnostic program in DOS (only available in DOS 6.22)

To run an anti-virus program in DOS (only available in DOS 6.22)

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 . . . . . . . . . :
DNS Servers . . . . . . . . :
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. . . . . . . . . :
Subnet Mask . . . . . . . . :
Default Gateway . . . . . . :
DHCP Server . . . . . . . . :
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. . . . . . . . . :
Subnet Mask . . . . . . . . :
Default Gateway . . . . . . :
DHCP Server . . . . . . . . :
Primary WINS Server . . . . :
Secondary WINS Server . . . :
Lease Obtained. . . . . . . :
Lease Expires . . . . . . . :

Ethernet adapter :

Description . . . . . . . . : Intel EtherExpress(TM) PRO/100 ISA Adapter
Physical Address. . . . . . : 00-10-27-34-3F-A8
DHCP Enabled. . . . . . . . : Yes
IP Address. . . . . . . . . . . . :
Subnet Mask . . . . . . . . . . . :
Default Gateway . . . . . . . . . :
Primary WINS Server . . . . :
Secondary WINS Server . . . :
Lease Obtained. . . . . . . : 01 22 02 3:50:18 AM
Lease Expires . . . . . . . : 01 22 02 4:50:18 AM

IPCONFIG - Same as above except this utility is used on windows 2000

go to Command prompt


PING - allows you to test connectivity with another host example PING


Pinging [] with 32 bytes of dat

Reply from bytes=32 time=25ms TTL=238
Reply from bytes=32 time=25ms TTL=238
Reply from bytes=32 time=25ms TTL=238
Reply from bytes=32 time=24ms TTL=238

Ping statistics for
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

-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

Tracing route to []
over a maximum of 30 hops:

1    <1 ms    <1 ms    <1 ms
2     1 ms     2 ms     1 ms
3     1 ms     1 ms     1 ms
4    <1 ms     1 ms     1 ms  styx.lanet []
5     1 ms     1 ms     1 ms []
6     1 ms     1 ms     1 ms
7    23 ms    23 ms    23 ms [64
8    33 ms    34 ms    33 ms []
9   138 ms   135 ms   135 ms [
10   140 ms   140 ms   139 ms [80.231.
11   138 ms   134 ms   135 ms [216.6.114
12   140 ms   140 ms   142 ms [216.6.115
13   137 ms   137 ms   137 ms [
14   141 ms   140 ms   141 ms

Trace complete.

Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name

-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


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)


Add comment

Security code

Автор : btamedia press