From: SpamNot@NoJunkMail.org   
      
   On Wed, 07 Nov 2012 16:34:58 +1100, foxidrive   
    wrote:   
      
   >On 07/11/2012 16:24, Fairfax wrote:   
   >   
   >>>>> How can I change the %DATE% above so that it works to give me   
   >>>>> yyyy.mm.dd.ddd?   
   >>>>   
   >>> :: date time using WMIC   
   >>> :: XP Pro and higher   
   >>> @echo off   
   >>> for /f "delims=" %%a in ('Wmic Path Win32_LocalTime Get /value ^|Find   
   "="') do (   
   >>> for /f "tokens=1,* delims==" %%b in ('cmd /c echo %%a') do set "%%b=00%%c")   
   >>>   
   >>> set DayOfWeek=%DayOfWeek:~2%   
   >>> set Quarter=%Quarter:~2%   
   >>> set WeekInMonth=%WeekInMonth:~2%   
   >>> set Day=%Day:~-2%   
   >>> set Hour=%Hour:~-2%   
   >>> set Minute=%Minute:~-2%   
   >>> set Month=%Month:~-2%   
   >>> set Second=%Second:~-2%   
   >>> set Yr=%Year:~4%   
   >>> set Year=%Year:~2%   
   >>>   
   >>> if %dayofweek%==1 set ddd=Mon   
   >>> if %dayofweek%==2 set ddd=Tue   
   >>> if %dayofweek%==3 set ddd=Wed   
   >>> if %dayofweek%==4 set ddd=Thu   
   >>> if %dayofweek%==5 set ddd=Fri   
   >>> if %dayofweek%==6 set ddd=Sat   
   >>> if %dayofweek%==7 set ddd=Sun   
   >>>   
   >>> set stamp=%year%-%month%-%day%-%ddd%_%hour%-%minute%-%second%   
   >>>   
   >>> echo %%stamp%% is set to %stamp% (yyyy-mm-dd-ddd_hh-mm-ss)   
   >   
   >> Darn, was hoping it would be more straightforward. I'm only a power   
   >> user and have never found batch file scripting easy, unlike other   
   >> scripting languages, I'll try to see how to incorporate all this   
   >> massive code into my copy bat string as posted above.   
   >   
   >Firstly, as your machine is locked down the admin might also have locked wmic   
   and WSH.   
   >Can you run the batch file above and get a meaningful stamp in the last line?   
      
   I can run the batch file, I just don't get good results.   
      
   >If so then you can use this as the last line, and replace %date% with %stamp%   
   in your code (which you can   
   >add following this line).   
   >   
   >   
   >set stamp=%year%.%month%.%day%.%ddd%   
      
   Kewl. Will give it a try. Thanks!   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|