查看单个帖子
xclimbing
 
xclimbing 的头像
高级会员
 
资 料:
注册日期: Jan 2019
帖子: 832 声望值: 0
精华: 0,解答: 14
#28 旧 2021-02-27, 18:01:23 默认
xclimbing 当前离线  

上面没仔细看你的说明,确实就如同我所推测的,如果照你这么说,批处理完全可以改成这样:

代码:
@Echo Off
Echo NewDate = DateAdd^("d", Wscript.arguments^(1^), Wscript.arguments^(0^)^)>Day.vbs
Echo Wscript.Echo NewDate>>Day.vbs

echo Current date:%date%
set dayadd=-7

for /f "tokens=*" %%i in ('cscript /nologo Day.vbs %date% %dayadd%') do (set nextdate=%%i)

set fullbakday=%date:~,4%%date:~5,2%%date:~8,2%
::set today=fullbakday
set lastday=%nextdate:~,4%%nextdate:~5,2%%nextdate:~8,2%
echo Last full backup date:%date%

::echo today:%fullbakday%
echo Today is fullbakday:%fullbakday%
echo Last Friday:%lastday%

C:\WinRAR\WinRAR.exe a -m4 密码 H:\路径\%lastday%systemdb_log.rar \\IP地址\DBbackup\%lastday%systemdb_log.bak
C:\WinRAR\WinRAR.exe a -m4 密码 H:\路径\%fullbakday%systemdb.rar \\IP地址\DBbackup\%fullbakday%systemdb.bak

Del /q Day.vbs
回复时引用此帖