2014-12-29 5 views

답변

1

이 시도 :

get-item R:\Scripts\s.ps1 | 
       select @{n="path";e={ "$(get-psdrive $($_.psdrive) | 
        select -expa displayroot)$(split-path $_ -noqualifier)" }} 
0

내 솔루션, 또한 로컬 경로 작동합니다 (물론이를 변경하지 않습니다) :

function Get-FullRemotePath($path) { 
    # Attempts to expand net shares 
    if (!(Test-Path $path)) { return $path } 

    $fileObj = Get-Item $path 
    $remotePath = (Get-PsDrive $fileObj.PSDrive).DisplayRoot 
    if ($remotePath) { 
     $path = $remotePath+(split-path $fileobj -noqualifier) 
    } 
    return $path 
} 

한 라이너가 아닙니다.

관련 문제