Powershell'不被识别为内部或外部命令、可运行程序或批处理文件

2024-04-21

我正在尝试运行 powershell -Command 来执行 powershell 文件作为 Visual studio 2013 中的构建后事件 但我越来越

“Powershell”不被识别为内部或外部命令、可操作程序或批处理文件

输出窗口上的错误和

Powershell -Command exited with code 9009 error

完整错误消息:

'Powershell' is not recognized as an internal or external command,
10>  operable program or batch file.
10>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4429,5): error MSB3073: The command "echo "C:\dev\tfs\Main\Shared\AggregationComponents\GenerateSchema.cmd"
10>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4429,5): error MSB3073: call "C:\dev\tfs\Main\Shared\AggregationComponents\GenerateSchema.cmd"
10>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4429,5): error MSB3073: echo "Move the PhoenixData namespace schema suffixing it"
10>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4429,5): error MSB3073: Powershell -Command "C:\dev\tfs\Main\Shared\AggregationComponents\MoveAndRenameXsds.ps1 'C:\dev\tfs\Main\Shared\AggregationComponents\bin\Debug\' 'C:\dev\tfs\Main\Shared\AggregationComponents\..\PublishedAnalyticsXsds' '.Aggregation'"" exited with code 9009.
========== Rebuild All: 8 succeeded, 1 failed, 1 skipped ==========

听起来你缺少一个环境变量。

将其添加到您的Path环境变量:

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

OR

将您的脚本更改为:

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "your command"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Powershell'不被识别为内部或外部命令、可运行程序或批处理文件 的相关文章

随机推荐