Sinisterly
basics of batch - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: basics of batch (/Thread-basics-of-batch)



basics of batch - vluzzy - 01-02-2024

Batch scripting, often associated with the Windows operating system, allows users to automate a series of commands or tasks. Here are some basics and common commands in batch scripting, along with their English descriptions:

@echo off:
Description: Disables the display of commands in the command prompt window.

echo:
Description: Displays messages or turns the echoing of commands on/off.

batch

echo Hello, World!

set:

Description: Sets the value of an environment variable.

batch

set variable_name=value

echo %variable_name%:

Description: Displays the value of the specified environment variable.

batch

echo %USERNAME%

if:

Description: Performs conditional processing in a batch file.

batch

if condition (
command
)

goto:

Description: Jumps to a specified label in the batch script.

batch

goto label_name

for:

Description: Runs a command for each file in a set of files.

batch

for %%parameter in (set) do command

pause:

Description: Suspends the processing of a batch file and displays a "Press any key to continue" message.

batch

pause

cls:

Description: Clears the screen.

batch

cls

cd:

Description: Changes the current directory.

batch

cd path

copy:

Description: Copies files from one location to another.

batch

copy source destination

del:

Description: Deletes one or more files.

batch

del filename

These are just some of the basic commands in batch scripting. Batch files are useful for automating repetitive tasks on Windows systems.