DOS commands

Submitted by Karthik on

The dos commands are classified into two types.

 1. Internal commands.

            cls, date , time, dir, copycon , md, cd, rd, copy, path, ren

            del, prompt, vol, type, ver, etc..

 

2. External commands.

               format,unformat,attrib, chkdsk, backup, restore,fdisk,diskcopy, edit,

               label, scandisk, nove,more, fc, sort, deltree, undelete

 

 

Internal  commands

  Built-in the file called command.com. So the command.com file works as an interpreter as well as contains all the internal commands.

e.g. Date, Time, Cls, Dir etc....

 

Date:

  •  To display the system date and allows the user to change the system date.
  •   mm-dd-yy(month,date and year in 2 digits)

                

            ex:      

                        c:\date

                        current date is:10-23-11

                        enter new date :

Time:

            => To display the system time and allowes the user to change the system time.

 

The format is

            hh:mm:ss:ms a/p(hours:minutes:seconds:microseconds am/pm)

            ex:

                        c:\time

                        current time is: 7:00:05.50p

                        enter new time:

 

Clearscreen:

            To clear the content or text in the screen cls command is used.

 

            ex:

            c:\cls

Directory:

            we can display the list of all the files using dir command. dir is nothing to display all the  files and sub-directories.

            c:\dir

example

            dir/p              =>   it will continue with the next set of files after any key is pressed.

 

            dir/w             =>  it will be display in coloumn wise

 

            dir/on       ----- the files are sorted according to the name of files,in ascending order

 

            dir/o-n    ------ desending order

           

            dir/oe            ---  files are sorted according to the extension of file.

 

            dir/od            ---  files are sorted according to the date &time of creation.recently created file will come first.

 

            dir/os---  files are sorted according to the size of file.smallest file will come first

 

            dir/o-s       -----  files are sorted according to the size of file.largest file will come first

 

            dir/l   --- file names are displayed in lower case letters.

 

            dir/b  --- bare output. only file names

 

            dir/s   --- display all the files and subdirectories recursively.

 Wild card symbols

            * refers muliple character.

            ? refers to a single character.

 example

            dir a*.* ==> display all the files with "a" and can have any extension.

            dir *.txt ==> display all the files with extension .txt.

md:-(make directory)

             we can create subdirectory into the main directory or into some other dirctory.

       

cd(change directory)

            we can change the current working directory to some other directory.

example

            c:\>md  projects

            c:\>cd  projects

            c:\projects>

copy con

            This command is used to create a new file.whetever we have typed into the terminal is copied into the file name we have specified.

            ex:

                        c:\copy con myfile

                        I want to learn MS DOS

                        ^z

                                    1 file(s) copied

 

 Type

            The type command is used to display all the contents of a file that has been already created

                  ex:

                        c:\projects>type myfile

                        I want to learn MS DOS

delete

            If you want to delete or erase a file we can use delete or erase command.      

            ex:

                        c:\>del  projects

                                           

 copy

            We can copy  the text of a file into another.like a carbon copy of a document we can make duplication copy.

 

            syntax:

                        copy  old file name   new file name

            example

                        c:\copy myfile  newfile

 

  rename

            we can rename the existing file using the rename or ren command.

           

             syntax:

                        ren  old file name   new file name

            example

                        c:\ren myfile  file1

LABEL & VOL:

      You can change the volume label by using 'LABEL' this command.  VOL command displays the current volume name and serial number.

      >label

Deleting directory / folder

    To remove a directory, it should be empty.        

   syntax

              RD[Path]<Directory name>

            example:             c:\rd myfolder