2016-06-03 3 views
2

내 경로 변수에 추가 한 폴더에 exe 파일 fciv.exe가 있습니다. 나는Path 변수에서 PowerShell로 exe 파일 실행

$env:Path 

를 사용하여 확인하지만 난 그냥 명령의 이름을 지정하면

fciv -h 

PowerShell은 명령이 예외를 찾을 수 없음을 보여줍니다.

동일한 명령이 cmd 명령 프롬프트에서 작동합니다.

실행 정책을 무제한으로 설정했습니다 Powershell에서 작동하게하려면 다른 방법이 있습니까?

Trace-Command Command* {fciv -h} -PSHost 

DEBUG: CommandDiscovery Information: 0 : Looking for fciv.ps1 in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.psm1 in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.psd1 in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.COM in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.EXE in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.BAT in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.CMD in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.VBS in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.VBE in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.JS in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.JSE in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.WSF in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.WSH in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.MSC in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.CPL in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv in "E:\My Software\FCIV" 
DEBUG: CommandSearch Information: 0 : WriteLine Current directory results are invalid 
DEBUG: CommandSearch Information: 0 : WriteLine Current patterns exhausted in current directory: "E:\My Software\FCIV" 
DEBUG: CommandDiscovery Information: 0 : Looking for fciv.ps1 in E:\My Software\AVG\Av 

참고 "E : 내 소프트웨어 \ FCIV을 \"의 출력에서 ​​

편집

관련 라인은 FCIV 실행 파일이있는 디렉토리입니다.

편집 2

명령 추적을 보면 그것이 올바른 폴더에 fciv.EXE을 찾고 있지만 잘 thorugh 건너 뛰는 있다고보고

, 난 .EXE 그래서 내가 문제였다 extenseion의 상단 케이스를 생각 .exe를 PATHEXT 변수에 추가하려고 시도했습니다.

이제 정확한 폴더에서 fciv.exe를 찾지 만 여전히 오른쪽으로 건너 뛰고 현재 디렉토리에서 현재 패턴을 모두 소모했습니다.

EDIT 3 내가 그것을 알아 낸

, 다른 디렉토리가 없었다 동안 내 PATH 환경 변수에

"E:\My Software\FCIV" 

따옴표로 나타난 것으로 보인다. 명령 프롬프트 cmd은 powershell이 ​​아니더라도 작동 할 수있었습니다. 이유는 모르겠지만 적어도 문제를 해결하는 방법을 찾았 기 때문에 기쁩니다.

+0

'Trace-Command Command * {fciv -h} -PSHost' 명령의 출력을 보여줍니다. – PetSerAl

+1

남자,이 '추적 명령'은 * uglily * verbose입니다! – sodawillow

+0

예, 관련 출력 줄을 추가했습니다. 올바른 폴더를 찾았지만 파일을 찾을 수없는 것 같습니다. 뭔가 잘못된 것 같습니다. –

답변

1

참고 : 질문을 대답으로 업데이트했지만 실제 답변을 게시하는 것이 좋습니다.

DEBUG : CommandDiscovery 정보 : 0 : 디버그 추적에서

당신은 다음과 같은 라인을 얻을에 fciv.ps1을 찾고 "E : 내 소프트웨어 \ FCIV \"

을 경로는 E:\My Software\FCIV 일 때 "E:\My Software\FCIV"입니다.
이것은 경로가 잘못 설정되었음을 나타내며,이 항목은 경로에 인용 할 필요가 없을 때 인용됩니다.

DEBUG : CommandDiscovery 정보 : 0 : 여기에

내가 iexplore.exe를 실행 그때부터 예 추적의 발췌 한 것입니다. iexplore.exe를 찾고 * C에서 : \ 프로그램 파일 (86) \ Internet Explorer
DEBUG : CommandSearch 정보 : 0 : WriteLine 다음 경로를 찾았습니다. C : \ Program Files (x86) \ Internet Explorer \ iexplore.exe
디버그 : CommandDiscovery 정보 : 0 : 명령 있음 : 경로 (C : 프로그램 파일 (x86) \ Internet Explorer \ iexplore.exe)은 이름이 다음과 같은 응용 프로그램입니다. iexplore.exe

경로는 따옴표로 묶이지 않고 실행 파일을 찾았습니다.