I'd like to keep a "compile-counter" for one of my projects. I figured a quick and dirty way to do this would be to keep a text file with a plain number in it, and then simply call upon a small script to increment this each time I compile.
How would I go about doing this using the regular Windows command line?
I don't really feel like installing some extra shell to do this but if you have any other super simple suggestions that would accomplish just this, they're naturally appreciated as well.
You can try a plain old batchfile.
@echo off
for /f " delims==" %%i in (counter.txt) do set /A temp_counter= %%i+1
echo %temp_counter% > counter.txt
assuming the count.bat and counter.txt are located in the same directory.
It would be an new shell (but I think it is worth it), but from PowerShell it would be
[int](get-content counter.txt) + 1 | out-file counter.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With