내 경로 변수에 추가 한 폴더에 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이 아니더라도 작동 할 수있었습니다. 이유는 모르겠지만 적어도 문제를 해결하는 방법을 찾았 기 때문에 기쁩니다.
'Trace-Command Command * {fciv -h} -PSHost' 명령의 출력을 보여줍니다. – PetSerAl
남자,이 '추적 명령'은 * uglily * verbose입니다! – sodawillow
예, 관련 출력 줄을 추가했습니다. 올바른 폴더를 찾았지만 파일을 찾을 수없는 것 같습니다. 뭔가 잘못된 것 같습니다. –