“Illegal characters in path” Problem with Windows 10

I was recently working with Amazon’s guide to setting up CodeCommit via HTTPS on Windows 10 (http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-windows.html), and I got up to the section titled “Step 3: Set Up the Credential Helper”. I ran the code they suggested:

Only to be greeted by this error:
1 - Error Message

Took me a little while to figure this one out.

When I first looked at the new Windows 10 PATH editor, I was pretty impressed – no longer did I have to deal with a single textbox for the entire PATH, within a window that didn’t allow me to resize it. Instead, I have a spiffy new editor where I can modify things line-by-line. And look at that, a “Browse” button! How useful!
2 - PATH Editor

Here’s tip #1 – don’t click that Browse button immediately. It will overwrite whatever you have selected – which will be the top option initially, which by default is %SystemRoot%\system32…don’t remove that from your PATH. Trust me. Instead, first hit the “New” button, then hit “Browse”. You can now browse around on your file system for folders and add them to your PATH. In my case, I had just installed Git, and I needed to add it. So, I browsed around for the Git install location and added it, and the location was added for me to the PATH:

3 - Git Added

Note those quotation marks. Seems like it should be fine, after all, “Program Files” has a space in it. Opening a new CMD window, I could run the git command just fine. I continued on with the Amazon instructions, until I ran the code that I pasted above, and got that error – “Illegal characters in path.” Strange, I don’t think there’s anything wrong with my PATH, everything else works just fine. I decided to double check, opening the PATH editor again:

4 - Quotation Marks are Gone

Note that the quotation marks are now gone, having exited and re-entered the PATH editor. I didn’t know what I was supposed to be looking for, and I didn’t notice the additional quotation marks the first time, so I didn’t think anything of it – but it turns out that the UI adds quotation marks when you use the Browse button, and after exiting and re-entering, it hides those quotation marks. Note that it ONLY hides them, it does NOT delete them – they’re actually still there, you just can’t see them.

There are two methods to see what’s ACTUALLY in your PATH. The first is to use the “old” editor, which at least now can be resized, which is nice. Just click on the “Edit Text” button:

5 - Edit Text

The other way to do it is to open your command prompt and run “ECHO %PATH%”:

6 - Echo Path CMD

Both will show you the quotation marks that the new Windows 10 PATH editor hides. Now that you know which PATH entries secretly have quotation marks, go back into the PATH editor and delete those entries and enter them manually (or use the Browse button, but delete the automatically added quotation marks before hitting OK).

Now the Amazon Credentials Helper should work! Remember that you’ll need to open a different command prompt every time you make a change to your PATH.

Jake Binstein is a QA engineer for a software firm, and enjoys programming and messing around with Linux. In his free time, he can be found managing the array of servers under his bed, and obsessing over a single misplaced pixel. His personal website is JakeBinstein.com

View all posts by Jake Binstein →

  • Chandrasekar Hariharan

    Great Find ! Helped alot thanks.!

  • Michael Li

    Thanks a lot for this, this solved my problem!