Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
723 views
in Technique[技术] by (71.8m points)

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

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

error on output window and

Powershell -Command exited with code 9009 error

Full Error Message:

'Powershell' is not recognized as an internal or external command,
10>  operable program or batch file.
10>C:Program Files (x86)MSBuild12.0inMicrosoft.Common.CurrentVersion.targets(4429,5): error MSB3073: The command "echo "C:devfsMainSharedAggregationComponentsGenerateSchema.cmd"
10>C:Program Files (x86)MSBuild12.0inMicrosoft.Common.CurrentVersion.targets(4429,5): error MSB3073: call "C:devfsMainSharedAggregationComponentsGenerateSchema.cmd"
10>C:Program Files (x86)MSBuild12.0inMicrosoft.Common.CurrentVersion.targets(4429,5): error MSB3073: echo "Move the PhoenixData namespace schema suffixing it"
10>C:Program Files (x86)MSBuild12.0inMicrosoft.Common.CurrentVersion.targets(4429,5): error MSB3073: Powershell -Command "C:devfsMainSharedAggregationComponentsMoveAndRenameXsds.ps1 'C:devfsMainSharedAggregationComponentsinDebug' 'C:devfsMainSharedAggregationComponents..PublishedAnalyticsXsds' '.Aggregation'"" exited with code 9009.
========== Rebuild All: 8 succeeded, 1 failed, 1 skipped ==========
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sounds like you're missing an environment variable.

Add this to your Path environment variable:

%SYSTEMROOT%System32WindowsPowerShellv1.0

OR

Change your script to this:

%SYSTEMROOT%System32WindowsPowerShellv1.0powershell.exe -Command "your command"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...