添加了引号(前面忘记了,呵呵) 以便搜索带空格文件夹
@echo off
for /f "skip=1" %%o in ('wmic logicaldisk where "drivetype='3'" get caption') do (
for /f "skip=1 tokens=*" %%i in ('dir /b /ad %%o\') DO (
for /f "tokens=* delims=" %%a in ('dir /b /a-d "%%o\%%i\*.gho"') do echo %%o\%%i\%%a >>123.txt
)
)
for /f "delims=" %%j in (123.txt) do echo %%~dptnxj >>321.txt
pause
我以为还是多个搜索移动 U盘的方便吧
@echo off
for /f "skip=1" %%o in ('wmic logicaldisk get caption') do (
for /f "skip=1 tokens=*" %%i in ('dir /b /ad %%o\') DO (
for /f "tokens=* delims=" %%a in ('dir /b /a-d "%%o\%%i\*.gho"') do echo %%o\%%i\%%a >>123.txt
)
)
for /f "delims=" %%j in (123.txt) do echo %%~dptnxj >>321.txt
pause