Echo Datetime
@echo off if "%time:~,1%"==" " ( set hour=0%time:~1,1% ) else ( set hour=%time:~0,2% ) set now=%date:~0,4%-%date:~5,2%-%date:~8,2%_%hour%-%time:~3,2%-%time:~6,2% echo %now% pause