Good morning friends
First: Thanks for all your helps.
I need to know the last number of a %var% numeric content,
which length I do'nt know because is the result of a mathematic operation with /a
To ask in a batch file.
Thanks in advance for your attention
Jorgegs
Numeric content of a variable
Moderator: DosItHelp
-
- Expert
- Posts: 961
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Numeric content of a variable
try:
Code: Select all
C:\Users\ACER>set /A num=56
56
C:\Users\ACER>echo %num:~-1%
6
Re: Numeric content of a variable
Or use the modulus operator "%"
The percent have to be doubled here, to avoid that it is removed by the parser
Code: Select all
set /a num=1234
set /a remain=num %% 10
The percent have to be doubled here, to avoid that it is removed by the parser
Re: Numeric content of a variable
Thank you very much for your help
It's work perfect
It's work perfect