For loop doesn't work
Posted: 26 Sep 2018 20:22
The for loop in my bat file doesn't work.
The bat file should delete all files named desktop.ini in all folders on the partition.
The bat file should delete all files named desktop.ini in all folders on the partition.
Code: Select all
@echo on
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"
)
cd\
pause
Code: Select all
INFO.BAT version 1.5
--------------------------------------------------------------------------------
Windows version : Microsoft Windows [Version 6.1.7601]
Product name : Windows 7 Ultimate, 32 bit
Performance indicators : Processor Cores: 4 Visible RAM: 2604844 kilobytes
Date/Time format : (mm/dd/yy) Wed 09/26/2018 19:14:26.59
__APPDIR__ : C:\Windows\system32\
ComSpec : C:\Windows\system32\cmd.exe
PathExt : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Extensions : system: Enabled user: Disabled
Delayed expansion : system: Disabled user: Disabled
Locale name : en-US Code Pages: OEM 437 ANSI 1252
DIR format : 03/18/2018 11:49 AM 3,959,016 ntoskrnl.exe
Permissions : Elevated Admin=Yes, Admin group=Yes