首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Powershell‘未被识别为内部或外部命令、可操作程序或批处理文件

Powershell‘未被识别为内部或外部命令、可操作程序或批处理文件
EN

Stack Overflow用户
提问于 2015-04-22 00:32:36
回答 4查看 115.9K关注 0票数 52

我正在尝试运行powershell -Command以在Visual studio 2013中将powershell文件作为构建后事件执行,但我收到

Powershell' is not recognized as an internal or external command, operable program or batch file

输出窗口出现错误,并且

代码语言:javascript
复制
Powershell -Command exited with code 9009 error

完整错误消息:

代码语言:javascript
复制
'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 ==========
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2015-04-22 00:59:26

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

将以下内容添加到您的Path环境变量:

代码语言:javascript
复制
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

将您的脚本更改为:

代码语言:javascript
复制
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "your command"
票数 83
EN

Stack Overflow用户

发布于 2020-04-24 10:59:28

从批处理文件的开头删除BOM字节或将其编码转换为ANSI。BOM对待系统认为你使用不可用的命令。

票数 4
EN

Stack Overflow用户

发布于 2020-07-03 00:36:31

我的错误只是忘了以管理员身份运行Visual Studio /命令提示符。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29778121

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档