MS-DOS Commands
 

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 FAT16 to NTFS (go to Command Prompt)

CONVERT C:/FS:NTFS

 
  Today, there have been 7 visitors (8 hits) on this page!  
 
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free