1. batch processing random output of rows to a line in 1.txt. The content is similar to the following:
Code:
Xh45q3ma + hybrid + nzxaxe8vrm190eei_0dwx5e2kxbds-ae6e96c9_i9glw8mz + uf6uienx9od8bktfnjlwlqu-e1rcj33 _ + 4bz
Second, you need to use batch processing to output the content in 1.txt to a segment of 10 characters, as shown in the following two forms:
Output in one row:
Code:
Xh45q3ma + r emgofm54se vhrna4g5r8 pl9cjardez q1_j3m8ita mh0a4itzd6 jz8cmrfmib mhr
0 wmccyb 8qnp2qh4rv lwff6yr2ez 4eo063u6vi y7ppw + nzxa xe8vrm316e ei_0dwx5e2 kxbds-
Ae6e 96c9_i9glw 8mz + uf6uie nx9od8bktf njlwlqu-e1 rcj33 _ + 4bz
Branch output:
Code:
Xh45q3ma + r
Emgofm54se
Vhrna4g5r8
Pl9cjardez
Qinij3m8ita
Mh0a4itzd6
Jz8cmrfmib
Mhr0wmccyb
8qnp2qh4rv
Lwff6yr2ez
4eo063u6vi
Y7ppw + nzxa
Xe8vrm190e
Ei_0dwx5e2
Kxbds-ae6e
96c9_i9glw
8mz + uf6uie
Nx9od8bktf
Njlwlqu-e1
Rcj33 _ + 4bz
Certificate ----------------------------------------------------------------------------------------------------------------------------------------------------
Requirements: code is efficient, common, concise, and does not generate temporary files
Ps: Ask the experts to leave this question to the novice.
More:Copy codeThe Code is as follows: @ echo off
Setlocal Enabledelayedexpansion
Set "str = abcdefghijklmnopqrstuvwxyz1234567890 + -_"
For/l % a in (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:Copy codeThe Code is as follows: @ echo off
Set/p str = <1.txt
Set/p select = 1. display of segments in one row 2. display of branches (select 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:Copy codeThe Code is as follows: @ echo off & Setlocal Enabledelayedexpansion
Set "var = abcdefghijklmnopqrstuvwxyz1234567890 + -_"
For/l % I in (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:Copy codeThe Code is as follows: @ echo off & setlocal enabledelayedexpansion
Set var = abcdefghijklmnopqrstuvwxyz0123456789 + -_
For/l % a in (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:Copy codeThe Code is as follows: @ echo off & setlocal enabledelayedexpansion
Set "str = 1234567890abcdefghijklmnopqrstuvwxyz @ # $ _ + -"
For/l % I in (199,) do (
Set/a ran =! Random! % 42 & call set "st =! St! % Str :~! Ran !, 1% %"
)
Echo output in the whole line :! St! & Echo. & echo:
For/l % j in (190,) do (
Set/a m = % j
Call set "st1 =! St1! % St :~! M !, 10% %"
Call echo % st :~! M !, 10% %
)
Echo. & echo multipart output :! St1!
Pause
Netbenton:Copy codeThe Code is as follows: @ echo off & setlocal enabledelayedexpansion
Set "str = 1234567890abcdefghijklmnopqrstuvwxyz @ # $ _ + -"
For/l % I in (199,) do set/a ran =! Random! % 42 & for % a in (! Ran !) Do set "st =! St !! Str :~ % A, 1! "
Echo output in the whole line :! St! & Echo. & echo:
For/l % j in (190,) do echo! St :~ % J, 10! & Set "st1 =! St1 !! St :~ % J, 10! "
Echo. & echo multipart output :! St1!
Pause
Bathman:Copy codeThe Code is as follows: @ echo off
Rem generates 200 characters at random
Set "var = abcdefghijklnmopqrstuvwxyz0123456789 + _/-"
: Begin
Set/a = % random % 40, n + = 1
Call, set "str = % str % var :~ % A %, 1% %"
If % n % neq 200 goto begin
Rem multipart output in a row
: Lp
Set/a m + = 1
Set/p = % str :~, 10% <nul & set "_ % m % = % str :~, 10%"
Set "str = % str :~ 10%"
If defined str goto lp
Rem branch outputs segmented characters
Echo. & echo. & for/l % I in (, % m %) do call, echo % _ % I %
Pause> nul