Skip to content

Instantly share code, notes, and snippets.

@Tcip
Created March 8, 2023 18:10
Show Gist options
  • Save Tcip/c432240f6f70b010acc149e1255e8912 to your computer and use it in GitHub Desktop.
Save Tcip/c432240f6f70b010acc149e1255e8912 to your computer and use it in GitHub Desktop.
Show the time with variable. Hours, minutes, seconds
@echo off
REM Show the time (hours, minutes, seconds) with variable
REM https://groups.google.com/g/microsoft.public.win2000.cmdprompt.admin/c/CHS0gwjZQDA/m/L85IIcFcLgkJ
REM <nul (set/p z=sec min hours: %time:~6,2% %time:~3,2% %time:~0,2%)
title %~nx0
cls
cd %~dp0
echo.
echo Show the time with variable
echo.
<nul (set/p z= %time:~0,2%:%time:~3,2%:%time:~6,2%)
echo.
echo.
pause
@Tcip
Copy link
Author

Tcip commented Mar 8, 2023

Output

Show the time with variable

19:17:24

Press any key to continue . . .

I use a 24 hour format. I guess it says 09:17:24 PM for those of you with 12 hour clock format.

Disclaimer

I'm not the author. I just moved the variables.
source: https://groups.google.com/g/microsoft.public.win2000.cmdprompt.admin/c/CHS0gwjZQDA/m/L85IIcFcLgkJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment