Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

DOS Batch File Date and Time

Written by David POstlethwaite

A non SQL blog for a change
 
Ever needed to create a batch file that wrote a time stamped log file that ensures the day and month number always have two digits?
 
Try this:
 
SET Now=%Time: =0%
Set YYYYMMDD=%DATE:~6,4%_%DATE:~3,2%_%DATE:~0,2%_%now:~0,2%%now:~3,2%
 
echo running Batch File.... >> %YYYYMMDD%.txt

I hope you found this helpful, please feel free to leave a comment.


Comments

No comments.

Leave a Comment

Please register or log in to leave a comment.