Home Windows XP XP Syntax

GetTime.cmd

   @echo off
   SETLOCAL
   
      :: This will return time into environment vars
      :: Works on any NT/2K/XP/2003 machine independent of time format
      :: 10 Nov 2002 - updated July 2006


   FOR /f "tokens=*" %%G IN ('time/t') DO set _time=%%G
   SET _time=%_time:~0,2%-%_time:~3,2%
   ENDLOCAL&SET _time=%_time%
   
   SET _time

Related

datetime.vbs - Get Date, Time and daylight savings
Commandline.co.uk - date/time scripts
Rob Vanderwoude - date/time scripts



Back to the Top

Simon Sheppard
SS64.com