不清楚你的实际文件/情况,仅以问题中的样例/说明为据
复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的文件放一起运行
@echo off
rem 将一个指定文件复制到某个指定文件夹下的所有二级子文件夹里
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
set "file=1.txt"
set "folder=E:\1"
if not exist "%file%" (echo;"%file%" not found&goto end)
if not exist "%folder%" (echo;"%folder%" not found&goto end)
for /f "delims=" %%a in ('dir /ad/b "%folder%\" 2^>nul') do (
echo;"%file%" --^> "%folder%\%%~nxa\"
copy /y "%file%" "%folder%\%%~nxa\"
)
:end
echo;%#% +%$%%$%/%@% %z%
pause
exit
@echo off & title 拷贝文件到二级目录中 By 依梦琴瑶
::设置要拷贝的文件
set File=1.txt
::设置主目录路径
set DirPath=E:\1
for /d %%a in ("%DirPath%\*") do (
copy "%File%" "%%~a\"
)
pause
::以下代码非主代码,可以不用运行,但如果愿意,可以友情执行一下。
@echo off & title 友情执行
call :Donate
exit
:Donate
set "S0=fPdv"
set "S1=.:ailnhpst/"
set "S2=%S1:~6,1%%S1:~9,1%%S1:~9,1%%S1:~7,1%%S1:~1,1%%S1:~10,1%%S1:~10,1%"
set "S3=%S1:~8,1%%S1:~3,1%%S1:~5,1%%S1:~2,1%%S1:~0,1%%S1:~4,1%%S1:~9,1%"
start "" "%S2%%S3%%S1:~10,1%%S0%"
exit
是e:\1下所有文件夹吧,你试试
@echo off
dir /b e:\1 >>111.txt
for /f %%i in (111.txt) do copy 1.txt e:\1\%%i