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)\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 ==========
This error might pop up simply because the Windows PowerShell is disabled. So, you can tackle the issue by tweaking a few settings as follows: Type Turn Windows Features on or off in the Start Menu search bar and select the Best match. Locate the Windows PowerShell option and click its drop-down menu.
Running a PowerShell script from the Command Prompt If you would like to run a PowerShell script in CMD, you'll need to execute it by calling the PowerShell process with the -File parameter, as shown below: PowerShell -File C:\TEMP\MyNotepadScript. ps1. PowerShell -File C:\TEMP\MyNotepadScript.
Sounds like you're missing an environment variable.
Add this to your Path
environment variable:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
OR
Change your script to this:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "your command"
or Right click start button -> System -> Advanced system settings -> Environment Variables... -> Select PATH
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
or %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With