force:data:tree:export fails if username contains a whitespace
Summary
force:data:tree:export fails if the username contains a space.
Steps To Reproduce:
- Have a Windows user where the username contains a whitespace (e.g. Time Lord)
- Run this command
sfdx force:data:tree:export -q "SELECT Name, Location__Latitude__s, Location__Longitude__s FROM Account WHERE Location__Latitude__s != NULL AND Location__Longitude__s != NULL" -d ./data
Expected result
This should export the data defined by the query.
Actual result
'C:\Users\Time' is not recognized as an internal or external command, operable program or batch file.
Additional information

SFDX CLI Version sfdx-cli/6.55.1-be0b3dc4c4 (windows-x64) node-v8.9.4
SFDX plugin Version @salesforce/plugin-generator 1.0.1 (core) @salesforce/sfdx-trust 2.0.1 (core) builtins 1.0.0 (core) salesforcedx 45.4.1 (core)
OS and version: Microsoft Windows [Version 10.0.17134.590]
@LaszloFoldi - Thank you for reporting this. I reproduced the bug and the fix will be prioritized for a future patch release.
@LaszloFoldi , I see you are on an older version of sfdx(6.x.x). Could you please update to a newer version(7+) and let me know if you still encounter the same error.Thanks!
@nramyasri-sf I did it. Here is my new version info:
sfdx-cli/7.3.0-94ecf2d5ee win32-x64 node-v10.15.3
The results are exactly the same as in the original report.
@LaszloFoldi If you ran sfdx update to get v7, that's not enough to fix this issue. Unless you have already, can you download and run a fresh v7 installer and try again?
@rbergman I just did a clean install, and I still get this error.
WI for internal tracking: W-5910476
I think we can improve the cmd entrypoint to escape spaces better: https://github.com/salesforcecli/cli/blob/d6c08424d5536916d125edc0641269732a94fd7a/bin/run.cmd#L3
note: fix this in CLI and in oclif CLI templates.