Resolve-PathEx is a wrapper around Resolve-Path that adds support for resolving paths for files that don’t exist. Why would you ever want that? Have you ever created a function with a path parameter and a file name parameter, where the function itself would create a new file? With this function you could combine those two parameters into one. The great thing about Resolve-PathEx is that it supports wildcards (the same as Resolve-Path).

The function outputs a PSObject of course, with two properties; Path and Exists. The latter is a boolean and will tell you whether the fully resolved path exists or not.

As always, the code is hosted on GitHub, so if you spot a bug, or have any ideas for future improvements, fork my code and help me make it better!

https://gist.github.com/gravejester/a5c8407fcf5fb16a356a

One comment

Leave a comment