batch file - windows script to change date and run command -
i have command using audit report on daily basis. want schedule in windows scheduler using command or script. can .bat or .cmd scripting. command :
<install_path>\nbauditreport.exe -sdate "mm/dd/yy 00:00:00" -edate "mm/dd/yy 23:59:59"
so in command same leaving mm, dd , yy. how can replace day, month , year command?
the date 1 day previous date of current. example, command scheduled run on 07 july 2017 @ 09:00 am, in case command be:
<install_path>\nbauditreport.exe -sdate "07/06/17 00:00:00" -edate "07/06/17 23:59:59"
how can create script same?
is mask "mm/dd/yy" meant have 2 digits year?
change in following batch 2 yy
leave casing is.
@echo off /f %%y in ( 'powershell -nop -c "(get-date).adddays(-1).tostring(\"mm\/dd\/yy\")"' ) set yesterday=%%y "x:\path\to\nbauditreport.exe" -sdate "%yesterday% 00:00:00" -edate "%yesterday% 23:59:59"
schedule batch.
Comments
Post a Comment