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,311 of 68,980    |
|    Herbert Kleebauer to Docfxit    |
|    Re: Batch file not working correctly    |
|    27 Sep 18 21:51:43    |
   
   From: klee@unibwm.de   
      
   On 27.09.2018 19:19, Docfxit wrote:   
   > That helped greatly.   
   > I have added the cd\ and the \ in front of desktop.ini   
   > I also discovered the attrib was removing the hidded attribute.   
      
   As I said, you don't need to do both, one is sufficient.   
      
      
   > @for /f "usebackq delims=|" %%i in (`dir /s /b /x ^| find "desktop.ini"`) do   
   (   
   > del "%%i"   
   > Echo "%%i"   
   > )   
      
   Why do you use "@for" instead of "for"?   
   Why do you use "usebackq"?   
   Why do you use "delims=|"?   
   Why do you use "dir" to first list all files and then search for   
   "desktop.ini". It is inefficient and also will delete wrong files   
   (for example "adesktop.ini" will also be deleted).   
      
   Why don't you use the simple "for" I suggested:   
      
   > for /f %%i in ('dir /s /b /x \desktop.ini') do echo %%i   
      
      
   > cd\   
      
   A second cd\ does nothing.   
      
   --- 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