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,773 of 42,547   
   foxidrive to jackkkk   
   Re: simple batch doesn't work   
   13 Oct 13 09:49:42   
   
   From: foxidrive@server.invalid   
      
   On 12/10/2013 23:55, jackkkk wrote:   
   > Hi everyone I have a problem with this BAT:   
   >   
   >   
   >   
   >   
   > SET cont=1   
   >   
   > FOR %%f IN ("*.jpg") DO (   
   >   
   > IF %cont==1(SET cont=2)   
   >   
   > ELSE( mogrify -rotate 90 "%%f"   
   >   
   > SET cont=1)   
   >   
   >   
   >   
   >   
   >   
   > )   
   >   
   >   
   > The output says: ELSE V is not a   command   
   >   
      
   The positioning of the parentheses and commands need to be on the same line,   
   with spaces:  ) else (   
      
   You will need delayed expansion to alter and use variables in a loop, too.   
      
   The double quotes stop spaces from being an issue.   
      
    SET "cont=1"   
    FOR %%f IN (*.jpg) DO (   
     IF "%cont%"=="1" (   
       SET "cont=2"   
     ) ELSE (   
       mogrify -rotate 90 "%%f"   
       SET "cont=1"   
     )   
    )   
      
   --- 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