我正在尝试运行powershell -Command以在Visual studio 2013中将powershell文件作为构建后事件执行,但我收到
Powershell' is not recognized as an internal or external command, operable program or batch file
输出窗口出现错误,并且
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 ==========
发布于 2015-04-22 00:59:26
听起来你好像缺少一个环境变量。
将以下内容添加到您的Path
环境变量:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
或
将您的脚本更改为:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "your command"
发布于 2020-04-24 10:59:28
从批处理文件的开头删除BOM字节或将其编码转换为ANSI。BOM对待系统认为你使用不可用的命令。
发布于 2020-07-03 00:36:31
我的错误只是忘了以管理员身份运行Visual Studio /命令提示符。
https://stackoverflow.com/questions/29778121
复制相似问题