All Batch Script Command With Its Description

Certainly, here are some commonly used Batch script commands along with brief descriptions of each:

  1. ECHO: Displays text on the screen.
    Example: echo Hello, World!
  2. SET: Sets or modifies the value of an environment variable.
    Example: set myVar=123
  3. IF: Conditionally executes commands based on a condition.
    Example:

if %var%==value ( echo Condition met ) else ( echo Condition not met )

  1. FOR: Executes a command for each item in a set of items.
    Example:

for %%i in (1 2 3) do ( echo Number: %%i )

  1. GOTO: Jumps to a specified label within the script.
    Example:

goto :label :label echo Reached the label

  1. CALL: Calls another batch file or script.
    Example: call another_script.bat
  2. PAUSE: Suspends script execution and displays a “Press any key to continue…” message.
    Example: pause
  3. REM: Adds comments within the script that are ignored during execution.
    Example: rem This is a comment
  4. DIR: Lists the contents of a directory.
    Example: dir
  5. COPY: Copies files from one location to another.
    Example: copy file.txt destination_folder
  6. DEL / ERASE: Deletes a file.
    Example: del file.txt
  7. MD / MKDIR: Creates a new directory.
    Example: mkdir new_folder
  8. RD / RMDIR: Removes a directory.
    Example: rmdir old_folder
  9. MOVE: Moves a file from one location to another.
    Example: move file.txt new_location
  10. TIME / DATE: Displays or sets the system time or date.
    Example: time /t (displays current time)

These are just a few examples of Batch script commands. Remember to exercise caution when using these commands, as they can directly affect your system and files. Always double-check your commands before executing them. If you need more specific information about any particular command, feel free to ask!

Leave a comment