Batch scripting - automated date field

JackCPickup

Solid State Member
Messages
6
Hey guys,

I'm assuming this is the appropriate section for this.

I want to use this very simple script:

ECHO OFF

XCOPY "C:\More testing" "C:\Testing" /d:10-03-12 /y

Is there a way to have the script automatically update the date field to the day previous to the script running, so I don't have to keep changing the blasted thing every day?

Thanks in advance.

Kind regards,
Jack Pickup
 
Should be able to just use %DATE% in place of where you have the date.

If you just want the month/day/year, do this:

Code:
FOR %%A IN (%Date:/=%) DO SET TODAY=%%A
SET TODAY=%TODAY: =%
and then set %TODAY% in place of the date in your script.
 
Hey,

Thanks for the swift reply. Turns out all I needed was to use the /D switch without specifying a date.

Thanks nonetheless

Kind regards,
Jack Pickup
 
Back
Top Bottom