can`t get loop variable digits

May 6, 2011 at 18:20:29
Specs: Windows XP
following script doesn`t work properly. actually i want to get last 3 digit from mylist.txt.
in my list.txt, there in from 0000 to 9999 digits
...
0590
0591
0592
0593
...

set n=10000
set m=0
set a=0
set aa=0
set aaa=0
echo =======start %date%====== > log.txt
for /f %%i in (mylist.txt) do (
set m=%%i
set a=%m:~-1%
set aa=%m:~-2,1%
set aaa=%m:~-3,1%
set /A m=%a%+%aa%*10+%aaa%*100
echo %m%=%a%+%aa%*10+%aaa%*100 bolon %%i >> log.txt
)


See More: can`t get loop variable digits

Report •


#1
May 7, 2011 at 01:15:02
i found my answer

for /f %%i in (mylist.txt) do call :sub1 %%i
goto :eof
:sub1
set m=%1
set a=%m:~-1%
set aa=%m:~-2,1%
set aaa=%m:~-3,1%
echo %m%=%a%+%aa%*10+%aaa%*100 bolon %%i >> log.txt
goto :eof


Report •
Related Solutions


Ask Question