I have a windows batch file that runs daily. Wish to log data into a file and want to rotate it (i.e. having at most the last 7 days worth of data).
Looked into the
A version using MSHTA and javascript. Change %jsfunc% to whateve jscript function you want to call
@echo off
::Invoke a javascript function using mhta
set jsfunc=new Date().getDay()
set dialog="about:"
for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set ndow=%%p
::get dow string from array of strings
for /f "tokens=%ndow%" %%d in ("Mon Tue Wed Thu Fri Sat Sun") do set dow=%%d
echo dow is : %ndow% %dow%
pause