I can see windows system variables in cygwin with

echo $MYVar

However, user variables don't seem to work. I'm referring to the variables you set in system properties->advanced->environment variables (red arrow). Does Cygwin only import system variables?

Environment and User Variables


Under normal circumstances, it should import both.

The exception that most likely applies in your case is that you're using an SSH client as your terminal. In this case, Cygwin does not import the user vars. Are you SSHing to your own workstation using PuTTY or another such SSH client? If you're not sure, try running the command echo $SSH_TTY. If you don't get a blank output to that command, that means your shell instance is being run via an SSH client, and the user's local environment vars will not be imported in this case.

You have two choices to solve this... You can either use a local terminal client like Mintty or rxvt instead of SSHing, both of which come native with Cygwin, or you can edit your Cygwin profile file in /etc to tell it not to skip local vars when running through SSH. This link shows how that can be done... http://smithii.com/node/44

  • This is a great answer, so credit given. However, my problem was just a novice Windows mistake; I assumed once I hit the 'OK' button shown above, my variable would be created, but in fact it seems you have to hit the 'OK' in System Preferences and close it before any changes take place. And you also need to restart Cygwin to import the new variable. Doh. – AlexMA Feb 5 '13 at 22:23
  • 2
    My cygwin install isnt reading my user path, only my system path. i need it to read both – Northstrider May 2 '15 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.