-1

I was wondering how to assign all the text from 1 point in a string to another point in the same string, to a variable.

For example:

set special=K
set string=don't_add_meKadd_meKdon't_add_me

I was just wondering how to "extract" the add_me and assign it to a variable.

1 Answers1

1

You can use substrings to get the part of the string if you know exactly where in the string it is.

set string=don't_add_meKadd_meKdon't_add_me
set add_me_part=%string:~13,6%

Or, since it seems you're using K as a delimiter, you can use a for loop:

set string=don't_add_meKadd_meKdon't_add_me
for "delims=K" %%A in ("%string%") do set add_me_part=%%B
SomethingDark
  • 13,229
  • 5
  • 50
  • 55