Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 41,566 of 42,547    |
|    T to All    |
|    Re: Who do I echo the date?    |
|    01 Sep 17 22:24:57    |
   
   From: T@invalid.invalid   
      
   On 09/01/2017 09:33 PM, T wrote:   
   > Hi All,   
   >   
   > `date /T` works fine. Is there a way to place   
   > it into and echo?   
   >   
   > In bash, this would be   
   > echo $(date /t)   
   >   
   > How about batch?   
   >   
   > Many thanks,   
   > -T   
      
   Figured it out:   
      
   @echo off   
      
   for /F "tokens=1-4 delims=/ " %%i in ('date /t') do ( set DATE=%%i   
   %%k/%%j/%%l )   
   echo %DATE%   
      
   for /F "tokens=1-2 delims=: " %%i in ('time /t') do ( set TIME=%%i:%%j )   
   echo %TIME%   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca