INTERNAL
COMMANDS
1. CLS
Clears the screen.
Syntax:
C:\cls
2. DATE
Displays or sets the date.
Syntax:
DATE [date]
Type DATE without parameters display the
current date setting and a prompt for a new
one. Press ENTER to keep the same date.
3. TIME
Displays or sets the system time.
Syntax:
TIME [time]
Type TIME with no parameters to display the
current time setting and a prompt for a new
one. Press ENTER to keep the same time.
Example:
time 12:00
Set the time to 12:00
4. COPY CON
Used to create a file.
Syntax:
c:\>copy con filename.extension
use F6 or Ctrl+Z keys to save the contents of
file.
Example:
Copy con test
Hello everybody
^Z
1 file(s) copied.
5. TYPE
Displays a file. The more command is
frequently used in conjunction with
this command, e.g. type long-text-file |
more.
Syntax:
type filename
6. CD
Stands for change directory. It is used to find
out the location of the file in the directory
structure or it can also move us from one
location in the directory structure to another.
Syntax
C:\>CD dirname
C:\>CD..
C:\>CD \
7. DIR
Lists the contents of a directory. The dir
command typed by itself, displays the disk's
volume label and serial number; one directory
or filename per line, including the filename
extension, the file size in bytes, and the date
and time the file was last modified; and the
total number of files listed, their cumulative
size, and the free space (in bytes) remaining
on the disk.
Syntax:
dir [drive:][path][filename] [options]
DIR OPTIONS
/W : Displays the listing in wide format.
/P : Pause at every page
/S : Also look in subdirectories
/Axx: Display files with the specified attributes
only. Possible attributes for the A parameter
are :
D:directories
R : read-only files
H :hidden files
A : files/directories with the archive bit on
S :system files
/L : Display forced into lowercase
DIR OPTIONS
/Oxx: Modifies sort order. Possible sort orders
are
N :name
S :size
E: extension
D: date and time
A : last access date
G : group directories first
/D : Display wide format but sorted by column
/B : Uses bare format
> [drive:][path]filename : To Store Result in a
text file;(c:\dir > c:\fileList.txt)
8. MD
Makes a new directory. The parent of the
directory specified will be created if it does not
already exist.
Syntax:
md directory
Examples
md test
The above example creates the "test" directory in
the directory you are currently in.
md c:\test
Create the "test" directory in the c:\ directory.
9. PROMPT
Changes the Windows command prompt.
Syntax:
PROMPT [text]
text Specifies a new command prompt.
Type PROMPT without parameters to reset the
prompt to the default setting.
The prompt can be made up of normal
characters and the below special codes:
$Q= equal sign
$$$ dollar sign
$T Current time
9. PROMPT(CONTD…)
$D Current date
$P Current drive and path
$V Windows version number
$N Current drive
$G> greater-than sign
$L& less-than sign
$B| pipe
$H Backspace
$E Escape code (ASCII code 27)
$_ Carriage return and linefeed
10. COPY
Copies files from one location to another. The
destination defaults to the current directory. If
multiple source files are indicated, the
destination must be a directory, or an error will
result.
Syntax:
copy [source\filename] [destination\folder]
Examples of usage:
copy alpha.txt + beta.txt gamma.txt
copy alpha.txt d:
11. DEL
Deletes one or more files. This command is
used to delete a particular or more files.
Syntax:
del filename erase filename
Options:
*.* All files in current folder
*.* /s all files in current folder and sub
folders
12. REN
Renames a file. Unlike the move command,
this command cannot be used to rename
subdirectories, or rename files across drives.
Syntax:
ren filename newname
Example:
This example renames c:\windows\filex.txt to
c:\windows\filey.txt
ren c:\Windows\filex.txt filey.txt
13. RD
Used to remove a particular directory or
subdirectory or from a disk.
Only an empty directory or subdirectory can be
removed.
Syntax:
rd directoryname
Example:
C:\>rd test
14. VER
Used to see the current version of DOS.
Syntax:
Ver
Example
C:\>ver
MS DOS version 6.22
15. VOL
Displays the volume information about the
designated drive.
Syntax:
Vol drivename
Example:
C:\>Vol
Volume in drive C has no label.
Volume serial number is AA15-1FB0
16. PATH
Sets or displays directories that will be searched
for programs not in the current directory.
Syntax:
PATH [[drive:]path[;...]]
Examples
C:\PATH ;
clears all search-path settings and direct
Windows to search only in the current directory.
C:\PATH
PATH without parameters to display the current
path.
1. Create the following directory structure in DOS
on D drive.
2. Copy the india directory to F drive.
3. Create a directory UT under India directory and
copy chandigarh and delhi files to UT directory.
4. Delete shimla file and JK directory.
5. Rename himachal to HP.
6. Write a command which shows all directories
under india directory.