Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to segment the string output as required by batch processing

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article shares with you about how batches output strings in segments as required. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Batch processing is required to randomly output 200characters to a line in 1.txt. The content is similar to the following:

Code:

Xh55q3ma+remgofm54sevhrna4g5r8pl9cjardezqjwj3m8itamh0a4itzd6jz8cmrfmibmhr0wmccyb8qnp2qh5rvlwff6yr2ez4eo063u6viy7ppw+nzxaxe8vrm190eei_0dwx5e2kxbds-ae6e96c9_i9glw8mz+uf6uienx9od8bktfnjlwlqu-e1rcj33_+4bz

2. Batch processing is required to output the contents of 1.txt into 10 characters in one segment, such as the following two forms:

Output in one line:

Code:

Xh55q3ma+r emgofm54se vhrna4g5r8 pl9cjardez qjwj3m8ita mh0a4itzd6 jz8cmrfmib mhr

0wmccyb 8qnp2qh5rv lwff6yr2ez 4eo063u6vi y7ppw+nzxa xe8vrm190e ei_0dwx5e2 kxbds-

Ae6e 96c9_i9glw 8mz+uf6uie nx9od8bktf njlwlqu-e1 rcj33_+4bz

Branch output:

Code:

Xh55q3ma+r

Emgofm54se

Vhrna4g5r8

Pl9cjardez

Qjwj3m8ita

Mh0a4itzd6

Jz8cmrfmib

Mhr0wmccyb

8qnp2qh5rv

Lwff6yr2ez

4eo063u6vi

Y7ppw+nzxa

Xe8vrm190e

Ei_0dwx5e2

Kxbds-ae6e

96c9_i9glw

8mz+uf6uie

Nx9od8bktf

Njlwlqu-e1

Rcj33_+4bz

- -

Requirements: the code is efficient, universal, concise and does not generate temporary files

Ps: please leave this question to the novice.

More:

The code is as follows:

@ echo off

Setlocal Enabledelayedexpansion

Set "str=abcdefghijklmnopqrstuvwxyz1234567890+-_"

For / l% an in (1 1 200) do (

Set / a "masked customers% 39"

Call set "var1 percent%% var1% strlux percent percent 1%"

)

Set "var=%var1%"

For / l% an in (1 1 20) do (

Set "var2 flowers, varvuts" 10!

Set / p =! var2! Nul

Shqf:

The code is as follows:

@ echo off

Set / p str=nul

Terse:

The code is as follows:

@ echo off&Setlocal Enabledelayedexpansion

Set "var=abcdefghijklmnopqrstuvwxyz1234567890+-_"

For / l%% I in (1 1200) do set / a "masked girls% 39" & call set stringers% varVRV examples examples 1%%

> 1.txt echo str%

For / l% I in (1 1 20) do set / paired struts do set 10! Nul

Pusofalse:

The code is as follows:

@ echo off&setlocal enabledelayedexpansion

Set var=abcdefghijklmnopqrstuvwxyz0123456789+-_

For / l% an in (1 1 200) do (

Set/a salary percentage 39%

Call,set axioms% varvvvarel percentage 1%.

)

Echo% a%&pause > nul&echo.

: lp

For / l% I in (010190) do if not defined b (set _ paired _% _. Nul&echo.&echo.&goto lp

Pause

Inittab:

The code is as follows:

@ echo off&setlocal enabledelayedexpansion

Set "str=1234567890abcdefghijklmnopqrstuvwxyz@#$_+-"

For / l% I in (0penny 1199) do (

Set/a ranching examples%% 42 percent call set "statically ordered percent percent struvage regulations percent"

)

Echo full-line output:! stalled echo. Separate echo output:

For / l% j in (0meme 10190) do (

Set / a masked% j

Call set "ST1 percent"

Call echo%% stuuuanzhongmu 10%%

)

Echo.&echo segmented output:! st1!

Pause

Netbenton:

The code is as follows:

@ echo off&setlocal enabledelayedexpansion

Set "str=1234567890abcdefghijklmnopqrstuvwxyz@#$_+-"

For / l%% I in (0Magne1199) do set/a ranching examples percent 42 percent for% an in (! ran!) Do set "statically installed stranded parts%% aPhone1!"

Echo full-line output:! stalled echo. Separate echo output:

For / l% j in (0Magne10190) do echo! STRO 10 minutes% jMagol 10 minutes set "ST1 scene scene ST1 boxes STG boxes% jMagne 10!"

Echo.&echo segmented output:! st1!

Pause

Bathman:

The code is as follows:

@ echo off

Rem randomly generates 200 characters

Set "var=abcdefghijklnmopqrstuvwxyz0123456789+_/-"

: begin

Set / an aversion% percentage%% 40 paramedic1

Call,set "str=%str%%%var:~%a%,1%%"

If n neq 200 goto begin

Rem output in segments in one line

: lp

Set / a macaque 1

Set / packs% struts nul 10%

Thank you for reading! On "batch processing how to segment the string output according to the requirements" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report