Batch Script - Opérateurs arithmétiques

Le langage Batch Script prend en charge les opérateurs arithmétiques normaux comme n'importe quel langage. Voici les opérateurs arithmétiques disponibles.

L'extrait de code suivant montre comment les différents opérateurs peuvent être utilisés.

Exemple

@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%

Production

La commande ci-dessus produit la sortie suivante.

15
-5
50
2
0