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,789 of 42,547    |
|    Todd Vargo to Gary Segal    |
|    Re: IF > 0    |
|    13 Nov 13 19:30:04    |
   
   From: tlvargo@sbcglobal.netz   
      
   On 11/13/2013 12:03 PM, Gary Segal wrote:   
   > 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:   
      
      
   >>>>> Set /a WIL# = 000001   
      
      
   >> 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   
   >   
      
   Sometimes its easier to see what is happening.   
      
   Copy/paste this into a test batch and run it and examine the results.   
   Then change 00001 to 00000 and run and examine results again.   
      
   @echo off   
   set a=00001   
   set b = 00001   
   set /a c = 00001   
      
   echo a=[%a%]   
   echo b=[%b%]   
   echo b =[%b %]   
   echo c=[%c%]   
      
   if %a% gtr 0 echo a is gtr 0   
   if %b% gtr 0 echo b is gtr 0   
   if %b % gtr 0 echo b{space} is gtr 0   
   if %c% gtr 0 echo c is gtr 0   
      
      
   --   
   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