Showing posts with label batch modulus operator. Show all posts
Showing posts with label batch modulus operator. Show all posts

Sunday, 23 June 2019

Batch: Modulus operator


Modulus operator returns the remainder of the operation.

C:\>set /a result = 10 % 3
1

While using % operator in script, you should escape it by percentage symbol.

Hello.bat
@echo off

set /a result = 10 %% 3

echo Value of result is %result%

Output
C:\Users\Public>Hello
Value of result is 1



Previous                                                 Next                                                 Home