Converting the FileSystemObject's Close Method

Definition: Closes an open file.

Close

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