每次我启动cmd时,是否可以运行vcvars32.bat? [英] Is there a way to run vcvars32.bat every time I start a cmd?
问题描述
我在cmd
中使用cl
,每次打开cmd
窗口时都必须运行vcvars32.bat
,这对于axx来说确实很痛苦.谁能提供一种自动运行的方式?
I'm using cl
in cmd
and having to run vcvars32.bat
every time I open a cmd
window is really a pain in the axx. Can anyone offer a way of running it automatically?
推荐答案
来自cmd /?
:
如果未在命令行上指定/D,则当CMD.EXE启动时,它将 查找以下REG_SZ/REG_EXPAND_SZ注册表变量,如果 一个或两个都存在,将首先执行它们.
If /D was NOT specified on the command line, then when CMD.EXE starts, it looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if either or both are present, they are executed first.
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
and/or
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
因此,您可以将vcvars32.bat
添加到这些AutoRun注册表值之一,以使其对每个 cmd.exe
实例执行(当然,明确指定/D
时除外).
You therefore could add vcvars32.bat
to one of those AutoRun registry values to have it executed for every cmd.exe
instance (except when /D
is explicitly specified, of course).
但是,请注意,这样做可能会导致其他怪异的副作用(例如,可能导致其他.bat
/.cmd
脚本在他们不期望的环境中运行).
However, be forewarned that doing this could result in other weird side-effects (for example, it could cause other .bat
/.cmd
scripts to be run in an environment that they aren't expecting).
这篇关于每次我启动cmd时,是否可以运行vcvars32.bat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!