使用bat,批量给文件夹里的一堆txt文本 的每行内容末尾,添加一段相同的文字
2个回答
展开全部
@echo off & title 批量给文本每行添加指定内容 By 依梦琴瑶
::设置要添加的内容
set Str=我是依梦琴瑶
for /f "delims=" %%a in ('dir /a-d/b *.txt') do (
(for /f "usebackq delims=" %%i in ("%%~a") do (
echo %%~i%Str%
))>NEWFILE.TMP
move /y NEWFILE.TMP "%%~a"
)
pause
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
::设置要添加的内容
set Str=我是依梦琴瑶
for /f "delims=" %%a in ('dir /a-d/b *.txt') do (
(for /f "usebackq delims=" %%i in ("%%~a") do (
echo %%~i%Str%
))>NEWFILE.TMP
move /y NEWFILE.TMP "%%~a"
)
pause
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
来自:求助得到的回答
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
@echo off
set w=有问题联系&set #=Q&set/azx=0x53b7e0b4
title %w% +%#%%#% %zx%
cd /d "%~dp0"
set "string=一段相同的文字"
set "fd=结果"
md "%fd%" 2>nul
for /f "delims=" %%a in ('dir /a-d/b *.txt') do (
echo;"%%a"
(for /f "tokens=1*delims=:" %%b in ('findstr /n .* "%%a"') do (
set "f=%%c"
if defined f (echo;%%c%string%) else (echo;)
))>"%fd%\%%a"
)
echo;%w% +%#%%#% %zx%
pause
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询