Converting the FileSystemObject to Windows PowerShell Commands

Part of the VBScript to Windows PowerShell Conversion Guide

Windows PowerShell


For many years the FileSystemObject was the primary tool for programmatically managing files and folders. Although it now shares file system duties with WMI, the FileSystemObject remains the one – and only – way for VBScripters to work with text files. The methods and properties below detail both the file management and text file capabilities of the FileSystemObject.


VBScript to Windows PowerShell Conversion Guide Home


FileSystemObject Methods

Add
BuildPath
Close
Copy
CopyFile
CopyFolder
CreateFolder
CreateTextFile
Delete
DeleteFile
DeleteFolder
DriveExists
FileExists
FolderExists
GetAbsolutePathName
GetBaseName
GetDrive
GetDriveName
GetExtensionName
GetFile
GetFileName
GetFileVersion
GetFolder
GetParentFolderName
GetSpecialFolder
GetStandardStream
GetTempName
Move
MoveFile
MoveFolder
OpenAsTextStream
OpenTextFile
Read
ReadAll
ReadLine
Skip
SkipLine
Write
WriteBlankLines
WriteLine

FileSystemObject Properties

AtEndOfLine
AtEndOfStream
Attributes
AvailableSpace
Column
DateCreated
DateLastAccessed
DateLastModified
Drive
DriveLetter
Drives
Files
FileSystem
FreeSpace
IsReady
IsRootFolder
Line
Name
ParentFolder
Path
RootFolder
SerialNumber
ShareName
ShortName
ShortPath
Size
Subfolders
TotalSize
Type
VolumeName
Top of pageTop of page