I was going through the App Development with Salesforce DX trailhead and everything was going smoothly until I tried to export the sample data with the following 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

I get the error

'C:\Users\Kasper' is not recognized as an internal or external command, operable program or batch file.

Since the error message breaks off my Windows 10 username at the first white space I am assuming that this is the cause. I came across this question where it is suggested that it could be a bug: salesforce dx command line error while exporting data

However, it states no solution expect to create a new Windows user. I'd really love a better solution or work around? Also, if you happen to have a space in your Windows username and got it to work I'd love to know.

On a side note, does anyone have any experience with reporting bugs in SFDX? Is that better or worse than the normal process of reporting bugs?

  • As with the other question, looks like DX may be struggling with whitespace in the username - have you tried running it from a directory that doesn't have whitespace in it in case that's the issue?
    – berry120
    Commented Feb 16, 2018 at 16:27
  • 1
    @berry120 Thanks for the suggestion. That was what I thought too. I copied the directory to a different place but that didn't help. To be absolutely certain just I started the trailhead from the beginning in a new directory without any spaces, but it didn't solve the problem. If you have more suggestions I'd love to hear them!
    – Kasper
    Commented Feb 16, 2018 at 17:09
  • Hmm, that is odd - what's the error you get when you run it from a directory without spaces?
    – berry120
    Commented Feb 16, 2018 at 17:18
  • 1
    Asking in the MVP channel. I'll see if I get anything this time.
    – sfdcfox
    Commented Feb 16, 2018 at 17:55
  • 1
    @Kasper Putting a space in a user name in Windows is just asking for trouble. SFDX isn't the only software I've ever seen that has issues with it. Even some Microsoft tools have had issues with spaces in the past. In fact, the default user creation for Windows 10 Home is to use just the first name of the user.
    – sfdcfox
    Commented Feb 16, 2018 at 17:57

1 Answer 1


As answered there: it would seem that SFDX does not handle spaces in the LOCALAPPDATA environment variable (while still claiming to support Windows).

The workaround is to use short names. In a command line, execute:


This command line is then ready for SFDX use.

Note : in a batch file, do not forget to double the % sign.

  • Hi Mac! Thank you for your answer. After I heard of @sfdxfox solution I changed my Windows username to one without spaces. However after that i got swamped with other projects so I haven't been able to test if that solves my problem. (I hope to do that soon.) I like your solution a lot though, because I now know that switching Windows user names is quite a bit of work and error prone too.
    – Kasper
    Commented Jun 18, 2018 at 15:30
  • any downsides to this, is it going to change options that may break other apps in any way?
    – VarunC
    Commented Jul 10, 2019 at 11:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .