System.IO.File
only has static methods and allows for generic file related operations in a file system. System.IO.FileInfo
represents a specific file. AppendAllLines() | |
AppendAllLinesAsync() | |
AppendAllText() | |
AppendAllTextAsync() | |
AppendText() | |
Copy() | |
Create() | |
CreateSymbolicLink() | |
CreateText() | |
Decrypt() | |
Delete() | |
Encrypt() | |
Exists() | Checks if a file exists. |
GetAttributes() | |
GetCreationTime() | |
GetCreationTimeUtc() | |
GetLastAccessTime() | |
GetLastAccessTimeUtc() | |
GetLastWriteTime() | |
GetLastWriteTimeUtc() | |
Move() | |
Open() | |
OpenHandle() | |
OpenRead() | |
OpenText() | |
OpenWrite() | |
ReadAllBytes() | |
ReadAllBytesAsync() | |
ReadAllLines() | |
ReadAllLinesAsync() | |
ReadAllText() | Slurps the content of an entire file. |
ReadAllTextAsync() | |
ReadLines() | |
Replace() | |
ResolveLinkTarget() | |
SetAttributes() | |
SetCreationTime() | |
SetCreationTimeUtc() | |
SetLastAccessTime() | |
SetLastAccessTimeUtc() | |
SetLastWriteTime() | |
SetLastWriteTimeUtc() | |
WriteAllBytes() | Creates a new or overwrites an existing file, writes the specified byte array to the file, and then closes the file. |
WriteAllBytesAsync() | |
WriteAllLines() | |
WriteAllLinesAsync() | |
WriteAllText() | |
WriteAllTextAsync() |
WriteAllBytes()
method? ReadAllText
slurps the content of an entire file. PS: C:\> $a = [IO.File]::ReadAllText("$pwd\a.txt") PS: C:\> $b = [IO.File]::ReadAllText("$pwd\b.txt") PS: C:\> $c = [IO.File]::ReadAllText("$pwd\c.txt") PS: C:\> [IO.File]::WriteAllText("$pwd\concatenated" , $a) PS: C:\> [IO.File]::AppendAllText("$pwd\concatenated", $b) PS: C:\> [IO.File]::AppendAllText("$pwd\concatenated", $c)
get-content a.txt,b.txt,c.txt | set-content concatenated.txt