batch-file - 有没有办法在每次启动 cmd 时运行 vcvars32.bat?

标签 batch-file cmd cl.exe

我正在使用 clcmd并且必须运行 vcvars32.bat每次打开cmd window下的axx真的很痛。谁能提供一种自动运行它的方法?

最佳答案

来自 cmd /? :

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 时除外)。

但是,预先警告这样做可能会导致其他奇怪的副作用(例如,它可能会导致其他 .bat/.cmd 脚本在它们不期望的环境中运行)。

关于batch-file - 有没有办法在每次启动 cmd 时运行 vcvars32.bat?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17689152/

相关文章:

windows - 如何使用 CMD/Powershell 查找目录(包括子目录)中的所有文件,然后显示具有特定扩展名的文件

file - 从 cmd 打开 "open"-对话框

c++ - 安装构建工具后找不到 Visual Studio Code MSVC cl.exe

visual-c++ - 什么是 vs2012 cl.exe 相当于 gcc -std=c++11?

c - 有人记得 Visual C 版本 5 中 CL.EXE 的选项吗?

无法从命令行编译c文件

node.js - 如何在 Windows 和 Unix 上运行 npm sh 脚本

batch-file - 批处理 - 如何在脚本中读取另一个命令行函数的输出?

internet-explorer - 在 IE10 Kiosk 模式下限制快捷键

batch-file - 批处理文件 - 在 for 循环中更改变量值