Double quotes structure is not retained in my test message when passed through a powershell instance called through a batch script, as detailed below:
set test={"this":"is","a":"test"}
FOR /F "delims=" %%i in (' powershell -Command "& {$message = '%test%'; echo $message}" ') DO SET message=%%i
echo %test%
echo %message%
the output is as follows:
{"this":"is","a":"test"}
{this:is,a:test}
I would like to retain the quotes to further process the string in powershell, but as you can see, they are stripped when introduced into the $message variable.
Any insight as to how I might fix this?
set test={""this"":"is"",""a"":""test""}, see also: stackoverflow.com/a/15262019/1701026{""this"":""is"",""a"":""test""} {"this:is,a:test}The latter being the output from powershell. Only the first doublequote escapes, but not anything else.\"when calling the CLI (perhaps surprisingly, given that PowerShell-internally it is`"or"").