@echo off
set pathlogs=G:\programs\batch\al-watani
set filename2=test.txt
set count=0
setlocal enabledelayedexpansion
for /L %%1 IN (1,1,10) do (
set /a count=!count! + 1
if !count! LEQ 9 (set branchnumber=0!count!)
if !count! GEQ 10 (set branchnumber=!count!)
set batfilename=%pathlogs%\%filename2%_!batchnumber!
echo !count!
run_process on %batfilename%
)
No idea of what you are trying to do, but perhaps changing 'batchnumber' to
'branchnumber' in the tenth line may help.
Oh - and
run_process on %batfilename%
should be
run_process on !batfilename!
otherwise the value of BATFILENAME at the time the FOR /L was parsed will be
used (and likely that's empty)
Would something like this not suit your purpose better.
:: ----- START -----
@ECHO Off
SETLOCAL
(SET pathlogs=G:\programs\batch\al-watani)
(SET filename2=test)
(SET fname2ext=.txt)
(SET count=0)
(SET limit=12)
CALL :sub
GOTO :EOF
:sub
(SET/A count+=1)
IF %count% LSS 10 (SET branchnumber=0%count%) ELSE (set
branchnumber=%count%)
(SET batfilename=%pathlogs%\%filename2%_%branchnumber%%fname2ext%)
ECHO=run_process on %batfilename%
IF %count% LSS %limit% GOTO sub
:: ------ END ------
Just set limit to your chosen limit figure!