Here is my scenario : I make a batch to recover some number line from a file.txt, after set each line in a variable. And after that I want to use the different variable, dynamically created, in a git command.
I have really advanced (thanks to this site in particular) and close to the final goal. Let's imagine my file.txt look like this and called errorLine.txt:
365
369
389
393
413
417
437
491
515
566
587
610
681
887
964
And my script here (blame.bat): EDITED
FINDSTR /R /N "^.*" ..\log_test\errorLine.txt | FIND /C ":" > ..\log_test\numbLine.txt
(set /p i=)<..\log_test\numbLine.txt
echo %i%
setlocal EnableDelayedExpansion
rem Load the lines of file in "l" array:
set n=0
for /F %%a in (..\log_test\errorLine.txt) do (
set /A n+=1
set "l!n!=%%a"
)
rem Show any line you want, for example:
set n=1
git blame -L !l%n%!,+1 ..\..\core\src\filepath.cpp -e
set n=2
git blame -L !l%n%!,+1 ..\..\core\src\filepath.cpp -e
pause
That's working but is there a way to not have to set for each line at the end (set n=1
, set n=2
, ...) and increment in link of the number of line ?
Thanks in advance.