Time/Date Stamps in a Batch File
Ever need time or date stamps in a batch file?
@echo off For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b) For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b) For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b) echo %mydate%_%mytime%
I think that should do it. I needed this to include time stamps with a log file that was automatically being generated.










