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,528 of 68,980   
   Mark Ise to All   
   Re: for-loop cannot process braces   
   05 May 20 16:17:38   
   
   From: mark.ise@arcor.de   
      
   JJ schrieb am 05.05.2020 um 15:22:   
   > On Tue, 5 May 2020 11:53:37 +0200, Mark Ise wrote:   
   ..   
      
      
   >> The code:   
   >>   
   >> for %%i in (%*) do (   
   >> 	echo hallo   
   >>  )   
   >>   
   >> Alternative:   
   >> for %%i in ("%*") do (   
   >>   
   >> The problem:   
   >> If arguments contain braces without spaces, the first version fails. The   
   >> cmd-window closes without an error message.   
   >>   
   ..   
      
   >>   
   >> Could an expert kick me to the right way please?   
   >   
   > Quote the element by itself. In you case, a single batch parameter. Not the   
   > whole parameters.   
      
   Could you give me a more concrete help? I have no idea how to do that?   
      
   Usually I put the files by drag n drop to the batch. Therefore I have   
   made a test with three files and a test-batch: echo %*   
      
   The output is:   
      
   echo "F:\z2\Test1 ().txt" F:\z2\Test2().txt F:\z2\Test3.txt   
   "F:\z2\Test1 ().txt" F:\z2\Test2().txt F:\z2\Test3.txt   
      
      
   Is it possible to put always quotes arround every single parameter?   
   I think it would be the more compatible way.   
      
      
      
      
      
      
   --   
   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