0

If a user were to input: "program.bat --execute -s 1000 -r 60"

How can I extract the input as one string starting from "-s" to the end (the end could have unlimited number of parameters). In this case, I'd want "-s 1000 -r 60".

I want to do something like:

if "%1"=="--execute"
   grab the rest of the arguments 

I know %* grabs all the arguments, but I only want -s till the end.

user1224478
  • 345
  • 2
  • 5
  • 15
  • Does [this question](http://stackoverflow.com/q/13311756/62576) and it's accepted answer not help you? – Ken White May 07 '15 at 21:53
  • Nothing I know of. I'd write a small utility program that would process the %* string, or use a regex processor. – azt May 07 '15 at 21:53

1 Answers1

0

You already know that %* starts with --execute, so it is safe to delete everything up through the first occurrance of --execute.

set args=%*
if %1 equ --execute echo args=%args:*--execute=%
dbenham
  • 127,446
  • 28
  • 251
  • 390