programing

Powershell'이(가) 내부 또는 외부 명령, 작동 가능한 프로그램 또는 배치 파일로 인식되지 않습니다.

sourcejob 2023. 8. 22. 22:06
반응형

Powershell'이(가) 내부 또는 외부 명령, 작동 가능한 프로그램 또는 배치 파일로 인식되지 않습니다.

powershell을 실행하려고 합니다. - Visual studio 2013에서 빌드 후 이벤트로 powershell 파일을 실행하는 명령을 실행합니다. 하지만 실행 중입니다.

'Powershell'이 내부 또는 외부 명령, 작동 가능한 프로그램 또는 배치 파일로 인식되지 않습니다.

출력 창에 오류가 발생했습니다.

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 ==========

환경 변수를 놓치고 있는 것처럼 들립니다.

에 추가합니다.Path환경 변수:

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

OR

스크립트를 다음으로 변경합니다.

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

환경 변수에 추가하기만 하면 됩니다. 다음 두 가지 간단한 단계만 수행하면 됩니다.

1.검색란에 env 쓰기

또는 시작 버튼을 마우스 오른쪽 버튼으로 클릭 -> 시스템 -> 고급 시스템 설정 -> 환경 변수...-> PATH 선택

새 버튼을 클릭하고 다음 경로를 추가합니다.

C:\WINDOWS\System32\WindowsPowerShell\v1.0\

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


write env in the search bar

choose path

click Ok

배치 파일의 시작 부분에서 BOM 바이트를 제거하거나 인코딩을 ANSI로 변환합니다. BOM은 시스템이 사용자가 사용할 수 없는 명령을 사용한다고 생각하도록 처리합니다.

관리자로서 Visual Studio/명령 프롬프트를 실행하는 것을 잊어버린 것이 실수였습니다.

해라

'%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe tracert google.com'

필요할 수 있음\\대신에\.

언급URL : https://stackoverflow.com/questions/29778121/powershell-is-not-recognized-as-an-internal-or-external-command-operable-progr

반응형