Hi there, I have a batch file, it's adding a text line every day (see below) to a csv file.
In the line there is a date, this date has to be changed each day and it's has to be the date of yesterday. And on Monday it's has to be the date of Friday. When the date change is done, the line has to be added in the file.I don't know how to do it, i know there are commando's to change date. I have searched on internet and on this forum but i could not find it. Hope that some body can help me.
for %%j in (C:\blp\bbdl\_csv\dailycurrency1.out.????????.csv) do @echo."EUR CMPN Curncy|0|4|EUR|12/03/2012|Composite(NY)|1.000000|">> %%j
No luck this time since in batch script there is no simple way to manipulate date. The required code becomes awesomely complex and unreadable. Sorry nothing to do.
If you can use vbscript, this might work:
'==== begin vbscript d8.vbs
'(cut/paste the next two lines into notepad and save as: "d8.vbs")
if datepart("w",wscript.arguments(0),vbMonday)=1 then adder=-3 else adder=-1
wscript.echo dateadd("d",adder,wscript.arguments(0))
'==== end vbscriptTo use from batch:
for /f %%a in ('cscript d8.vbs %date:~4%') do set lbd=%%aIf you are forbidden to use vbscript, I did write a somewhat lengthy and cumbersome (Ivo is right about that) batch routine to try and work it.
