首页 热点资讯 义务教育 高等教育 出国留学 考研考公

批量删除文件或文件夹(用批处理命令)

发布网友 发布时间:2022-04-26 21:45

我来回答

4个回答

热心网友 时间:2023-11-06 22:11

如果要隐藏的,那么dir 那里加/ah就可以了

@echo off
set dir1=C:\Documents and Settings\user\Local Settings\Application Data
set dir2=C:\Documents and Settings\NetworkService\Local Settings\Application Data
for /f "tokens=*" %%i in ('dir /ad /ah /b "%dir1%\*bron*"') do rd /s /q "%dir1%\%%i"
for /f "tokens=*" %%i in ('dir /a-d /ah /b "%dir1%\*bron*"') do del /f /q "%dir1%\%%i"
for /f "tokens=*" %%i in ('dir /ad /ah /b "%dir2%\*bron*"') do rd /s /q "%dir2%\%%i"
for /f "tokens=*" %%i in ('dir /a-d /ah /b "%dir2%\*bron*"') do del /f /q "%dir2%\%%i"
echo 删除完成&pause>nul 2>nul

热心网友 时间:2023-11-06 22:12

@ECHO OFF
COLOR 0a
set path1=%userprofile%\Local Settings\Application Data
set path2=C:\Documents and Settings\NetworkService\Local Settings\Application Data
for /f "tokens=*" %%a in (
'dir "%path1%\*Bron*" /s /a /b'
) do (
attrib -s -h -r "%%a" /s /d
rd "%%a" /s /q 2>nul
del "%%a" /s /q 2>nul
)

for /f "tokens=*" %%a in (
'dir "%path2%\*Bron*" /s /a /b'
) do (
attrib -s -h -r "%%a" /s /d
rd "%%a" /s /q 2>nul
del "%%a" /s /q 2>nul
)
PAUSE

热心网友 时间:2023-11-06 22:12

for %%f in ("C:\Documents and Settings\user\Local Settings\Application Data\*Bron*" "
C:\Documents and Settings\NetworkService\Local Settings\Application Data\*Bron*") do (
for /f "delims=" %%i in ('dir /a /b /s %%f') do (
rd /s /q "%%i"
if exist "%%i" del /f /a "%%i"
)
)

热心网友 时间:2023-11-06 22:13

精简的
@echo off
set drv1=C:\Documents and Settings\user\Local Settings\Application Data
set drv2=C:\Documents and Settings\NetworkService\Local Settings\Application Data
del %drv1%\*Bron*.* %drv2%\*Bron*.* /q/f/s/a
for /f "delims=" %%a in ('dir /b/s/a "%drv1""%drv2%"^|findstr Bron') do rd "%%a" /q/s

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com