CockroachDB Cloud Free Connect Error

I’m new to CockroachDB. I setup a Cloud Free cluster. I loaded the CockroachDB client on Windows and downloaded the CA Cert. When I tried to connect in Windows Powershell using this command (password starred out):

cockroach sql --url 'postgresql://ddetton:************'$env:appdata'\.postgresql\root.crt&options=--cluster%3Dddetton-2824'

I get this result:

ERROR: unknown command "C:\\Users\\Dean\\AppData\\Roaming\\.postgresql\\root.crt&options=--cluster%3Dddetton-2824" for "cockroach sql"

I have verified the cockroachdb is on my path and the AppData environment string is set correctly. I have also verified that the cert is in the right place. Not sure where to go from here. Looking for some guidance. Thanks!

To be able to do what you are trying to do (if I understand correctly), you need to change the single quotes around the url to double quotes and also to remove the single quotes around $env:appdata. That will allow the expansion of $env:appdata and also allow un-escaped(single) \ slashes. You can use single quotes around the url as well but in this case you won’t be able to use $env:appdata and you will have to replace it with C:\Users\Dean…\root.crt. Note that all slashes need to be escaped (doubled) in this case.

That worked. Thanks! Appreciate your help.