问题
I need to set several environment variables that should be available in cygwin shell.
I tried running "c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64"/vcvars64.bat
in ~/.bashrc. Script seems to run but it does not update environment variables.
How can I export variables set in bat file?
回答1:
Depends upon what you are trying to do. If you want access to those tools within Cygwin you can edit your .bash_profile
and update your PATH=
to match what vcvars64.bat
has. This is how I get access to those tools.
You can also run vcvars64.bat
before starting Cygwin by editing your {cygwin dir}/Cygwin.bat
(assuming you're starting Cygwin via this file!) to run it before starting bash. This way the DOS environment would be set and Cygwin would pick it up.
来源:https://stackoverflow.com/questions/15430807/cygwin-environment-variables-set-in-bat-file