Batch file that will modify date in txt file -
i have line in text file i'm trying modify using batch file. line in case lastexportdate=2014-01-01
. i'm trying batch file modify from
lastexportdate=2014-01-01
to
lastexportdate= current timestamp.
is possible have equal timestamp of computer? not how go tackling this, if help awesome. i'm using windows 7.
file contents below:
root.footer=</creditexport> root.header=<creditexport> emailaddronsuccess=test@test.com emailaddronerror=test@test.com rerunexportdate=2014-09-06 errorfilelocation=c:\\ lastexportdate=2014-01-01 xmloutputlocation=c:\\
@echo off setlocal rem getting current time stamp set "beginjs=mshta "javascript:var t=new date();var dd=t.getdate();var mm=t.getmonth()+1;var yyyy=t.getfullyear();if(dd^<10) dd='0'+dd;if(mm^<10) mm='0'+mm;close(new activexobject('scripting.filesystemobject').getstandardstream(1).write(" set "endjs=));"" :: /f not need pipe /f %%n in ( '%beginjs% yyyy+'-'+mm+'-'+dd %endjs%' ) set cds=%%n echo cds=%cds% rem processing file rem set location of file set "content_file=c:\some.file" break>temp.file /f "usebackq tokens=1* delims==" %%a in ("%content_file%") ( if "%%a" neq "lastexportdate" echo %%a=%%b>>temp.file if "%%a" equ "lastexportdate" echo %%a=%cds%>>temp.file )
not tested.just alter location of content_file , check if created temp.file ok. replace file add together move temp.file "%content_file%"
@ end.
batch-file
No comments:
Post a Comment