Simple timestamp in Windows command line

[powershell]
@echo off

SET NOWTIME=%time%
echo NOWTIME=#%NOWTIME%#
SET NOWDATE=%date%
echo NOWDATE=#%NOWDATE%#

FOR /F "tokens=1 delims= " %%x in ("%NOWTIME%") do SET TIME2=%%x
FOR /F "tokens=1-4 delims=:.," %%a in ("%TIME2%") do SET STAMPT=%%a%%b%%c%%d
echo STAMPT=%STAMPT%

FOR /F "tokens=2 delims= " %%x in ("%NOWDATE%") do SET DATE2=%%x
FOR /F "tokens=1-3 delims=:-.,/" %%a in ("%DATE2%") do SET STAMPD=%%c%%b%%a
echo STAMPD=%STAMPD%

SET TIMESTAMP=%STAMPD%%STAMPT%
echo TIMESTAMP=%TIMESTAMP%
[/powershell]

1 komentář u „Simple timestamp in Windows command line“

Napsat komentář