How to turn a string into a FileInfo in Powershell Just cast it to System.IO.FileInfo [System.IO.FileInfo]"C:\Users" See also How to find parts of a pathinfo object in powershell Get Parts of a FileInfo object (such as FileName Without Extension)