batch substring 1

batch substring

REM # | EXAMPLE
set "StringA=Some random string this is"
echo %StringA:~5,6%

REM # | SYNTAX
REM # | %:~,%

Here is what the above code is Doing:
1. We’re setting a variable called StringA to a string value.
2. We’re then using the substring syntax to extract a substring from StringA.
3. The substring starts at index 5 and is 6 characters long.
4. The substring is then echoed to the console.

The output of the above code is:
random

Similar Posts