home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,790 of 68,980   
   mokomoji to All   
   Re: Get date of recent weekday   
   07 Sep 21 11:39:23   
   
   From: mokomoji@naver.com   
      
   today sample folder find test   
      
   @echo off   
   setlocal   
   cd /d %~dp0   
   set "z_day1=mon" ::1   
   set "z_day2=tue" ::2   
   set "z_day3=wed" ::3   
   set "z_day4=thu" ::4   
   set "z_day5=fri" ::0   
   set "z_day6=sat" ::1   
   set "z_day7=sun" ::2   
      
   for /f "tokens=1* delims==" %%f in (   
   'wmic path win32_localtime get dayofweek /value'   
   ) do (   
   if "%%~g" neq "" (   
   call set "z_toweek=%%%%%!%z_day%%~g%!%%%%%"   
   rem today 5   
   call set z_dayx=5   
   call set /a "z_value1=(%%z_dayx%% %%%%5)"   
   call set /a "z_value2=!(%%z_dayx%%/5)*2"   
   call set /a "z_value3=%%z_value1%%+%%z_value2%%   
   ))   
   echo Monthly do not with   
   echo Leap years do not with   
   call echo today "%z_toweek%" "%date:~-2%" day -"%z_value3%" day = last friday   
      
   for /f "tokens=1* delims=-" %%f in (   
   'forfiles /d -%z_value3% /c "cmd /c echo @isdir-@file"^|find /i "true"'   
   ) do (   
   echo %%f-%%g   
   )   
      
   pause   
   endlocal   
      
   --- 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