不使用 findstr :- @echo off
- set "t=e:\d.txt"
- set "p=d:\"
- for /f "usebackq delims=" %%a in ("%t%") do set #"%%a"==
- for /f "delims=" %%a in ('dir /b/ad "%p%"') do if not defined #"%%a" (
- del "%p%%%a\" /s/q/a/f
- rd "%p%%%a\" /s/q
- )
复制代码 使用 findstr :- @echo off
- set "t=e:\d.txt"
- set "p=d:\"
- for /f "delims=" %%a in ('dir /b/ad "%p%"^|findstr /x /v /i /g:"%t%"') do (
- del "%p%%%a\" /s/q/a/f
- rd "%p%%%a\" /s/q
- )
复制代码
[ 本帖最后由 hanyeguxing 于 2010-12-30 09:20 编辑 ] |