File I/O
Get the contents of a file with Get-Content:
Get-Content "README.txt"
The contents of the file are stored line-by-line in an array:
$a = Get-Content "README.txt"
$a[0] # First line of the file
$a[3] # Fourth line of the file
To combine the contents of a file into a single string, use [string]::Join():
$a = Get-Content "README.txt"
$separator = [System.Environment]::NewLine # could have done `r`n
$all = [string]::Join($separator, $a)
To write to disk, use Set-Content:
Set-Content -Value $all -Path "New-file.txt"
Import Powershell from another file using Import-Module:
Import-Module "C:\Temp\Utility.ps1"