Command Prompt - Advanced Commands

Command Prompt - Advanced Commands

r)goto
       Especially the command is used in the batch file with if command. It helps to run another command if certain contains met.
               Syntax: goto a                           (It is a part of a batch file, normally batch file loads
                             echo command1           commands by one by one, never it loads random
                             :a                                   commands, but goto command tells batch file to
                             echo command2           load commands from a random line, see beside
                                                                   syntax. It will never load 'command1', it will load                                                                                   'command2' for the 'goto a' command, because it                                                                                     will redirect to load  'a:' command.)

s)call
       Similar to the 'start' command. But It is specially used for running a batch file into the current console.
               Syntax: call "filelocation\filename"


call command in command prompt window

t)start
       It is specially used in the batch file. It helps to launch graphical or non-graphical programs into another window. The batch file stopped working if it opens a new program, If you use the 'start' command for opening the batch file then the file will not be stopped working after launching a program.
              Syntax: start "filelocation\filename"

u)prompt
       Especially it is used in batch files for logging. Also sometimes it is used into normal command prompt window. It changes the command entry text before entering a command. It never changes the current directory.
              Syntax: prompt $T (It will show current time)
                                           $A   & (Ampersand)
                                           $B   | (pipe)
                                           $C   ( (Left parenthesis)
                                           $D   Current date
                                           $F   ) (Right parenthesis)
                                           $G   > (greater-than sign)
                                           $H   Backspace (erases previous character)
                                           $L   < (less-than sign)
                                           $N   Current drive
                                           $P   Current drive and path
                                           $Q   = (equal sign)
                                           $S     (space)
                                           $T   Current time
                                           $V   Windows version number

Prompt command applied into Command Prompt window

TIP: Do not use prompt switches separately if you want to use many switches, example if you want to show the current time and date then use 'prompt $T$D'

v)If
        It is used for running a command if specific conditions are met.
           Example: If not exist "D:\example" md "D:\stopback" (If D:\example directory does not exist then the command will create a new directory into 'D:' drive named 'stopback'.)
=>If commands are rarely used into batch files, and if commands have a lot of conditions, so do not need to know about if commands.

Post a Comment

0 Comments