h1

Windows Command Batch Scripting - Create a date string of format YYYYMMDD

December 28th, 2006

Below is the code to do this. I was frustrated at not being able to find a quick answer on this so hopefully this will help someone.

set today=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%

REF: http://www.ss64.com/ntsyntax/varsubstring.html

One comment to “Windows Command Batch Scripting - Create a date string of format YYYYMMDD”

  1. Thanks a lot lot lot dude. Great work. :)


Leave a Comment