vendredi 24 avril 2020

How to generate 8 digit numbers with letter before and after in dos batch

I'm trying to generate an 8 digit random number, 2 letters before and after the random numbers. The letters are static by the way. It is somewhat working but the problem is on the 8 digit. Sometimes it has negative and it is outputting more than 8 digits

The output should be like this

ABC15329301XC

Here's my code below

@echo off
set /a num=(%random% * 100000000)
set first=BA
set last=AA
echo %last%%num%%last%



Aucun commentaire:

Enregistrer un commentaire