Skip to content

Instantly share code, notes, and snippets.

@hoserdude
Created June 18, 2013 19:43
Show Gist options
  • Save hoserdude/5808610 to your computer and use it in GitHub Desktop.
Save hoserdude/5808610 to your computer and use it in GitHub Desktop.
Replace tokenized values in a file using PowerShell
function Replace-Tokens
{
param(
[string]$inputFile,
[string]$outputFile,
[string]$token,
[string]$tokenValue
)
(Get-Content $inputFile) | foreach-object { $_ -replace $token, $tokenValue } | Set-Content $outputFile
Write-Host "Processed: " + $inputFile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment