@echo off setlocal enabledelayedexpansion ::: By Demon ::: A1910 or A1423 set $=A1423 set /a "x = %random% %% 1000" for /l %%i in () do ( set /a "y = !random! %% 10" set /a "z = !random! %% 10" set /a "t = (y + z + 96) %% 10" if !t! equ 4 ( echo !$!!x!!y!!z! pause ) )