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,802 of 68,980   
   Robert Roland to msalony101@gmail.com   
   Re: Batch File change   
   17 Oct 21 14:14:01   
   
   From: fake@ddress.no   
      
   On Sat, 16 Oct 2021 10:18:35 -0700 (PDT), Mike NYC   
    wrote:   
      
   >Suppose I need yesterdays or 2 days ago or 3 etc etc   
      
   Date arithmetics in batch is a bit too hardcore for me, so I tend to   
   "cheat" and use powershell or vbscript for that. Here's how to get   
   yesterday's date in the format you prefer, in one line:   
      
   for /f %%n in ('powershell -Command "(Get-Date).AddDays(-1)|Get-Date   
   -Format 'yyyyMMdd'"') do set mydate=%%n   
      
   Just change the format string to match your particular locale. Change   
   the "-1" the number of days you wan to calculate backwards.   
   --   
   RoRo   
      
   --- 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