PowerShell's Invoke-WebRequest
provides -OutFile
that writes the response body to a file.
@('Global/JetBrains','Global/Vim','Global/VisualStudioCode','Global/macOS','Python','Terraform') `
| ForEach-Object {
Invoke-WebRequest -UseBasicParsing -Outfile "$Env:USERPROFILE/.gitignore" -Uri `
"https://raw.githubusercontent.com/github/gitignore/master/$PSItem.gitignore"
}
I would like to append to the file $Env:USERPROFILE/.gitignore
, and it doesn't seem like Invoke-WebRequest
will support this. How can I go about doing this?
Also, any tips on how I can make this PowerShell script more readable/concise?
Note: I am using PowerShell version 5.1.19041.1237
.