Write/read count to txt file
Posted
by Brian
on Stack Overflow
See other posts from Stack Overflow
or by Brian
Published on 2010-06-06T21:55:49Z
Indexed on
2010/06/06
22:02 UTC
Read the original article
Hit count: 172
Hi,
I need a batch file that writes the count number to a txt file.
Next time the batch file is run, it should read the current count number from the txt file and add 1 to count and save this new value in the txt file. (nothing else is in the txt file) When count is >5 it should start from 1 again
Example: Count.bat runs 1 time:
count.txt has no count so Count.bat saves the value 1 in count.txt
Count.bat is run 2 time:
Count.bat reads 1 from count.txt and saves the new value 2 to count.txt
When count.bat is run for the 6 time it should start over by saving the value 1 in count.txt
I think this just be easy to do, but I'am not use to batch commands
So hopefully someone here could help me.
© Stack Overflow or respective owner