首页 > 运营 > 帮助中心 > 正文

bat b.txt内容插入a.txt每一行随机位置,输出c.txt实例

2020-01-27 23:48:29
字体:
来源:转载
供稿:网友

set "fa=a.txt"
set "fb=b.txt
set "fc=c.txt"
echo. >"%fc%"
echo. >"%fc%"
(for /f "delims=" %%a in ('type "%fa%"') do (
    set /p line=
    set "str=%%a"
    set n=0
    setlocal enabledelayedexpansion
    for /l %%b in (0 1 8100) do (
        if "!str:~%%b,1!" neq "" (
            set /a n+=1
        )
    )
    set /a "m=!random! %% (n+1)"
    echo;长度!n!   随机插入位置点!m!
    for %%c in (!m!) do >>"%fc%" echo;!str:~,%%c!!line!!str:~%%c!
    endlocal
))<"%fb%"

 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表