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,309 of 68,980    |
|    Herbert Kleebauer to Docfxit    |
|    Re: Batch file not working correctly    |
|    27 Sep 18 09:04:41    |
   
   From: klee@unibwm.de   
      
   On 27.09.2018 03:33, Docfxit wrote:   
      
   > @echo on   
   > echo.   
   > echo current working directory:   
   > cd   
   > echo.   
   > echo.   
   >   
   > Set Drive=E:   
   > %Drive%   
   > attrib -r -s -h -a "desktop.ini" /s   
   > @for /f "usebackq delims=|" %%i in (`dir /s /b /x /A:H ^| find   
   "desktop.ini"`) do (   
   > del /A:H "%%i"   
   > Echo -"%%i"-   
   > )   
   >   
   > echo new working directory:   
   > cd   
   > echo.   
   > echo.   
   >   
   > pause   
   >   
   > This is the output I get:   
   > C:\Dnload>echo.   
   >   
   > C:\Dnload>echo current working directory:   
      
   > E:\DnloadBackup\Fonts>cd   
   > E:\DnloadBackup\Fonts   
      
   > As you can see the Echo -"%%i"- within the For line is not being displayed.   
   > Something is wrong with the For line.   
      
   As you can see, your working directory on e: is E:\DnloadBackup\Fonts   
   Are you sure you want to search desktop.ini only in this directory   
   and it's subdirectories? And first you remove the "hidden" attribute   
   from all desktop.ini (but also only in E:\DnloadBackup\Fonts) and then   
   you list in the "dir" command files with the attribute hidden.   
   If you want to search the whole disk, either add a "cd \"   
   or insert a \ before desktop.ini.   
      
      
   First remove the now unnecessary echo statements from the working   
   part and start with a simple for loop (and remove the @ before the   
   for). If this is working, add more to the for loop:   
      
   @echo off   
   Set Drive=E:   
   %Drive%   
      
   attrib -r -s -h -a "\desktop.ini" /s   
      
   for /f %%i in ('dir /s /b /x \desktop.ini') do echo %%i   
      
   pause   
      
   --- 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