I’m making a batch game, that counts a highscore in a separate file called “Score.txt”.
In that file, it reads a number, but when you win the game I want it to be overriden with the next highest number. E.G… 0 is the number, I won the game, now it reads 1.
So far this is my code for the highscore…
:Score
SetLocal EnableDelayedExpansion
set score=
for /F "delims=" %%i in (Score.txt) do set score=!score! %%i
set /a %score%=%score%+1
echo %score% >score.txt
exit
But “Score.txt” only reads if ECHO is on, after I win.
I think this is what you are trying to do: