troubleshooting Question

Script for backups with date

Avatar of WellingtonIS
WellingtonIS asked on
VB ScriptWindows Batch
6 Comments1 Solution7 ViewsLast Modified:
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


ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros