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,790 of 42,547    |
|    Gary Segal to billious    |
|    Re: IF > 0    |
|    13 Nov 13 09:03:01    |
   
   From: segalgary@gmail.com   
      
   On Wednesday, November 13, 2013 11:09:46 AM UTC-5, billious wrote:   
   > On 14/11/2013 00:00, Gary Segal wrote:   
   >   
   > > On Wednesday, November 13, 2013 10:43:18 AM UTC-5, foxidrive wrote:   
   >   
   > >> On 14/11/2013 02:32, Gary Segal wrote:   
   >   
   > >>   
   >   
   > >>> Hi Guys   
   >   
   > >>   
   >   
   > >>> Does anyone knows what is the proper syntax for IF?   
   >   
   > >>   
   >   
   > >>>   
   >   
   > >>   
   >   
   > >>> here is my logic:   
   >   
   > >>   
   >   
   > >>> Set /a WIL# = 000001   
   >   
   > >>   
   >   
   > >>   
   >   
   > >>   
   >   
   > >> That creates a variable called "%wil# %" and set it to " 00001" without   
   the quotes.   
   >   
   > >>   
   >   
   > >>   
   >   
   > >>   
   >   
   > >>> ECHO %WIL#%   
   >   
   > >>   
   >   
   > >>>   
   >   
   > >>   
   >   
   > >>> the logic below will work either way if WIL# > 0 or = 0   
   >   
   > >>   
   >   
   > >>   
   >   
   > >>   
   >   
   > >> The logic below isn't using WIL#   
   >   
   > >>   
   >   
   > >>   
   >   
   > >>   
   >   
   > >>> IF NOT CHA# == 0 (Do something)   
   >   
   > >>   
   >   
   > >>>   
   >   
   > >>   
   >   
   > >>> what is the correct syntax?   
   >   
   > >>   
   >   
   > >>> I need it work like this - IF CHA# > 0 (Do something)   
   >   
   > >>   
   >   
   > >>   
   >   
   > >>   
   >   
   > >> if %cha#% GTR 0 echo make my day   
   >   
   > >   
   >   
   > > Thank you FoxiDrive   
   >   
   > >   
   >   
   > > I tried that, did not work.   
   >   
   > > Here is my full logic   
   >   
   > > PushD "Y:"   
   >   
   > > CD "Cloud"   
   >   
   > > set "dir1=Y:\Cloud"   
   >   
   > >   
   >   
   > > Set /a WIL# = 000000   
   >   
   > > ::: This is a Counter for Load/Email Logic ::   
   >   
   > > for %%X in ("%dir1%\*WIL*.edi") do (Set /a WIL# = WIL#+1)   
   >   
   > >   
   >   
   > > :: Load Willa   
   >   
   > >   
   >   
   > > IF NOT WIL# == 0 (   
   >   
   > > MkDir "Works fine"   
   >   
   > > RoboCopy "Works fine"   
   >   
   > > :Email   
   >   
   > > SendEmail "Works fine")   
   >   
   > >   
   >   
   > > The problem is that this logic is always executed. I need it to work only   
   when WIL# > 0   
   >   
   > > Thanks   
   >   
   > >   
   >   
   > >   
   >   
   >   
   >   
   > To access a variable, you need %var%, not var.   
   >   
   >   
   >   
   > if not %wil#%==0 (   
   >   
   > ...   
   >   
   >   
   >   
   > or   
   >   
   >   
   >   
   > if %wil#% gtr 0 (   
   >   
   > ...   
   >   
   >   
   >   
   > The test will always "succeed" BECAUSE the string "WIL#" will never be   
   >   
   > equal to the string "0"   
      
   It did not work with "if %wil#% gtr 0 ("   
   but it did work with "IF NOT %WIL#% == 0 ("   
   - Thank you   
      
   --- 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