If you execute this:
if "true" == "true" (
echo Path is C:\Program Files (x86)\MyFolder
)
You will get an error:
\MyFolder was unexpected at this time.
This is the same if a path is passed to echo as a variable.
There is a solution. This can be fixed by surrounding the text for echo with double quotes (or just the path itself).
However this adds double quotes to the output text:
Path is "C:\Program Files (x86)\MyFolder"
Is there any way to handle this situation without altering output?