Batch processing implements code to segment output as required _dos/bat

Source: Internet
Author: User
Tags goto
One, the request uses the batch processing random output 200 characters to 1.txt the row, the content is similar as follows:
 
Code:
xh45q3ma+ remgofm54sevhrna4g5r8pl9cjardezqjwj3m8itamh0a4itzd6jz8cmrfmibmhr0wmccyb8qnp2qh4rvlwff6yr2ez4eo063u6viy7ppw+ Nzxaxe8vrm190eei_0dwx5e2kxbds-ae6e96c9_i9glw8mz+uf6uienx9od8bktfnjlwlqu-e1rcj33_+4bz
Second, the request to use batch processing 1.txt content in 10 characters for a section of output, as in the following two forms:
Output within a single line:
 
Code:
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
Branch output:
 
Code:
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
--------------------------------------------------------------------------------------------------------------- -------------------------------------
Requirements: Code is efficient, generic, concise, and does not produce temporary files
PS: Please the veteran to leave the subject to the novice to complete

More
Copy Code code as follows:

@echo off
Setlocal enabledelayedexpansion
Set "Str=abcdefghijklmnopqrstuvwxyz1234567890+-_"
FOR/L%%a in (1 1) Do (
set/a "M=!random!%%39"
Call set "var1=%%var1%%%%str:~!m!,1%%"
)
Set "var=%var1%"
FOR/L%%a in (1-1) Do (
Set "var2=!var:~,10!"
set/p =!var2! <nul
Set "var=!var:~10!"
)
Echo.&echo.&set "var=%var1%"
FOR/L%%a in (1-1) Do (
Set "var2=!var:~,10!"
echo.! var2!
Set "var=!var:~10!"
)
Pause>nul

 

SHQF:
Copy Code code as follows:

@echo off
set/p Str=<1.txt
Set/p select=1. Show 2. Branch Display (Please 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 Code code as follows:

@echo off&setlocal enabledelayedexpansion
Set "Var=abcdefghijklmnopqrstuvwxyz1234567890+-_"
FOR/L%%i in (1 1) do set/a "m=!random!%%39" &call set str=!str!%%var:~!m!,1%%
>1.txt Echo%str%
FOR/L%%i in (1 1) do set/p=!str:~,10! <nul&set "%%i=!str:~,10!" &set "str=!str:~10!"
Echo.
FOR/L%%i in (1 1) do echo.! %%i!
Pause>nul

 

Pusofalse:
Copy Code code as follows:

@echo off&setlocal enabledelayedexpansion
Set Var=abcdefghijklmnopqrstuvwxyz0123456789+-_
FOR/L%%a in (1 1) Do (
set/a n=!random!%%39
Call,set a=!a!%%var:~!n!,1%%
)
Echo%a%&pause>nul&echo.
: LP
for/l%%i in (0 190) does 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 Code code as follows:

@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 Full line output:!st!&echo.&echo column output:
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 Segmented output:!st1!
Pause

 

Netbenton:
Copy Code code as follows:

@echo off&setlocal enabledelayedexpansion
Set "str=1234567890abcdefghijklmnopqrstuvwxyz@#$_+-"
FOR/L%%i in (0,1,199) does set/a ran=!random!%%42&for%%a in (!ran!) do set "st=!st!! str:~%%a,1! "
echo Full line output:!st!&echo.&echo column output:
FOR/L%%j in (0,10,190) do echo!st:~%%j,10!&set "st1=!st1!! st:~%%j,10! "
Echo.&echo Segmented output:!st1!
Pause

 

Bathman:
Copy Code code as follows:

@echo off
REM randomly generates 200 characters
set "var=abcdefghijklnmopqrstuvwxyz01234567 89+_/-'
: Begin
set/a a=%random%%%40,n+=1
call,set ' str=%str%%%var:~%a%,1%% '
if%n% neq Goto b Egin
REM Segment output in one row
: LP
set/a m+=1
set/p=%str:~,10% <nul&set "_%m%=%str:~,10%"
Set "s tr=%str:~10% "
If defined STR goto LP
REM branch output segmented after character
echo.&echo.&for/l%%i in (1,1,%m%) do call,e Cho%%_%%i%%
Pause>nul

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.