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 41,415 of 42,547   
   foxidrive to Jean-Pierre Coulon   
   Re: adding leading zeroes to a numeric v   
   25 Jan 16 21:58:41   
   
   From: foxidrive@server.invalid   
      
   On 25/01/2016 21:29, Jean-Pierre Coulon wrote:   
   > I know how to do @FOR /L %%A IN (1,1,200) DO (convert p%%A.jpg   
   > p%%A.gif)   
   >   
   > but I will obtain p1.jpg ... p10.jpg ... p100.jpg ... and I want   
   > p001.jpg ... p010.jpg ... p100.jpg ... This because most cameras and   
   > image-processing applications speak like this. How can I cause the %%A   
   > variable to vary with leading zeroes?   
   >   
   > Regards   
      
      
      
   @echo off   
   FOR /L %%A IN (1001,1,1200) DO call: routine %%A   
   goto :eof   
   :routine   
   set num=%1   
   set num=%num:~-3%   
   convert p%num%.jpg > p%num%.gif   
      
   --- 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