@echo off
REM This section sets the date variables
FOR /F "tokens=1-4 delims=/- " %%a in ('date/T') do set CDATE=%%b%%c%%d
REM The following formats the date variable to MMDDYY
SET CDATE=%CDATE:~0,4%%CDATE:~-2%
FOR /F "tokens=1-4 delims=:., " %%a in ("%TIME%") do set CTIME=%%a%%b%%c
echo.
echo. > c:\logs\backup-%cdate%-%ctime%.txt
echo.
This script can be inserted into almost any script fairly easy and you can utilize the date and time variables anywhere in the script.
References:
Batchfiles FAQ
No comments:
Post a Comment