I am trying to do some substring in windows batch programming, but it seems it's not as easy as linux scripting.
Here is my code snippet.
set ENV_STRING=-Dhello.env=hello -Dhello.alt.dir=C:\Works\download -Dhello.type=DDDDD
set START_INDEX=34
set END_INDEX=51
SET newStr=%ENV_STRING:~%START_INDEX%,%END_INDEX%%
START_INDEX and END_INDEX will change depending on the ENV_STRING which will be provided by a user. I am using static integers for START_INDEX and END_INDEX just to show that these variables are used. I just want to extract the value of hello.alt.dir from ENV_STRING.
When I print out newStr, it doesn't substring the string.
Could someone please point out which part is wrong?
Thanks.