Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a variable length string starting with START and ending with END as delimiters.

I want to extract the string between START and END. I tried doing

SET _result=%String:~6,-4% ECHO %_result%

Its removing the first 5 characters but not the last 3 characters as I want.

Suppose, _result=STARTblahblahblahEND I am getting the output as blahblahblahEND

What I want is:- blahblahblah

share|improve this question

1 Answer 1

You could use the substring options. Would something like the below work?

SET TEXT=STARTblahblahblahEND
SET SUBSTRING=%TEXT:~5,-3%
echo %SUBSTRING%
share|improve this answer
    
Or switch to PowerShell ;) –  Julian Knight Jan 17 at 17:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.