DOS Command to get the 2 Digit HOUR, Minute, and Second

January 24, 2011

When you just need the current HOUR, MINUTE, SECOND in a batch file. set hr=%TIME: =0% set hr=%hr:~0,2% echo %hr% set min=%TIME:~3,2% echo %min% set sec=%TIME:~6,2% echo %sec% Here is how it works. First off the hour. If you run echo %TIME% and it happens to be 7 AM, you’ll get ” 7″ Well that […]

4