Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
调用vcvarsall.bat会给出;Windows找不到powershell.exe“;在Windows 7/VS 2019构建工具上 以前我有VisualStudio 2015(14)安装工具,我可以构建一个简单的C++程序,没有任何IDE,用: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 cl helloworld1.cpp_Windows_Visual Studio_Visual C++_Visual Studio 2019_Visual Studio 2017 Build Tools - Fatal编程技术网

调用vcvarsall.bat会给出;Windows找不到powershell.exe“;在Windows 7/VS 2019构建工具上 以前我有VisualStudio 2015(14)安装工具,我可以构建一个简单的C++程序,没有任何IDE,用: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 cl helloworld1.cpp

调用vcvarsall.bat会给出;Windows找不到powershell.exe“;在Windows 7/VS 2019构建工具上 以前我有VisualStudio 2015(14)安装工具,我可以构建一个简单的C++程序,没有任何IDE,用: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 cl helloworld1.cpp,windows,visual-studio,visual-c++,visual-studio-2019,visual-studio-2017-build-tools,Windows,Visual Studio,Visual C++,Visual Studio 2019,Visual Studio 2017 Build Tools,现在我已经安装了Visual Studio 2019构建工具,调用vcvvarsall.bat将显示以下消息: Windows找不到“powershell.exe” 但是在关闭对话框后,它仍然继续(!)。但它失败的原因是: cl:命令行错误D8027:无法执行'C:\Program Files(x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\c1x.dll' 我不明白为什

现在我已经安装了Visual Studio 2019构建工具,调用
vcvvarsall.bat
将显示以下消息:

Windows找不到“powershell.exe”

但是在关闭对话框后,它仍然继续(!)。但它失败的原因是:

cl:命令行错误D8027:无法执行'C:\Program Files(x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\c1x.dll'

我不明白为什么powershell必须只设置几个环境变量并设置所有要使用的
cl.exe

问题:使用VS Build Tools 2019调用cl.exe的正确方式是什么?

我们不应该像以前的版本一样,先调用
vcvvarsall.bat

(重要提示:我正在寻找100%终端模式,无IDE)


正式方法是将
%SystemRoot%\System32\WindowsPowerShell\v1.0
永久或在调用
vcvvarsall.bat
之前添加到
路径中


另一种方法是在调用
vcvarsall.bat
之前执行
set VSCMD\u SKIP\u SENDTELEMETRY=1
。这是因为
vcvasll
在内部调用
vsdevcmd
,然后使用
powershell
配置“如果选择了用户的VS,则发送遥测”。但是,当定义了
VSCMD\u SKIP\u sendtemetry
时,遥测步骤被绕过(虽然这似乎没有记录,因此在未来的版本中可能会发生更改),然后不再使用或需要
powershell

非常感谢@dxiv,问题确实是我在路径中做了一些“清理”,并且可能意外删除了PowerShell路径…对于问题的第二部分,为什么会出现
cl:命令行错误D8027:无法执行'C:\Program Files(x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\c1x.dll'
?这个文件存在于文件系统中,我想知道为什么它不能被执行。。。您对@dxiv?@Basj有什么想法吗?这些想法一定与您的构建工具设置或配置有关。我使用的是完整的VS安装,我没有看到错误,也没有任何错误。您引用的路径是否是
path
环境中
vcvarsall
之后的第一条路径?