更新时间:2023-11-26 20:34:52
您想要:
c:\path\exists\> $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(".\nonexist\foo.txt")
返回:
c:\path\exists\nonexists\foo.txt
这具有使用 PSPath 而非本机文件系统路径的优势.PSPAth 可能不会将 1-1 映射到文件系统路径,例如,如果您使用多字母驱动器名称挂载 psdrive.
This has the advantage of working with PSPaths, not native filesystem paths. A PSPAth may not map 1-1 to a filesystem path, for example if you mount a psdrive with a multi-letter drive name.
-Oisin