Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting the FileSystemObject's Close Method

Windows PowerShell

Definition: Closes an open file.


There is no equivalent method in PowerShell. In PowerShell, once you’ve read the contents of the file, the file is automatically closed.

This example reads the first line of the file Test.txt. The file is automatically closed when the command completes.

Get-Content Test.txt -TotalCount 1

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft