Created
June 17, 2014 06:14
-
-
Save dadhi/1680320d9bf67d1ae071 to your computer and use it in GitHub Desktop.
Batch script for persistent counter. Could be used for implementing state machine or suffixing backup files, etc. Uses "count file" to store counter between script executions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if [%1]==[] (echo error: Please specify countfile as command line argument. Could be count.txt or similar. && exit /B 1) | |
set COUNTFILE=%1 | |
(set /P COUNT=<%COUNTFILE%)2>nul || set COUNT=0 | |
set /A COUNT+=1 | |
echo:%COUNT%>%COUNTFILE% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment