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,730 of 68,980   
   Herbert Kleebauer to Tom Del Rosso   
   Re: leading zero   
   09 Mar 21 15:48:52   
   
   From: klee@unibwm.de   
      
   On 07.03.2021 04:19, Tom Del Rosso wrote:   
   > This is curious.   
   >   
   > set x=09   
   > set /a y=x   
   >   
   > results in the answer zero, but it should give the invalid number error.   
      
   Seems the "set /a" routine stops parsing a variable when the next character   
   would make the number incorrect and uses the value till this character.   
      
   set x=42a   
   set /a n=1+x+10   
   echo %n%   
      
   results in 53   
      
      
   > set /a y=%x%   
   > does give the expected error.   
      
   Because here the "set /a" routine sees "set /a y=09"   
   and therefore doesn't parse a variable like above.   
      
   --- 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