I try to write a DOS batch but I can't get the expected result.
I've got a file with a header and I want to get the value of the first column of the second record. Then I want to split the value in two in order to get the year (which I concatenate with FY ==> FY17) and the month (which I concatenate with M ==> M04 for example).
Code: Select all
FOR /f "tokens=1,* delims=:" %%i in ('findstr /n /r . %fictodo%') do if %%i == 2 echo %%j > %fic1%
FOR /f "tokens=1,2* delims=;" %%a in ('type %fic1%') do (
set anneemois=%%a
echo anneemois %anneemois%
echo %%a
call set annee=FY%anneemois:~2,2%
call set mois=M%anneemois:~4,2%
echo annee= %annee%
echo mois= %mois%
)
%%a is well set with the expected value 201704. Fine
But anneemois, annee or mois remain empty.
fictodo is the file in. I add it in attachment.
Could you please help me with this issue?
Thanks.