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 realize the function of string interception in batch processing

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to achieve string interception in batch processing. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

The code is as follows:

:: code by lxmxn @ cn-dos.net.

Objective: to help beginners better understand the function of variable character interception.

:: Date 2006-12-16.

:: description: some variables are empty after intercepting, which is normal.

::

@ echo off&setlocal EnableDelayedexpansion

:: set the value of variable var:

Set var=0123456789ABCDEF

Call: begin

For / l% an in (1meme 3je 15) do (

For / l% b in (1meme 4mem15) do (

Call: printf% a% b

)

)

Call: begin

For / l% an in (1meme 4je 15) do (

For / l% b in (- 1) do (

Call: printf% a% b

)

)

Call: begin

For / l% an in (- 2 mai Yu 3 mi mi 15) do (

For / l% b in (1meme 4mem15) do (

Call: printf% a% b

)

)

Call: begin

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

For / l% b in (- 2 mai Yu 3 mi mi 15) do (

Call: printf% a% b

)

)

Pause

Endlocal&cls&echo.

Echo demo is over, any key to exit.

Pause > nul

Goto: eof

:: output result:

: printf

The character intercepted by echo% var:~%1,%2%% is:! var:~%1,%2!

Goto: eof

:: clean the screen:

: begin

Echo\ & pause&cls&echo.

The value of the echo variable var is:% var%

Echo.

Goto: eof

This is the end of this article on "how to intercept strings in batch processing". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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