Converting the FileSystemObject's GetParentFolderName Method

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.

GetParentFolderName

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