
Certainly, here are some commonly used Batch script commands along with brief descriptions of each:
- ECHO: Displays text on the screen.
Example:echo Hello, World! - SET: Sets or modifies the value of an environment variable.
Example:set myVar=123 - IF: Conditionally executes commands based on a condition.
Example:
if %var%==value ( echo Condition met ) else ( echo Condition not met )
- FOR: Executes a command for each item in a set of items.
Example:
for %%i in (1 2 3) do ( echo Number: %%i )
- GOTO: Jumps to a specified label within the script.
Example:
goto :label :label echo Reached the label
- CALL: Calls another batch file or script.
Example:call another_script.bat - PAUSE: Suspends script execution and displays a “Press any key to continue…” message.
Example:pause - REM: Adds comments within the script that are ignored during execution.
Example:rem This is a comment - DIR: Lists the contents of a directory.
Example:dir - COPY: Copies files from one location to another.
Example:copy file.txt destination_folder - DEL / ERASE: Deletes a file.
Example:del file.txt - MD / MKDIR: Creates a new directory.
Example:mkdir new_folder - RD / RMDIR: Removes a directory.
Example:rmdir old_folder - MOVE: Moves a file from one location to another.
Example:move file.txt new_location - 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!
