我正在使用一个批处理脚本,它将显示文本文件中列出的特定文件夹的内容到另一个文本文件中。
例如:
包含文件夹名称的文本文件将是这样的:
SMPL505
SMPL520
SMPL590
包含输出的文本文件 - 每个文件夹中的文件列表:
SMPL505 SMPL505.JPG SMPL505.TXT ...
SMPL520 SMPL520.JPG SMPL520.TXT ...
SMPL590 SMPL590.JPG SMPL590.TXT ......
答案 0 :(得分:0)
这是一个脚本(需要一些清理),但它会给你所需的输出到文件results.txt,因为所有的完整文件夹名称(例如:C:\ users \ desktop \ folder)都在file test.txt。
@echo off
FOR /F "tokens=* delims=" %%a in (test.txt) do (
cd %%a
dir /b >>temp.txt
FOR /F "tokens=* delims=\" %%a in (temp.txt) do (
echo %%~nxa >>temp2.txt
type temp2.txt | findstr /V "temp.txt temp2.txt" > temp3.txt
move temp3.txt C:\Users\Desktop
del temp.txt temp2.txt
cd C:\Users\Desktop
type temp3.txt >>results.txt
del temp3.txt
)