Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
747 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 Answer

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...