Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 3 down vote accepted

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...

share|improve this answer
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
My cygwin install isnt reading my user path, only my system path. i need it to read both – meffect May 2 '15 at 6:13

You must log in to answer this question.

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