Batch Script - Assignment Operators


Advertisements

Batch script language also provides assignment operators. Following are the assignment operators available.

The following code snippet shows how the various operators can be used.

Example

@echo off
SET /A a = 5
SET /A a+=5
echo %a%
SET /A a-=5
echo %a%
SET /A a*=5
echo %a%
SET /A a/=5
echo %a%
SET /A a%=5
echo %a%

Output

The above command produces the following output.

10
5
25
5
5
batch_script_operators.htm
Advertisements