I am trying to substring a string from a text file stored in a variable "user" each loop the substring parameters is increment so that i can process next data. However, the variable parameter "Inc" that i am giving to the sub-string command doesn't seem to update its value within the for loop. I already used the SETLOCAL EnableDelayedExpansion but with no success. Below is piece of the code: Note: "Inc" is defined previously as integer and have initial value of 21. I expect that each loop the variable 'test' should be: substring of "user" 41,20 .. 61,20 .. 81,20 .. and so on.. But the problem is that for the all 12 loops "Inc" in the substring command keeps the value 41 and never increases even though the echo Inc command below shows that it does increase. Appreciate your help in this issue.
:setfunc
echo. >>parsed.txt
IF !inew!==48 (
for /L %%g IN (1,1,12) do (
Set test=!user:~%Inc%,20!
echo !test!
echo !user:~%Inc%,20! >>parsed.txt
Set /a Inc=!Inc!+20
echo count=%%g
echo Inc=!Inc!
)
Call Set "test=%%user:~!Inc!,20%%"
andCall Echo %%user:~!Inc!,20%%
. BTW, I have edited your question code to include indentation, this helps to highlight that your code has a missing closing parenthesis. – Compo