Context: I need to call a Windows batch script which would update my PATH
by adding another path \'xxx
\' at the end of it, but:
Yay! Finally got this working with the following test code:
@echo off
Setlocal enabledelayedexpansion
Set p="hello world"
( endlocal & rem return
Set "a1=%p%"
)
Set a1
This outputs:
a1="hello world"
The reason I used delayed expansion in the test without using any !'s is because it still effects how set works and the batchs I'm testing this for all have delayed expansion.
Thanks for the help guys :o)
PS I tried using the same variable name for both local and external environments but this broke the code. Hence the 2 names used.