Displays the characters between two characters and _dos/bat

Source: Internet
Author: User
Tags goto
Copy Code code as follows:

:: For example, I enter AF on the display
:: A
:: b
:: C
::d
:: E
:: F
:: One line for each letter "I do not know whether it can be achieved."

@echo off
::
::
: Begin
Cls
Set Str=a b c d E F g h i j k l m n o p q R S t u v w x y Z
Set input=
set/p input= Please enter a letter range (such as AF):
Call Set str=%%str:%input:~0,1%=-☆%input:~0,1%%%
Call Set str=%%str:%input:~-1%=%input:~-1%☆%%
for/f "tokens=2 delims=☆"%%i in ("%str%") do set str=%%i
For%%i in (%str%) do echo%%i
Pause
Goto BEGIN

@echo off
::
::
Set Str=a b c d E F g h i j k l m n o p q R S t u v w x y Z
: Begin
Cls
Set flag=0
Set var=
Set input=
set/p input= Please enter a letter range (such as AF):
For%%i in (%str%) does call:p Ickup%%i

: End
Pause
Goto BEGIN

:p Ickup
if/i '%1 ' = = '%input:~0,1% ' Set flag=1
if/i '%1 ' = = '%input:~-1% ' Set flag=2
If%flag% equ 1 echo%1
If%flag% equ 2 echo%1&goto end
Goto:eof

@echo off
:: First encode each element of the string and then convert it
::
::
Setlocal enabledelayedexpansion

Set Str=a b c d E F g h i j k l m n o p q R S t u v w x y Z
For%%i in (%str%) do set/a dec+=1 & set%%i=!dec! & Set str!dec!=%%i
Set en=
set/p en= Please enter a letter range (such as AF):
set/a num1=!%en:~0,1%!,num2=!%en:~-1%!
FOR/L%%i in (%num1%,1,%num2%) do echo!str%%i!
Pause>nul
Goto:eof

@echo off
:: By comparing the size of the character's internal code to achieve, the limitations are very large
::
::
Setlocal enabledelayedexpansion

Set Str=a b c d E F g h i j k l m n o p q R S t u v w x y Z
Set en=
set/p en= Please enter a letter range (such as AF):
Set str1=%en:~0,1%
Set str2=%en:~-1%
For%%i in (%str%) do if%%i geq!str1! if%%i leq!str2! echo%%i
Pause>nul
Goto:eof

@echo off
:: Disadvantage: Slow speed
::
::
: Begin
set/p a= "Old-hee:"
Set Str=a b c d E F g h i j k l m n o p q R S t u v w x y Z
For%%i in (%str%) do echo%%i|findstr [%a:~0,1%-%a:~-1%]
Pause
Goto BEGIN

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.