Simple timestamp in Windows command line

@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%

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

  1. Filip Valder 6.11.2012 at 19:46

    Say WOW! 🙂 How easy peasy!

Napsat komentář

Jméno *
Email *
Webová stránka