External Commands

Submitted by Karthik on

EXTERNAL COMMANDS

The external commands are not built in the file command.com.
Each and every external commands need a separate file to execute them.

Attribute of a file
A bit in a file specification is used to indicate whether the file can be displayed.
    
Syntax:-
attrib <options> <filename>    

Options:-
                   
    +R =>  read only file attribute
    
    -R  => clear read only file attribute
       
    +H => hidden file attribute

    -H => clear hidden file attribute
Find:-

    This command is used to search for a pattern in a file.

Syntax:-
           find "pattern" <filename>/[options]    
       
options:-
I => Ignore case, it will search for the given pattern inlower and uppercase
N => to display only the number of times the pattern occurs.
C => to display only the number of times the pattern occurs.
V => to display only all the lines that do not contain the pattern.

SORT:-

The sort command is used to sort the contents of a file or piped input in either descending or  ascending manner.

Syntax:-

    sort<filename><options>

Example
        c:\>sort  hello

        c;\>sort  /+2 hello

        c:\>sort /r hello
MORE:-

    We can display all the files in page by page manner.

    syntax;-
              more<filename>
    example
        c:\>more  mydoc

FC(file compare):-

    The fc command is used to compare the contents of two files.

    Syntax:-
        fc<filename><filename>

    Example
        c:\>fc mydoc1 mydoc2


Move :
    It is used to move a single or a  group of files from one directory to another directory.
    
    Syntax:-

     move<filename><destination-directory>

    Example:
       
        c:\>move myfile d:
    
    
TREE

    The tree command which is provided by TREE.com file,is used to display a graphical tree view of the directory.

Syntax:-
      tree[path][/options]
 Example:-

    c:\tree

      To  display the tree view of the current directory and directories under neath the current directories.

    c:\tree\new

    To display all the files and directories of the directory NEW and underneath the  directory specified.

    c:\tree/f
        it is used to display files.



XCOPY:-
    
    It is used to copy files and subdirectories from one location to another.

    Syntax:
    xcopy<sourcedrive><directory><target drive/directory>

      Example:-
                xcopy c:\hai  d:\hello

DELTREE:-
         
      The deltree command is used to delete the entire directory structure from the path you give,provided by deltree command.it deletes all the files and subdirectories underneath the given directory including the directory specified.

    Syntax:-
        deltree<path><enter>

    Example:-
        c:\deltree hai