increment the version number and date

August 25, 2014 at 23:27:38
Specs: windows
Hi i need to increment the version number in the particular line in file using batch script and the version is looking like this The increment is only for ":01" and i want to update the current date in the same file in another line.

please help me to solve this

See More: increment the version number and date

Report •

August 27, 2014 at 18:49:37
pls post sample of the file.

Report •

August 27, 2014 at 20:54:18
my file will be like this:

when i trigger the build the i need the output as:


Report •

August 29, 2014 at 18:42:28
Here is prototype to kick things off:
@echo off>newfile&setlocal enabledelayedexpansion
:: set up your date here. It probably won't match my format so you'll need to adapt:
set dt=%date:~7,2%.%date:~4,2%.%date:~10,4%

for /f "skip=2 tokens=2,3 delims==:" %%a in (the_file.txt) do (
set v= %%b
set v= !v: 0=!
set /a v+=1
set v=0!v!
set v=!v:~-2!
>>newfile echo script=!v!
>>newfile echo Date=%dt%
>>newfile echo minorversion=%%a:!v!
goto :aa
more +3 "the_file.txt" >> newfile
ren newfile "the_file.txt"

Report •

Related Solutions

August 31, 2014 at 21:57:13
thanks for your reply but the increment of the version is not changing properly. I executed the batch file and the version is changed as
but if i edit the script manually as SCRIPT=06 and i execute the batch file its not updating as SCRIPT=07 its updating as SCRIPT=03.
Thanks in advance

message edited by dhinesh

Report •

Ask Question