Avatar of WellingtonIS
WellingtonIS

asked on 

Script for backups with date

I have a VB echo Wscript.Echo Year(Date-1)&" "&M(Date-1)&" "&D(Date-1)  But I need to echo the month as 0x and the single days as 0x and the 2 digit days as they are.
Here's the full script:
@echo off
setlocal

echo Wscript.Echo Year(Date-1)^&" "^&Month(Date-1)^&" "^&Day(Date-1)>"%temp%\dateparts.vbs"
for /F "tokens=1-3" %%A in ('cscript //nologo "%temp%\dateparts.vbs"') do (
  set CurYr=%%A
  set CurMo=%%B
  set CurDay=%%C
)

echo CurYr=%CurYr%
echo CurMo=%CurMo%
echo CurDay=%CurDay%

echo xcopy F:\Shares\LTA2\Archives\WRMPARCH1\DWLib2\Archived Z:\LTA2\Archives\WRMPARCH1\DWLib2\Archived\%CurYr%\%CurMo%\%CurDay% /v /f /s /i
 
xcopy F:\Shares\LTA2\Archives\WRMPARCH1\DWLib2\Archived Z:\LTA2\Archives\WRMPARCH1\DWLib2\Archived\%CurYr%\%CurMo%\%CurDay% /v /f /s /i


VB ScriptWindows Batch

Avatar of undefined
Last Comment
oBdA

8/22/2022 - Mon