圆月山庄资源网 Design By www.vgjia.com
一、要求用批处理随机输出200个字符到1.txt中的一行,内容类同如下:
代码:
xh45q3ma+remgofm54sevhrna4g5r8pl9cjardezqjwj3m8itamh0a4itzd6jz8cmrfmibmhr0wmccyb8qnp2qh4rvlwff6yr2ez4eo063u6viy7ppw+nzxaxe8vrm190eei_0dwx5e2kxbds-ae6e96c9_i9glw8mz+uf6uienx9od8bktfnjlwlqu-e1rcj33_+4bz
二、要求用批处理将1.txt中的内容按10个字符为一段输出如下面两种形式:
在一行内输出:
代码:
xh45q3ma+r emgofm54se vhrna4g5r8 pl9cjardez qjwj3m8ita mh0a4itzd6 jz8cmrfmib mhr
0wmccyb 8qnp2qh4rv lwff6yr2ez 4eo063u6vi y7ppw+nzxa xe8vrm190e ei_0dwx5e2 kxbds-
ae6e 96c9_i9glw 8mz+uf6uie nx9od8bktf njlwlqu-e1 rcj33_+4bz
分行输出:
代码:
xh45q3ma+r
emgofm54se
vhrna4g5r8
pl9cjardez
qjwj3m8ita
mh0a4itzd6
jz8cmrfmib
mhr0wmccyb
8qnp2qh4rv
lwff6yr2ez
4eo063u6vi
y7ppw+nzxa
xe8vrm190e
ei_0dwx5e2
kxbds-ae6e
96c9_i9glw
8mz+uf6uie
nx9od8bktf
njlwlqu-e1
rcj33_+4bz
----------------------------------------------------------------------------------------------------------------------------------------------------
要求:代码高效、通用、简洁、不产生临时文件
ps:请老手们将本题留给新手完成
more:
复制代码 代码如下:
@echo off
Setlocal Enabledelayedexpansion
set "str=abcdefghijklmnopqrstuvwxyz1234567890+-_"
for /l %%a in (1 1 200) do (
set /a "m=!random!%%39"
call set "var1=%%var1%%%%str:~!m!,1%%"
)
set "var=%var1%"
for /l %%a in (1 1 20) do (
set "var2=!var:~,10!"
set /p =!var2! <NUL
set "var=!var:~10!"
)
echo.&echo.&set "var=%var1%"
for /l %%a in (1 1 20) do (
set "var2=!var:~,10!"
echo.!var2!
set "var=!var:~10!"
)
pause>nul
shqf:
复制代码 代码如下:
@echo off
set /p str=<1.txt
set /p select=1.一行内分节显示 2.分行显示(请选择1-2):
if %select% equ 2 goto fh
:fj
set /p=%str:~,10% <nul
if not "%str:~10%"=="" (set str=%str:~10%&goto fj)
pause>nul&goto end
:fh
echo %str:~,10%
if not "%str:~10%"=="" (set str=%str:~10%&goto fh)
pause>nul
terse:
复制代码 代码如下:
@echo off&Setlocal Enabledelayedexpansion
set "var=abcdefghijklmnopqrstuvwxyz1234567890+-_"
for /l %%i in (1 1 200) do set /a "m=!random!%%39"&call set str=!str!%%var:~!m!,1%%
>1.txt echo %str%
for /l %%i in (1 1 20) do set /p=!str:~,10! <nul&set "%%i=!str:~,10!"&set "str=!str:~10!"
echo.
for /l %%i in (1 1 20) do echo.!%%i!
pause>nul
pusofalse:
复制代码 代码如下:
@echo off&setlocal enabledelayedexpansion
set var=abcdefghijklmnopqrstuvwxyz0123456789+-_
for /l %%a in (1 1 200) do (
set/a n=!random!%%39
call,set a=!a!%%var:~!n!,1%%
)
echo %a%&pause>nul&echo.
:lp
for /l %%i in (0 10 190) do if not defined b (set/p=!a:~%%i,10! <nul) else echo !a:~%%i,10!
if not defined b set b=b&pause>nul&echo.&echo.&goto lp
pause
inittab:
复制代码 代码如下:
@echo off&setlocal enabledelayedexpansion
set "str=1234567890abcdefghijklmnopqrstuvwxyz@#$_+-"
for /l %%i in (0,1,199) do (
set/a ran=!random!%%42&call set "st=!st!%%str:~!ran!,1%%"
)
echo 整行输出: !st!&echo.&echo 分列输出:
for /l %%j in (0,10,190) do (
set /a m=%%j
call set "st1=!st1!%%st:~!m!,10%% "
call echo %%st:~!m!,10%%
)
echo.&echo 分段输出: !st1!
pause
netbenton:
复制代码 代码如下:
@echo off&setlocal enabledelayedexpansion
set "str=1234567890abcdefghijklmnopqrstuvwxyz@#$_+-"
for /l %%i in (0,1,199) do set/a ran=!random!%%42&for %%a in (!ran!) do set "st=!st!!str:~%%a,1!"
echo 整行输出: !st!&echo.&echo 分列输出:
for /l %%j in (0,10,190) do echo !st:~%%j,10!&set "st1=!st1!!st:~%%j,10! "
echo.&echo 分段输出: !st1!
pause
bathman:
复制代码 代码如下:
@echo off
rem 随机生成200个字符
set "var=abcdefghijklnmopqrstuvwxyz0123456789+_/-"
:begin
set /a a=%random%%%40,n+=1
call,set "str=%str%%%var:~%a%,1%%"
if %n% neq 200 goto begin
rem 在一行内分段输出
:lp
set /a m+=1
set /p=%str:~,10% <nul&set "_%m%=%str:~,10%"
set "str=%str:~10%"
if defined str goto lp
rem 分行输出分段后字符
echo.&echo.&for /l %%i in (1,1,%m%) do call,echo %%_%%i%%
pause>nul
代码:
xh45q3ma+remgofm54sevhrna4g5r8pl9cjardezqjwj3m8itamh0a4itzd6jz8cmrfmibmhr0wmccyb8qnp2qh4rvlwff6yr2ez4eo063u6viy7ppw+nzxaxe8vrm190eei_0dwx5e2kxbds-ae6e96c9_i9glw8mz+uf6uienx9od8bktfnjlwlqu-e1rcj33_+4bz
二、要求用批处理将1.txt中的内容按10个字符为一段输出如下面两种形式:
在一行内输出:
代码:
xh45q3ma+r emgofm54se vhrna4g5r8 pl9cjardez qjwj3m8ita mh0a4itzd6 jz8cmrfmib mhr
0wmccyb 8qnp2qh4rv lwff6yr2ez 4eo063u6vi y7ppw+nzxa xe8vrm190e ei_0dwx5e2 kxbds-
ae6e 96c9_i9glw 8mz+uf6uie nx9od8bktf njlwlqu-e1 rcj33_+4bz
分行输出:
代码:
xh45q3ma+r
emgofm54se
vhrna4g5r8
pl9cjardez
qjwj3m8ita
mh0a4itzd6
jz8cmrfmib
mhr0wmccyb
8qnp2qh4rv
lwff6yr2ez
4eo063u6vi
y7ppw+nzxa
xe8vrm190e
ei_0dwx5e2
kxbds-ae6e
96c9_i9glw
8mz+uf6uie
nx9od8bktf
njlwlqu-e1
rcj33_+4bz
----------------------------------------------------------------------------------------------------------------------------------------------------
要求:代码高效、通用、简洁、不产生临时文件
ps:请老手们将本题留给新手完成
more:
复制代码 代码如下:
@echo off
Setlocal Enabledelayedexpansion
set "str=abcdefghijklmnopqrstuvwxyz1234567890+-_"
for /l %%a in (1 1 200) do (
set /a "m=!random!%%39"
call set "var1=%%var1%%%%str:~!m!,1%%"
)
set "var=%var1%"
for /l %%a in (1 1 20) do (
set "var2=!var:~,10!"
set /p =!var2! <NUL
set "var=!var:~10!"
)
echo.&echo.&set "var=%var1%"
for /l %%a in (1 1 20) do (
set "var2=!var:~,10!"
echo.!var2!
set "var=!var:~10!"
)
pause>nul
shqf:
复制代码 代码如下:
@echo off
set /p str=<1.txt
set /p select=1.一行内分节显示 2.分行显示(请选择1-2):
if %select% equ 2 goto fh
:fj
set /p=%str:~,10% <nul
if not "%str:~10%"=="" (set str=%str:~10%&goto fj)
pause>nul&goto end
:fh
echo %str:~,10%
if not "%str:~10%"=="" (set str=%str:~10%&goto fh)
pause>nul
terse:
复制代码 代码如下:
@echo off&Setlocal Enabledelayedexpansion
set "var=abcdefghijklmnopqrstuvwxyz1234567890+-_"
for /l %%i in (1 1 200) do set /a "m=!random!%%39"&call set str=!str!%%var:~!m!,1%%
>1.txt echo %str%
for /l %%i in (1 1 20) do set /p=!str:~,10! <nul&set "%%i=!str:~,10!"&set "str=!str:~10!"
echo.
for /l %%i in (1 1 20) do echo.!%%i!
pause>nul
pusofalse:
复制代码 代码如下:
@echo off&setlocal enabledelayedexpansion
set var=abcdefghijklmnopqrstuvwxyz0123456789+-_
for /l %%a in (1 1 200) do (
set/a n=!random!%%39
call,set a=!a!%%var:~!n!,1%%
)
echo %a%&pause>nul&echo.
:lp
for /l %%i in (0 10 190) do if not defined b (set/p=!a:~%%i,10! <nul) else echo !a:~%%i,10!
if not defined b set b=b&pause>nul&echo.&echo.&goto lp
pause
inittab:
复制代码 代码如下:
@echo off&setlocal enabledelayedexpansion
set "str=1234567890abcdefghijklmnopqrstuvwxyz@#$_+-"
for /l %%i in (0,1,199) do (
set/a ran=!random!%%42&call set "st=!st!%%str:~!ran!,1%%"
)
echo 整行输出: !st!&echo.&echo 分列输出:
for /l %%j in (0,10,190) do (
set /a m=%%j
call set "st1=!st1!%%st:~!m!,10%% "
call echo %%st:~!m!,10%%
)
echo.&echo 分段输出: !st1!
pause
netbenton:
复制代码 代码如下:
@echo off&setlocal enabledelayedexpansion
set "str=1234567890abcdefghijklmnopqrstuvwxyz@#$_+-"
for /l %%i in (0,1,199) do set/a ran=!random!%%42&for %%a in (!ran!) do set "st=!st!!str:~%%a,1!"
echo 整行输出: !st!&echo.&echo 分列输出:
for /l %%j in (0,10,190) do echo !st:~%%j,10!&set "st1=!st1!!st:~%%j,10! "
echo.&echo 分段输出: !st1!
pause
bathman:
复制代码 代码如下:
@echo off
rem 随机生成200个字符
set "var=abcdefghijklnmopqrstuvwxyz0123456789+_/-"
:begin
set /a a=%random%%%40,n+=1
call,set "str=%str%%%var:~%a%,1%%"
if %n% neq 200 goto begin
rem 在一行内分段输出
:lp
set /a m+=1
set /p=%str:~,10% <nul&set "_%m%=%str:~,10%"
set "str=%str:~10%"
if defined str goto lp
rem 分行输出分段后字符
echo.&echo.&for /l %%i in (1,1,%m%) do call,echo %%_%%i%%
pause>nul
标签:
字符串,分段输出
圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com
暂无评论...
更新日志
2024年11月01日
2024年11月01日
- 群星.2023-非凡医者影视原声带【华纳】【FLAC分轨】
- 《寻找弗兰基》全成就一览
- 《传说法师2》EA评测:不是亲生的不心疼
- 《射戮骑士》评测:“幸存者!去杀穿硬核地狱!”
- 群星《名声(黑胶CD)》[WAV+CUE]
- 梅艳芳《女人花》SACD[原抓WAV+CUE]
- 孙露《因为想念》【WAV+CUE】
- 罗艺恒《What Could've Been》[FLAC/分轨][130.04MB]
- 罗熙楷《笼中鸟Caged Bird》[320K/MP3][72.27MB]
- 罗熙楷《笼中鸟Caged Bird》[FLAC/分轨][191.82MB]
- 英雄联盟s14晋级四强队伍是哪些 S14全球总决赛四强战队介绍
- 魔兽世界怀旧服专家模式什么时候开 怀旧服专家模式开启时间介绍
- 魔兽世界永久60级哪个职业最强 魔兽世界永久60级职业推荐
- 上海Major赛事专属版显示器首次亮相PNL高校决赛
- 寻找中国“龙” 感受乐元素的“科普力”