Powershell' 不是内部或外部命令,也不是可运行的程序或批处理文件 [英] Powershell' is not recognized as an internal or external command, operable program or batch file

查看:456
本文介绍了Powershell' 不是内部或外部命令,也不是可运行的程序或批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行 powershell -Command 以在 Visual Studio 2013 中将 powershell 文件作为后期构建事件执行但我得到了
Powershell' 不是内部或外部命令,也不是可运行的程序或批处理文件

I am trying to run a powershell -Command to execute a powershell file as a post build event in Visual studio 2013 But i am getting
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 ==========

推荐答案

听起来您缺少环境变量.

Sounds like you're missing an environment variable.

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

Add this to your Path environment variable:

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

将您的脚本更改为:

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "your command"

这篇关于Powershell' 不是内部或外部命令,也不是可运行的程序或批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆