System.Management.Automation.PathInfo
object represents a path (such as a file system path or a registry key name). PathInfo
object is returned in PowerShell by cmdLets such as get-location
, resolve-path
or the automatic variable $pwd
. ToString()
method of PathInfo
prepends the path with some provider related information (for example Microsoft.PowerShell.Core\FileSystem::
) which can be, frankly, quite a nuisance. providerPath
property must be used: "Current directory is: $pwd" # # Current directory is: Microsoft.PowerShell.Core\FileSystem::P:\ath\to\directory "Current directory is: $($pwd.providerPath)" # # Current directory is: P:\ath\to\directory
System.IO.DirectoryInfo