windows batch file get few days ago
using vbs, get parameter from Wscript.Arguments.Item(0)
###
d = date() - Wscript.Arguments.Item(0)
wscript.echo year(d) * 10000 + month(d) * 100 + day(d)
###
execute it with cscript //nologo
example for date of 3 days ago.
===
@echo off
for /f %%a in ('cscript //nologo daysago.vbs 3') do set mydate=%%a
echo %mydate%
===
###
d = date() - Wscript.Arguments.Item(0)
wscript.echo year(d) * 10000 + month(d) * 100 + day(d)
###
execute it with cscript //nologo
example for date of 3 days ago.
===
@echo off
for /f %%a in ('cscript //nologo daysago.vbs 3') do set mydate=%%a
echo %mydate%
===
留言
張貼留言