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,312 of 68,980   
   probyn@berkeley.edu to Docfxit   
   Re: Batch file not working correctly   
   26 Sep 18 20:16:50   
   
   On Wednesday, September 26, 2018 at 6:33:22 PM UTC-7, Docfxit wrote:   
   > On Wednesday, September 26, 2018 at 10:55:36 AM UTC-7, Herbert Kleebauer   
   wrote:   
   > > On 26.09.2018 18:27, Docfxit wrote:   
   > >    
   > > Which OS? How do you start your batch (type the name   
   > > of the batch in a CMD window or use windows explorer to   
   > > click on the batch)?   
   > I am running this in Win7 from windows explorer.   
   >    
   > Thank you for the suggestion to start with a minimum of commands and see how   
   it goes.  With your starting bat suggestion it worked great.  I did see the   
   echo text and it ran fine.  I added one line at a time. It seams to not work   
   when I add the first    
   for loop. This is what I am currently testing with:   
   >    
   > @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:   
   > current working directory:   
   >    
   > C:\Dnload>cd   
   > C:\Dnload   
   >    
   > C:\Dnload>echo.   
   >    
   > C:\Dnload>echo.   
   >    
   > C:\Dnload>Set Drive=E:   
   >    
   > C:\Dnload>E:   
   >    
   > E:\DnloadBackup\Fonts>attrib -r -s -h -a "desktop.ini" /s   
   >    
   > E:\DnloadBackup\Fonts>echo new working directory:   
   > new working directory:   
   >    
   > E:\DnloadBackup\Fonts>cd   
   > E:\DnloadBackup\Fonts   
   >    
   > E:\DnloadBackup\Fonts>echo.   
   >    
   > E:\DnloadBackup\Fonts>echo.   
   >    
   > E:\DnloadBackup\Fonts>pause   
   > Press any key to continue . . .   
   >    
   >    
   > As you can see the Echo -"%%i"- within the For line is not being displayed.   
   > Something is wrong with the For line.   
   >    
   > Thank you,   
   >    
   > Docfxit   
      
   Aren't you missing the 'tokens=...' part in the 'For' line?   
      
   --- 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