【发布时间】:2022-11-26 09:07:31
【问题描述】:
我安装了 visual studio,在 cmd 中运行 vcvarsall.bat 后 cl.exe 运行得非常好,但在 powershell 中它说无法识别。 命令执行程序
C:\Users\Ethos>vcvarsall.bat x64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.2.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
C:\Users\Ethos>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
以上在 cmd 中运行良好。
PS C:\Users\Ethos> vcvarsall.bat x64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.2.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
PS C:\Users\Ethos> cl
cl : The term 'cl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ cl
+ ~~
+ CategoryInfo : ObjectNotFound: (cl:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
以上发生在权力。有谁知道为什么会发生这种情况或如何解决?
【问题讨论】:
标签: windows visual-studio powershell cl