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,540 of 68,980   
   Mark Ise to Mark Ise   
   Re: for-loop cannot process braces   
   07 May 20 12:37:59   
   
   From: mark.ise@arcor.de   
      
   Mark Ise schrieb am 06.05.2020 um 21:38:   
   > Herbert Kleebauer schrieb am 05.05.2020 um 22:47:   
   >> On 05.05.2020 16:17, Mark Ise wrote:   
   >   
   >>   
   >> You can first copy %* to %x%, using a single "" for each parameter   
   >> and then useĀ  %x% instead of %* in the for loop:   
      
      
   Unfortunately the mentioneted way does not process all kinds of filenames.   
   Meanwhile I figured out that filenames with equal sign (=) and comma (,)   
   are not processed as wished. The programm parts the filenames at the   
   specific signs.   
   In %* the parameters are still correct.   
      
      
   programm:   
      
   @echo off   
      
   echo Parameter:   
   echo %*   
   echo.   
      
   rem call :sub "F:\z2\Test1 ().txt" F:\z2\Test2().txt F:\z2\Test3.txt   
   rem goto :eof   
      
   :sub   
   set x=   
   :loop   
   if [%1]==[] goto :end   
   set x=%x% "%~1"   
   shift   
   goto :loop   
   :end   
      
   echo Content of "x":   
   echo %x%   
   echo.   
   echo.   
      
   for %%i in (%x%) do (   
       echo %%i   
    )   
   pause   
      
      
      
   Output:   
      
   Parameter:   
   "F:\z2\Test1 ().txt" F:\z2\Test2().txt F:\z2\Test3.txt F:\z2\Test,4.txt   
   F:\z2\Test=5.txt   
      
   Content of "x":   
    "F:\z2\Test1 ().txt" "F:\z2\Test2().txt" "F:\z2\Test3.txt" "F:\z2\Test"   
   "4.txt" "F:\z2\Test" "5.txt"   
      
      
   "F:\z2\Test1 ().txt"   
   "F:\z2\Test2().txt"   
   "F:\z2\Test3.txt"   
   "F:\z2\Test"   
   "4.txt"   
   "F:\z2\Test"   
   "5.txt"   
      
      
      
   --   
   Mark   
      
   --- 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