chocolatey / cChoco

Community resource to manage Chocolatey
Apache License 2.0
153 stars 99 forks source link

Params values underescaped #111

Closed mdonoughe closed 5 years ago

mdonoughe commented 6 years ago

I tried to use:

cChocoPackageInstaller Vs2017 {
    Name = 'visualstudio2017enterprise'
    Params = "--installPath `"E:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise`""
}

This fails because the install command comes out as:

choco install visualstudio2017enterprise -y --params="--locale en-US --installPath "E:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise""

leading to the error:

The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify the path is correct and try again.

If I use single quotes instead of double quotes I get the same error, but in yellow instead of red.

It looks like if I use instead

cChocoPackageInstaller Vs2017 {
    Name = 'visualstudio2017enterprise'
    Params = "--installPath E:\Program`` Files`` ``(x86``)\Microsoft`` Visual`` Studio\2017\Enterprise"
}

it installs successfully.

pauby commented 6 years ago

What happens if you use:

cChocoPackageInstaller Vs2017 {
    Name = 'visualstudio2017enterprise'
    Params = "--installPath 'E:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise'"
}

You did mention you used single quotes instead of double quotes but didn't give the command so not sure exactly what you did.

mdonoughe commented 6 years ago

That's probably equivalent to what I did. Changing the quotes on the outside of the string shouldn't make any difference if it's not causing parse errors while building the configuration. I don't have a system to confirm the behavior right now.

pauby commented 5 years ago

Not much more we can do with this just now. However we can always re-open it later.