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 " System.IO.Path is the use of the process work directory - which is not the current location of powershell.

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

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -