Important CMD Command | Computer Tips and Tricks | Computer Tricks and Tips

Important CMD Command



Nineteens back, we do all of our work orders with the help of the computer. At that time, the GUI (graphical user interface) has no concept of.However, in Linux Command Line Interface is being widely used graphical user interface rather than the command line to work very fast.So in this post I'm listing commands CMD 7 key. Let's get into it.



CMD Window





          Internal Command: The internal Commands are those commands that automatically loaded in the   memory when the operating system DOS is loaded into the memory. These commands are loaded into the booting process.Read more Tricks at Computer Tweaks and Tricks
         
  1. COPY CON :- This command is used to create a new file with the extension txt. You cannot                                      modify the contents of a file with this command.
           
            Syntax: C:\>copy con filename.extenstion
            Press f6 or (ctrl+z) to save the file from the keyboard.

             Example: C\>copy con Sumit.txt
             My name is Sumit Kumar. ^Z (ctrl+Z)
           
  1. TYPE :- This command is used to display the contents of the text file on the screen.
                         
             Syntax: C:\>type filename.extension
                          Example: C:\>type Sumit (it displays content of text file sumit)


         COPY :- it allows the user to copy one or more file an alternate location. it is also useful to                     copy files by using wildcards.
                  
    Syntax: C:\>copy [source path] [target path][switches]
                      Example: C:\>copy sumit amit
                                      C:\>copy C:\sumit E:\amit

  1. REN :- This command is used to rename files and directories from the original name to a new name.   In other words you can change the name of a file to some other name.
                        
 Syntax: C:\>ren [old filename] [new filename]
                         Example: C:\>ren sumit amit
                         The name of Sumit will be changed with amit

  1. DEL :- This command is used to delete the files the computer. To delete the files from some        directories you need the specify path.
                       
   Syntax: C :\> Del [drive:][path] filename[\p]
                            Example C:\>sumit
  1. DIR :- This command is used to display the current of a subdirectory. DIR will display the content      working subdirectory, or with the optional PATH argument it will display the content of   some other subdirectory.
                               Syntax: C:\>dir folder name
                              Example C:\>dir sumit
                         
          
  1. MD :- This command is used to create a new directory or subdirectory. Optional argument is the path, but if no PATH is included, the subdirectory will be created in the current working                     subdirectory.
           
                    Syntax: C:\>md subdirectory name
                    Example: C\>md Sumit (create new subdirectory under C directory)
                       
  1. CD :- This command is used to change the current working subdirectory to another subdirectory
                               
                                Syntax:  C:\>cd subdirectory name
                                Example: C:\>cd Sumit (now change subdirectory)
                                               C:\Sumit>
                                
      Note: cd\   is used to return back to root directory.
                                       Cd..   Is used to return one step back

  1. RD :- This command is used to remove a subdirectory. The subdirectory is must be empty. If it           contains files and subdirectory, you will find error message. First of all remove the subdirectory and files under a subdirectory then only can remove a subdirectory.
                  
                     Syntax:  C:\>rd subdirectory name
                      Example: C\>rd Sumit (remove subdirectory if empty)

  1. CLS :- This is a command that allow a user to clear the complete content of the screen and leave only prompt on the top of the screen.
                  
 Syntax: C:\>cls

  1. VER :- This command is used to display the version number of MS-DOS. The types of command             available in the DOS are dependent upon version of DOS.
                    
                     Syntax: ver
                      Result is MS-DOS version 6.22           
  1. VOL :- This command is used to display the volume information about the designated drive. It display the disk volume label and serial number, if they exist
                   
  Syntax: C :\> VOL [drive:]
                       Example: C:\>vol c:
                      Volume in drive C has no label.
                      Volume Serial Number is 1C24-AB20

  1. DATE : This command can be used to look at the current date of the computer as well as change the date to an alternate date. You can also change the date to a new date. If you don’t need to change the date then just press enter.
                
                         Syntax: C:\>date

  1. TIME : This command is used to display the current system time. You can also change the time to a   new time. if you don’t need to change the time then just press enter.
                       
  Syntax: C:\>time

  1. DEL : This command is used to delete the files the computer. To delete the files from some         directories you need the specify path.
                       
   Syntax: C :\> Del [drive:][path] filename[\p]
                            Example C:\>sumit

  1. PATH : This command is used for searching a program with the specified directory.The entire path command include upto 127 characters.The path command create a search path for the program files only.
                        E.g. : C:\> PATH=”C:\WINDOWS”
  1. PROMPT : This command is used to change the look default DOS prompt temporarily. Default prompt.as explained earlier contains - working directory with full path, slash and greater then symbols. The new prompt, we create, is able to executive all command in same way.
                   Syntax :  PROMPT TEXT
                        E.g.         :  C:\> PROMPT SAM
          Other parameters are:
            Parameter Represent
            $L    < ( Less than symbol)
            $G   > (Greater than symbol)
            $$     $ ( Dollar symbol)
            $B    | (Bar Symbol)
            $V   Version of DOS
            $D  Current system date
            $T   Current system time
            $P   Current Path
            Thus we can change working prompt according to our desire. To come back to original prompt use :            SAM> PROMPT $P$G
  1. External Command: These commands are not the permanent part of the memory. To execute the external command, an external file is required.Whenever an External command is to be executed then the external files in which that command is stored is transferred from secondary storage to main memory. All executable files with extension .com, .exe, .bat are external commands.
External Command:-External commands are that are not automatically loaded when the operating system is loaded into the memory. This is also high level language programs but they have to be manually loaded the memory of computer, before we can use them. To run specific external command, we need the required program file.
  1.   ATTRIB: - The ATTRIB Command is an external Command. This Command is used sets or                          displays the read-only, archive, system, and hidden attributes of a file or directory.
    Syntax:-ATTRIB [drive:] [path] filename [/S]
                         
ATTRIB [+R|-R] [+A|-A] [+S|-S] [+H|-H] [d:] [path] filename [/S]
                 Example: - C :\> attrib Sumit +r+h
1)        +r       =          make a file read-only.
2)        –r       =          remove the read-only status, makes a file editable again.
3)        +a      =          turns on the archive bit (i.e. flags this file as not having been backed up)
4)        –a      =          turns off the archive bit (i.e. shows this files as having been backed up)
5)        +s      =          marks the file as a system file.
6)        –s       =          remove the system file designation.
7)        +h      =          makes the file “hidden” to other commands.
8)        –h      =          reveals the file to other commands.

  1. BACKUP:-    The BACKUP Command is an External Command. This Command is used Makes a                     backup copy of one or more files. (In DOS Version 6, this program is stored on the                          DOS supplemental disk.

   Syntax:-BACKUP drive:[path][filename] d:[/S][/M][/A][/F:(size)] [/P][/D:date] [/T:time] [/L:[path]filename]
Example: - C :\> backup c:\work\*.*d:/s

  1. CHKDSK:-The CHDSK Command is an External Command. This Command is used Checks a disk and provides a file and memory status report.

  Syntax:-CHKDSK [drive:] [path] [filename] [/F] [/V]
  Example: - C :\> chkdsk D:
  1. DELTREE:-The DELTREE Command is an External Command. This Command is used Deletes                     (erases) a directory including all files and subdirectories that are in it.
 


Syntax:-DELTREE [/Y] [d:] path
Example: - deltree/y c:\Sumit
  1. DISKCOPY:-The DISKCOPY Command is an External Command. This Command is used Makes                    an exact copy of a diskette

Syntax:-DISKCOPY [drive:] [OPTIONS]
Example: - C :\> diskcopy D:

6.      DISKCOMP:-The DISKCOMP Command is an External Command. This Command is used                              Compares the  contents of two diskettes.


Syntax:-DISKCOMP [drive:] [drive:]
Example: - C :\> diskcomp D: C: /1
  1. FIND:-The FIND Command is an External Command. This Command is used Finds and reports the       location of a specific string of text characters in one or more files.
Syntax:-FIND [/V] [/C] [/I] [/N] string [d:] [path] filename [...]
Example: - C :\> fid “hello” vinod
  1.  FORMAT:-The FORMATE Command is an External Command. This Command is used Formats a                disk to accept DOS files.

Syntax:- FORMAT d:[/1][/4][/8][/F:(size)] [/N:(sectors)]                                                          [/T:(tracks)][/B|/S][/C][/V:(label)] [/Q][/U][/V]

Example: - C :\> format c:
Example: - C :\> mode CON: COLS=80 LINES=50

9.       MORE:-The MORE Command is an External Command. This Command is used Sends output to              console, one screen at a time.

Syntax:-MORE < (filename or command)
               (name) |MORE
Example: - C :\> more Sumit
  1.  MOVE :-The LABEL Command is an External Command. This Command is used to move a file                from one location one to other i.e. changing the storage location of a file
Syntax:-MOVE [Source Path] [Destination Path]
Example: - C :\> move C:\Sumit\Aman\Raj C:\Sumit
  1.  LABEL:-The LABEL Command is an External Command. This Command is used Creates or                      changes or deletes a volume label for a disk
Syntax: - (LABEL [d:] [volume label])
Example: - C :\> label
                  Volume in drive c is Sumit
                  Volume serial number is C8D9-BAD1.
  1.  POWER:-The POWER Command is an External Command. This Command is used to turn power                management on and off, report the status of power management,   and set levels of                              power conservation.
Syntax:-POWER [adv: max|reg|min] |std|off]
Example: - C :\> power STD
  1.  PRINT:-The PRINT Command is an External Command. This Command is used Queues and prints           data files
Syntax:-PRINT [/B:(buffer size)] [/D:(device)] [/M:(maxtick)] [/Q:(value]                          [/S:(time slice)][/U:(busy tick)] [/C][/P][/T] [d:][path][filename] [...]
Example: - C :\> print sumit.txt 
  1. TREE:-The TREE Command is an External Command. This Command is used Displays directory           paths and (optionally) files in each subdirectory
 


Syntax:-TREE [d:] [path] [/A] [/F]
Example: - C :\> tree: \Sumit.
  1.  UNFORMAT:-The UNFORMAT Command is an External Command. This Command is used to undo the effects of formatting a disk
Syntax:-UNFORMAT d: [/J] [/L] [/test] [/partn] [/P] [/U].
  1.  XCOPY:- The XCOPY Command is an External Command. This Command is used Copies directories, subdirectories, and files.
Syntax:-XCOPY [d:][path]filename [d:][path][filename] [/A][/D:(date)]                             [/E][/M][/P][/L][/W]
Example: - C :\> xcopy C\:\Sumit\*txt E: