3
나는 powershell에서 아래 코드를 사용하여 shortpath를 얻으려고합니다. 일부 폴더의 경우 작동합니다. 일부에서는 작동하지 않습니다.powershell을 사용하여 shortpath 가져 오기
$a = New-Object -ComObject Scripting.FileSystemObject
$f = $a.GetFile("C:\Program Files\Internet Explorer\iexplore.exe")
$f.ShortPath
$f = $a.GetFolder("C:\Program Files\Internet Explorer")
$f.ShortPath
OUTP :
Exception calling "GetFile" with "1" argument(s): "Exception from HRESULT: 0x800A0035 (CTL_E_FILENOTFOUND)"
At C:\Misc\GetShortPath.ps1:4 char:1
+ $f = $a.GetFile("C:\Program Files\Internet Explorer")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
사람이
고맙습니다. JosefZ. 그것은 내 측면에서 폴더를 검색 할 때 GetFile을 사용하는 어리석은 실수였습니다. – user3180704