There are two fundamental differnt ways to handle function parameters
1) Use a parameter ByValue, like you do in CALL :myFunc %str%
This technic is simple but has also some limitations with special characters like quotes, spaces and carets.
You should at least quote the content to presever spaces and avoid problems with &|<> characters, but as said, it can't be used in any situation
Code: Select all
call :strlen " a b c "
2) Use a parameter ByReference, only the name of the variable is used, not the content itself, ex. CALL :myFunc str1
The advantage is, that the content won't be modified by the CALL and it's possible to handle any content.
set "str=This is a caret ^ and & other "Hard ^& special" content"
call :strLen str