Skip to content

Instantly share code, notes, and snippets.

@jtbrough
Created December 16, 2013 19:55
Show Gist options
  • Save jtbrough/7993271 to your computer and use it in GitHub Desktop.
Save jtbrough/7993271 to your computer and use it in GitHub Desktop.
Generate Windows Batch datetime stamp in yyyy-mm-dd_hhmmss (24hr) format.
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set file_date=%%c-%%a-%%b)
For /f "tokens=1-3 delims=:." %%a in ("%TIME%") do (set file_time=%%a%%b%%c)
echo %file_date%_%file_time%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment