Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Converting the FileSystemObject's ParentFolder Property

Windows PowerShell

Definition: Returns a reference to the parent of the specified file or folder.


Use the -parent parameter of the Split-Path cmdlet to retrieve the parent of a file or folder:

Split-Path C:\scripts -parent

To retrieve a reference to that file or folder, pipe the output to Get-Item:

$a = Split-Path C:\scripts -parent | Get-Item

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.