$Documents = [Environment]::GetFolderPath("MyDocuments")
Copy-Item -Path "$InstallDirectory\Freelancer" -Destination "$Documents\My Games\Freelancer" -Recurse
# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^size= (.+)' -Substitution "size= $($Display.Bounds.Width), $($Display.Bounds.Height)" -FilePath "$Documents\My Games\Freelancer\PerfOptions.ini"
Write-ReplaceContentInFile -Pattern '^size = (.+)' -Substitution "size = $($Display.Bounds.Width),$($Display.Bounds.Height)" -FilePath "$InstallDirectory\exe\freelancer.ini"
$Documents = [Environment]::GetFolderPath("MyDocuments")
Remove-Item -Path "$Documents\My Games\Freelancer" -Recurse -force