The bat script intercepts a string, how does bat intercept such a string?

Updated on technology 2024-04-18
8 answers
  1. Anonymous users2024-02-08

    It seems to be BAT, and it is difficult to achieve it with the following methods.

    dir /b >

    Then use a texter or word to replace the - sign with a comma or tab, and then import it into Excel, and you can separate.

    If you need to repeat the operation, you can create a macro in Excel. Data Get external data from text, import txt file, set the delimiter to a - sign, copy the required columns after importing, or delete the unwanted columns and save them as a txt file.

  2. Anonymous users2024-02-07

    Achievable, ** is as follows:

    Note: Put ** into the same directory as the original text, and modify the "for the original text name," in ** to be the name of the new text after extraction. If you don't understand, you can continue to ask.

    %a==return goto :2) echo running error! pauseexit: 2echo extraction complete! pause has been tested and the source is attached.

    Answer, support me.

  3. Anonymous users2024-02-06

    The variable is a full path that is easy to handle with the for command.

  4. Anonymous users2024-02-05

    In the for section, take out the path in front of the string.

  5. Anonymous users2024-02-04

    Truncating strings is arguably one of the most commonly used sub-functions of string processing:

    echo off

    set ifo=abcdefghijklmnopqrstuvwxyz0123456789

    echo original string (the second line is the ordinal number of each character):

    echo %ifo%

    echo 123456789012345678901234567890123456

    echo Truncate the first 5 characters:

    echo %ifo:~0,5%

    echo to take the last 5 characters:

    echo %ifo:~-5%

    echo truncates the first to the 6th to last character:

    echo %ifo:~0,-5%

    echo starts with the 4th character and truncates 5 characters:

    echo %ifo:~3,5%

    echo starts with the 14th from the bottom and truncates 5 characters:

    echo %ifo:~-14,5%

    pause, e.g. replacing a string, that is, replacing a specific character or string in a string with a given string.

    echo off

    set aa=Great China! I'm proud of you!

    ECHO before replacement: %aa%.

    ECHO POST: %AA: China = People's Republic of China %ECHO AA = %AA%

    set "aa=%aa: China=People's Republic of China %"

    echo aa = %aa%

    pause

  6. Anonymous users2024-02-03

    @echo off

    color fd

    set str=abcde)fg

    **The second half has been deleted.

  7. Anonymous users2024-02-02

    1 If it is the part after the leftmost specific character (string), it can be used.

    set "myvarb=%myvara:*.=%"

    It means that the variable myvara is the first. and the previous part is replaced with empty.

    then myvarb obtains.

    Of course, continuing this method always ends with the last part.

    get2 For the part after the last dot, think of it as a file name with a suffix.

    for %%i in ("%myvara%") do set "vq=%%~xi"

    set "myvarb=%vq:.=%"

    Note: The quotation marks after the set command are not necessary%% xi indicates that the suffix for the double %% symbol in the command should be changed to single % if it is used on the command line

    Because the suffix name is band. , and replace the dot with empty (or remove the first character set"myvarb=%vq:~1%")

    3 The for command is a circular command, and the syntax is more complicated, such as okay:

    for %%i in ("%myvara:.=","%") do set "myvarb=%%~i"

    Place the original string each. Replace it with","And put quotation marks at the beginning and end, so that it is formed"the","last","stand"strings.

    It will use a comma as a separator to cycle through the assignment command after do, and although it is executed 3 times, the last time is the final assignment situation.

    There are other ways to do this, but it is recommended to familiarize yourself with a simple command such as set before studying a complex command such as for.

  8. Anonymous users2024-02-01

    I don't really understand what you mean, try it, it's not what you want.

    echo off

    for /f "tokens=1 delims=@ " %%i in ( do echo %%i

    The pause reads as follows:

Related questions
12 answers2024-04-18

Two methods:

1: fileext=right("images/", 3) two: filename="images/" >>>More

12 answers2024-04-18

Alignment is how paragraph content is arranged horizontally between the left and right boundaries of the document. There are a total of 5 alignment styles in Word: Left Alignment, Right Alignment, Center Alignment, Ends Alignment, and Scattered Alignment. >>>More

11 answers2024-04-18

First of all, it is necessary to understand what a binary tree is (and I guess the subject also understands). >>>More

5 answers2024-04-18

Add a field in Table 1 as a foreign key and Billno in Table 2 >>>More

7 answers2024-04-18

The string is immutable, and the list is mutable.

That is to say, once the meaning of the string is determined, it cannot be changed, but the list can. >>>More