I found this on the MS KB when I was looking for info on the Ntbackup
utility

 for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%i-%%j-%%k-%%l
  for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set da=%%i
  for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i
  set tm=%tm::=-%
  set dtt=%dt%%tm%

HTH



Iain


Iain W. Brown 
TekniCAL Ltd

email:  [EMAIL PROTECTED]
web:    http:\\www.teknical.com

phone:  44 (0) 1482 330033

 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John Tolmachoff
(Lists)
Sent: 04 November 2003 01:22
To: [EMAIL PROTECTED]
Subject: [IMail Forum] OT: command line variable


I have the following to be able to add the date to a file name, however I
need to know how to also add the time.

FOR /F "tokens=2" %%i IN ('date /t') DO SET thedate=%%i
SET mm=%thedate:~0,2%
SET dd=%thedate:~3,2%
SET yyyy=%thedate:~6,4%
)

John Tolmachoff
Engineer/Consultant/Owner
eServices For You




To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/



To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to