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,891 of 42,547    |
|    Todd Vargo to w_cohen@hotmail.com    |
|    Re: Interrogating day-of-week variable i    |
|    15 Jan 14 16:21:53    |
   
   From: tlvargo@sbcglobal.netz   
      
   On 1/15/2014 11:21 AM, w_cohen@hotmail.com wrote:   
   > I've got the correct commands to determin the day of week in a DOS bat file   
   but am having trouble interrogating the variable in order to do some   
   additional processing in Win XP.   
   > Can someone have a look and please advise.   
   >   
   > :CHK_DOW   
   > setlocal   
   > for /f "delims=" %%a in ('wmic path win32_localtime get dayofweek   
   /format:list ') do for /f "delims=" %%d in ("%%a") do set %%d   
   > echo day of the week : %dayofweek%   
   > IF %dayofweek% > 5   
   > REN O:\Input\Orders\RS\ups50ords.txt O:\Input\Orders\RS\ups51ords.txt   
   > REN O:\Input\Orders\RS\ups50ords.bkp O:\Input\Orders\RS\ups50ords.txt   
   > :END   
   > endlocal   
   >   
   > The 'IF %dayofweek% > 5' never seems to be executed and the rest of the file   
   commands are ignored.   
   > Am I not able to interrogate the variable in the way I've shown?   
   > I want to execute two rename commands when the bat routine is run on a   
   Saturday or Sunday only.   
   > I can't use the endlocal until I'm finished using teh variable elsewhere in   
   the BAT file, correct?   
      
   The redirection character > is incorrect syntax. It should be GTR. Also,   
   you have a set of parenthesis missing.   
      
   IF %dayofweek% GTR 5 (   
    REN O:\Input\Orders\RS\ups50ords.txt O:\Input\Orders\RS\ups51ords.txt   
    REN O:\Input\Orders\RS\ups50ords.bkp O:\Input\Orders\RS\ups50ords.txt   
   )   
      
   --   
   Todd Vargo   
   (Post questions to group only. Remove "z" to email personal messages)   
      
   --- 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