Color Command

Sets the default console foreground and background colors.

Syntax:

COLOR [attr]

attr Specifies color attribute of console output

Color attributes are specified by TWO hex digits -- the first corresponds to the background; the second the foreground. Each digit can be any of the following values:

To change the color of the font:

Ex.

c:\>color 02

ð 1st digit used for background color and 2nd one for text color.

Attrib Command

Displays or changes file attributes.

Syntax:

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename] [/S [/D]]

Ex:

c:\>attrib

ð To display the hidden files.

c:\>attrib +h (directory or file name)

ð To make a file hidden.

c:\>attrib -h (directory or file name)

ð To remove the hidden status of a directory.

c:\>attrib +r (directory or file name)

ð To make a read only file

c:\>attrib +s (directory or file name)

ð To make a system file.

c:\>attrib +a (directory or file name)

ð To make a archive file.

c:\>attrib +a (directory or file name)

ð To remove the archive permission.

c:\>attrib +h +s +r +a (directory or file name)

ð To make all attribute permission.

c:\>attrib -h -s -r -a (directory or file name)

ð To remove all attribute permission.

Dir Command

Displays a list of files and subdirectories in a directory.

c:\>dir

ð To display the contains of the current directory.

c:\>dir/p

ð To display the contains of the current directory with a option, Press any key to continue . . . , It means that it Pauses after each screen full of information.

c:\>dir/w

ð To display the list of the current directory.

C:\>dir/w/p

ð The combination of /w and /p option.

CD - Change Directory

Displays the name of or changes the current directory.

Syntax:

CHDIR [/D] [drive:][path]

CHDIR [..]

CD [/D] [drive:][path]

CD [..]

Ex.

C:\>cd windows

C:\WINDOWS>cd system32

C:\WINDOWS\SYSTEM32>cd ..

C:\WINDOWS>

ð To come out from the current folder to the parent folder.

C:\WINDOWS>cd system\color

C:\WINDOWS\SYSTEM\COLOR>

ð To go to any particular folder under another folder.

C:\WINDOWS\SYSTEM\COLOR>cd\

C:\

ð To come out to the c: drive.

Path Command

c:\>path

PATH=C:\WINDOWS\system 32; C:\WINDOWS; C:\WINDOWS\System32\Wbem;

ð To display the complete path of the command prompt.

Syntax of the adding a new path.

path=%path%;(new path)

Ex

C:\>path=%path%;d:\dir1

ð To add a new path.

C:\path

PATH=C:\WINDOWS\system 32; C:\WINDOWS; C:\WINDOWS\System32\Wbem; D:\DIR1

Fdisk Command

To create a new partition or delete a partition on the hard disk, we need to use fdisk command.

c:\>fdisk

ð To display the partition information.

Rename

Syntax:

ren (old file name) (new file name)

Ex.

C:\>ren MyInformation Myfile

ð To rename a file name.

Move

Syntax.

move (source) (destination)

Ex.

C:\move c:\dir1\MyFile d:\

ð To move a file.

Copy

Syntax:

copy (source) (destination)

xcopy (source) (destination)

Ex.

C:\copy a:\f1 c:\f1

ð To copy a file from floppy drive to c: drive.

c:\>xcopy a:\dir1 c:\dir1

Or

c:\>xcopy a:\dir1 c:\NewDir

ð To copy a directory.

Delete

c:\>del (file name)

ð To delete a file.

c:\>rd (directory name)

ð To delete a empty directory.

c:\>deltree (folder name)

ð To delete the full contains of any particular folder.

Sys Command

c:\>sys a:

ð To make a bootable floppy.

Disk Format

Syntax:

format (directory name) (option)

Ex.

C:\> format d:

ð To format a directory.

c:\>format a:/q

ð To quick format.

c:\>format a:/s

ð To make a boot disk or system disk.

Restart And Shutdown

c:\>restart

ð To restart the system.

c:\>shutdown

ð To Shutdown the computer.

Comparing Between Two Files

Syntax:

fc (1st file name) (2nd file name)

or

comp (1st file name) (2nd file name)

ð To compare between two files:

Example: There are two files f1 and f2 in the c: drive with different data.

C:\>type f1

C:\>type f2

c:\>fc f1 f2

c:\> comp f1 f2


Set Command

c:\>set

ð To display the current configuration of DOS operating system.

Dos Key

c:\>doskey

ð Edits command lines, recalls Windows commands, and creates macros.

Syntax of macros:

doskey (Macro command)=(Dos Command)

Ex:

c:\> doskey d=dir

c:\> d

Label

c:\>label

ð To display the label information and you can also set new label name.

Another syntax of label command:

label (drive name) (new label)

Ex.

C:\> label f: Mydisk

ð To edit a new label name directly of any particular drive.

Disk Defragmenter

c:\>defrag

ð It will defrag the current drive.

Another way to defrag any selected derive is given below,

Syntax:

defrag

Ex.

c:\> defrag d:

ð It will defrag a particular drive.

Checking Disk

c:\>chkdsk

ð To check a drive.

Os Version

c:\>ver

Microsoft Windows XP [Version 5.1.2600]

ð To display the version of the operating system.

Clear Screen

c:\>cls

ð To clear the current screen.

To Create New Text File

Syntax:

copy con

Ex.

C:\> copy con MyInformation

There is another program, called edit in DOS.

C:\>edit MyInformation

To read a text file we can use type command.

c:\> type MyInformation

ð It will display contains of the file.

We can add two text file by the command. Example: we will add f1 and f2 files and create another file f3.

C:\>type f1


C:\>type f2


C:\>copy f1+f2 f3


C:\>type f3

CREATE NEW DIRECTORY

Syntax:

mkdir

Example:

c:\>md mydirectory

ð To make a directory.

TIME and DATE

c:\>time

ð To display the time and to set new time.


c:\>date

ð To display the date and to set new date.

WIN COMMAND

If both windows and dos are installed in the same computer then we can use win command to go from dos to windows operating system.

c:\> win

WILD CARDS

"?" means that one character in DOS.

Example: In the "MyDirectory" folder, there are many files.

C:\MyDirectory>dir /w


C:\MyDirectory>dir FileNo?


ð It is showing the files, which file's name is started with "FileNo" and next one character may be a, b, c ...., z or 0, 1, 2, ...., 9 etc. Some examples are given below,

C:\MyDirectory>dir FileN?


C:\MyDirectory>dir ??



C:\MyDirectory>dir com.???


ð Showing that files which have only three characters to extension of file's name.

C:\MyDirectory>dir ?.?


"*" means more character:

c:\NewDir> dir *open

firstopen secondopen oldopen

ð Showing that type of file which have last four characters are "open".

Example,

c:\NewDir> dir *mail*

sumonmail1 sumonmail2 azgarmail1

ð Showing that type of files which have in middle, four character are "mail".

c:\NewDir> dir sumon.*

sumon.sh sumon.cpp sumon.c

ð Showing that type of files which file name is "sumon" and can be any extension.

c:\NewDir> dir *.*

ð It will show all the files which file have a any type of extension.

c:\NewDir> dir *

=> It will show all the files.

Note: We can also use this above wildcards in others command, copy, move, del etc

General Info

The command prompt depends on which operating system is used. Suppose now we are currently using the operating system that has been installed in Drive C. so when we run the DOS command prompt the command prompt will shown like; c:\>

If we want to move to another drive:

C:\>d:

D:\>

ð To enter to D: drive from C: drive.

D:\>a:

A:\>

ð To enter to floppy drive.