I have come up with the two steps below:
Code: Select all
@echo %%time%% = %time%
@FOR /f "tokens=1-2" %%i in ('time /t') do @(
SET HrMin=%%i
SET ampm=%%j
)
:: Get seconds from %time%
@FOR /f "tokens=1-4 delims=:." %%e in ("%time%") do @(
SET SS=%%g
)
@echo Time = %HrMin%:%ss% %ampm%
which returns:
Code: Select all
%time% = 0:46:32.36
Time = 12:46:32 AM
But note that I had to pull ss from %time%, while the main part came from 'time /t'
Is there a way to use the first half of my code AND include seconds?
...or is there a better way?
I am really green with DOS batch commands, so thank you for any and all help.