在bat文件中设置的cygwin环境变量 [英] cygwin environment variables set in bat file

查看:313
本文介绍了在bat文件中设置的cygwin环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要设置cygwin shell中应该可用的几个环境变量.

I need to set several environment variables that should be available in cygwin shell.

我尝试在〜/.bashrc中运行"c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64"/vcvars64.bat.脚本似乎可以运行,但是它不会更新环境变量.

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.

如何导出bat文件中设置的变量?

How can I export variables set in bat file?

推荐答案

取决于您要执行的操作.如果要访问Cygwin中的这些工具,则可以编辑.bash_profile并更新PATH=以匹配vcvars64.bat的内容.这就是我访问这些工具的方式.

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.

您也可以在启动Cygwin之前运行vcvars64.bat,方法是编辑{cygwin dir}/Cygwin.bat(假设您正在通过此文件启动Cygwin!)以在启动bash之前运行它.这样就可以设置DOS环境,而Cygwin可以选择它.

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.

这篇关于在bat文件中设置的cygwin环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆