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,529 of 68,980    |
|    Mark Ise to All    |
|    for-loop cannot process braces    |
|    05 May 20 11:53:37    |
   
   From: mark.ise@arcor.de   
      
   Hello,   
      
   I have been using a batch file with a for-loop for some years and today   
   I figured out that it cannot process elements with braces.   
      
   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.   
      
   The alternative code fails if an argument contains spaces.   
      
      
   I have tested the two versions and I think the problem is, that Windows   
   sometimes adds quotes and sometimes not. I'm sure there is a way to   
   process all sorts of arguments but I don't have more ideas and not the   
   right key words to search for it.   
      
      
   I have tested the following but it doesn't work:   
   for %%i in ("%~*") do (   
      
      
   Could an expert kick me to the right way please?   
      
   --   
   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