Search code examples
chocolatey

How do I pass parameters that contain spaces?


I want to pass the following "javaoptions" containing a file path with spaces within --params.

--params "'/javaoptions:-Dwebdriver.jx.browser="C:/Program Files (x86)/TestNav/TestNav.exe"'"


Solution

  • This is how you can get it to work:

    choco install -y selenium --params "'/role:node /hub:http://localhost:4444 /capabilitiesJson:$capabilitiesJson /autostart /maxSession:1 /javaoptions:""-Dwebdriver.jx.browser=\`"C:\PROGRA~2\TestNav\TestNav.exe\`"""'" --force -d
    

    Note that $capabilitiesJson is being interpolated properly.