-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error passing double quotes and spaces in install argument (-ia) #245
Comments
Try the following:
As per example here: https://chocolatey.org/packages/VisualStudio2013Ultimate If that doesn't work, you are going to need to work some magic with the ` (backtick) character, but I can never remember how that works :-) but @ferventcoder should be able to point you in the right direction. |
If you are in cmd.exe you can use just double quotes. If you are in powershell you need to work around it automatically removing the double quotes using backticks. |
Note that the message says, |
@PeterMosmans @gep13 can you verify my update to the documentation as working correctly? |
Looks good to me, not in a position to test it though, hopefully @PeterMosmans can confirm. Only comment would be to perhaps ditch the code highlighting of the ". Where you show an example of escaping a " with a ` it looks like there is a space between them, due to the code formatting. I can't think of a way to make that better, without ditching the highlighting though. Any ideas? |
@gep13 fixed. |
Thanks for the fast responses. When I try it from a command prompt with the syntax Error deserializing response of type chocolatey.infrastructure.app.domain.Registry: I get the same error when trying the backticked variants:
|
Have you tried the latest update to the documentation: https://github.com/chocolatey/choco/wiki/CommandsReference#how-to-pass-options--switches Where the backticks are escaping a " not a '? |
Yes, but that also unfortunately doesn't work:
|
Could the quotes/backquotes have somehow "damaged" the installation itself ? Without any options I get the same error message:
And in the logfiles:
|
Ok, one more variation: "/INSTALLDIRPUBJRE= NOTE: Only back-ticking the internal quotes, not the external |
Nope, sorry:
...and the same errors |
Could it be that due to all the tries the registry (?) is broken ?
Can I help by copying/uploading relevant logfiles ? |
Yep, upload them to a gist. Make sure to use |
Please find relevant (hopefully) logs here.. https://gist.github.com/PeterMosmans/2d3bdfbae7ace583bd20 I cannot seem to pass double quotes and spaces as install arguments |
@PeterMosmans are you using PowerShell to make these calls? This is going to get very interesting :/
|
https://connect.microsoft.com/PowerShell/feedback/details/376207/executing-commands-which-require-quotes-and-variables-is-practically-impossible
|
Well that was fun but I have it updated for you. https://github.com/chocolatey/choco/wiki/CommandsReference#how-to-pass-options--switches What quote values was meant to do was talk about quoting the ENTIRE argument, not just a section. What you really need is how to pass quotes in arguments to be passed through with quotes. I added that section with what we found here. |
@ferventcoder , thank you so much for helping me with this issue. I should have been clearer that I call chocolatey.exe from within a command shell. [DEBUG] - Command line: choco.exe install jre8 -ia "/INSTALLDIRPUBJRE=""C:\Program Files\Java\jre8""" -dv Thanks once again, especially for clarifying the documentation. At least something good came of it :) Cheers, Peter |
For the registry issue - follow #257 |
Hi,
I try to install jre8 with the following install argument:
/INSTALLDIRPUBJRE="%ProgramFiles%\Java\jre8"
. The system variable %ProgramFiles% contains a space (c:\Program Files
).From what I understood on the wiki (https://github.com/chocolatey/choco/wiki/CommandsReference#how-to-pass-options--switches ) you can use single quotes instead of double quotes.
However, I tried all sorts of combinations using single quotes, double quotes and escape characters (`), but chocolatey seems to refuse the syntax. When I check the logs I see that the double quotes andor space aren't passed correctly to the Java installer. Some results from the logs:
INSTALLDIRPUBJRE=C:\Program Files\Java\jre8
ConvertFrom-StringData : parsing "C:\Program Files\Java\jre8" - Unrecognized escape sequence \P.
INSTALLDIRPUBJRE=''C:\Program Files\Java\jre8 Error reading config file: "Invalid value" at line 1; char 1
Some (but not all) of the combinations tried (and failed):
-ia '/INSTALLDIRPUBJRE="C:\Program Files\Java\jre8"'
-ia '/INSTALLDIRPUBJRE=''C:\Program Files\Java\jre8'''
-ia '/INSTALLDIRPUBJRE="C:\Program\ Files\Java\jre8"'
-ia '/INSTALLDIRPUBJRE="C:\Program\ Files\Java\jre8"'
-ia '/INSTALLDIRPUBJRE="C:\Program\ Files\Java\jre8"'
-ia /INSTALLDIRPUBJRE="C:\Program\ Files\Java\jre8"
-ia '/INSTALLDIRPUBJRE="C:\Program Files\Java\jre8"'
-ia "/INSTALLDIRPUBJRE=C:\Program Files\Java\jre8"
-ia "/INSTALLDIRPUBJRE=
"%ProgramFiles%\Java\jre8
""-ia "/INSTALLDIRPUBJRE=
''%ProgramFiles%\Java\jre8
''"-ia '"/INSTALLDIRPUBJRE=''%ProgramFiles%\Java\jre8''"'
-ia "/INSTALLDIRPUBJRE=''%ProgramFiles%\Java\jre8''"
-ia '/INSTALLDIRPUBJRE="%ProgramFiles%\Java\jre8"'
-ia '/INSTALLDIRPUBJRE="%ProgramFiles%\Java\jre8"'
-ia '/INSTALLDIRPUBJRE=""%ProgramFiles%\Java\jre8""'
-ia '/INSTALLDIRPUBJRE=''%ProgramFiles%\Java\jre8'''
-ia "/INSTALLDIRPUBJRE=''%ProgramFiles%\Java\jre8''"
-ia ''/INSTALLDIRPUBJRE="%ProgramFiles%\Java\jre8''
-ia '/INSTALLDIRPUBJRE='';c:\Program;Files\Java\jre8'''
What would be the correct syntax ?
Thanks in advance,
Peter
The text was updated successfully, but these errors were encountered: