Batch Script - Arithmetic operators


Advertisements

Batch Script language supports the normal Arithmetic operators as any language. Following are the Arithmetic operators available.

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

Example

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

Output

The above command produces the following output.

15
-5
50
2
0
batch_script_operators.htm
Advertisements