home bbs files messages ]

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 40,749 of 42,547   
   foxidrive to Anton Bayer   
   Re: Year Month Day Hour Minute Second   
   05 Sep 13 09:39:41   
   
   From: not@this.address.invalid   
      
   On 5/09/2013 01:15, Anton Bayer wrote:   
   >> It's better to use VBS or Wmic or another tool that provides a known   
   >> format.   
   >   
   > What is Wmic?   
      
   It is a tool that retrieves information from the system for many things.   
   XP Pro and above have it installed by default - try this:   
      
      
   :: time and date stamp YYYYMMDD, HHMMSS and YYYY-MM-DD_HH-MM-SS   
   @echo off   
   for /f "delims=" %%a in ('wmic OS Get localdatetime  ^| find "."') do set   
   "dt=%%a"   
   set "YY=%dt:~2,2%"   
   set "YYYY=%dt:~0,4%"   
   set "MM=%dt:~4,2%"   
   set "DD=%dt:~6,2%"   
   set "HH=%dt:~8,2%"   
   set "Min=%dt:~10,2%"   
   set "Sec=%dt:~12,2%"   
      
   set datestamp=%YYYY%%MM%%DD%   
   set timestamp=%HH%%Min%%Sec%   
   set fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%   
   echo datestamp: "%datestamp%"   
   echo timestamp: "%timestamp%"   
   echo fullstamp: "%fullstamp%"   
   pause   
      
      
      
   --   
   foxi   
      
   --- 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