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,987 of 42,547    |
|    Herbert Kleebauer to All    |
|    Re: DOS Batch program countdown days unt    |
|    03 Feb 22 11:35:02    |
   
   From: klee@unibwm.de   
      
   On 03.02.2022 10:05, JJ wrote:   
      
   >>:: extract the variables %y% %m% %d% from the %date% variable   
   >>:: (this depends on the local date format)   
   > [snip]   
   >   
   > And to detect the current date format, it can be done like below (warning:   
   > long text).   
      
   > for /f "delims=" %%A in ('2^>nul wmic   
      
   If you use wmic anyhow, you can also use it to directly   
   get the date:   
      
   @echo off   
   for /f "tokens=*" %%i in ('wmic os get LocalDateTime /value^|find "l"') do   
   set %%i   
   echo year=%localdatetime:~0,4%   
   echo month=%localdatetime:~4,2%   
   echo day=%localdatetime:~6,2%   
      
   --- 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