我已经安装了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
上述情况发生在电源方面。有人知道为什么会发生这种情况或如何解决吗?