how to pass a parameter with space or ; to function?
call :MyFunct "arg1" "arg2 arg2";"arg2"
:MyFunct
echo %~2
I would like to retrieve from %~1 "arg2 arg2";"arg2" but do not know how to do
For your sample "arg1" "arg2 arg2";"arg2" the arguments are
arg1="arg1"
arg2="arg2 arg2"
arg3="arg2"
That's simply the rule of cmd.exe, any unquoted delimiter in the arguments splits arguments, delimiters are <space>;,=
If you want a different behavior, you need to write your own parsing function on the basis of %* or even better on the bullet proof argument reading
"one two";"tree"is two doublequoted arguments separated by a semicolon.%~1is the first argument, with any surrounding doublequotes removed. Have you tried%*for all of the arguments together?%~1is the first argument, (with enclosing doublequotes removed),arg1,%~2is the second argument, (with enclosing doublequotes removed),arg2 arg2, and%~3is the third argument, (with enclosing doublequotes removed),arg2. Spaces, commas and semicolons and even unquoted equals characters are considered as argument delimiters. How about you better show where thecallargument string is coming from, and exactly what you wish to isolate from each part of it.