Using Advanced Path Functions

by Jun 12, 2009

Whenever the built-in Split-Path cmdlet isn't enough, you can always resort to the real .NET class behind it. This class is called System.IO.Path, Use Get-Member with the -static parameter to list its members:

[System.IO.Path] | Get-Member -static

To actually use any of those, append "::" to the class. For example, here is how you can change the file extension of a path to ".ps1":

[System.IO.Path]::ChangeExtension("c:test.txt", ".ps1")