不清楚你的实际文件/情况,仅以问题中的说明及猜测为据
复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的文件夹放一起运行
@echo off
rem 在当前目录下的每个子文件夹里生成并执行一个指定的bat脚本文件
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
for /f "delims=:" %%a in ('type "%~f0"^|findstr /n "^exit"') do (set "lastline=%%a"&goto break)
:break
for /f "delims=" %%a in ('dir /ad/b/s') do (
echo;"%%a"
more +%lastline% "%~f0">"%%a\a.bat"
start "" "%%a\a.bat"
)
echo;%#% +%$%%$%/%@% %z%
pause
exit
@rem 以下内容为你要生成的bat里的代码
@echo off
echo;"%~dp0"
echo;This is an example
pause
exit
就是要把a b c d文件夹下(含子目录)的所有文件移动到a b c d文件夹中对吧
放在和a b c d同级目录中执行,第二行设置目录路径,自行设置。@echo off set "file=C:\Users\lytz\Desktop\C常用\bat"if exist list.txt ( del list.txt ) for %%a in (%file%) do for /f "delims=" %%b in ('dir /a-d/b/s %%a') do ( echo %%b >>list.txt ) pause