Powershell: resolve path that might not exist? -
I am trying to process a list of files that may or may not be and yet Not yet present. In doing so, I need to solve the full path of an item, even if the item can be specified with the relative path. However, resolution-path
is printed and used when used with a non-existent file.
For example, what is the simplest, clear way to solve ? Note that in the "C: \ current \ working directory \ newdir \ newfile.txt"
in parsers ?
\ Newdir \ newfile.txt "
You want:
c: \ path \ exist \> $ ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath (". \ Nonexist \ foo.txt ")
Returns:
C: \ path \ exist \ nonexists \ Foo.txt
It has the advantage of working with PSP; A system path is not a MSP can not map 1-1 in the PSPAth file system path, for example if you mount the psdrive with a multi-layer drive name.
-Oisin
Comments
Post a Comment