Converting the FileSystemObject's GetParentFolderName Method

Windows PowerShell

Definition: Returns the full path to the parent of the given path. For example, the parent folder name of C:\Scripts\temp is C:\Scripts.


Use the -parent parameter of the Split-Path cmdlet:

Split-Path C:\scripts\temp -parent

See conversions of other FileSystemObject methods and properties.
Return to the VBScript to Windows PowerShell home page