Guest User

Untitled

a guest
Jun 20th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. [cmdletbinding()]
  2. Param(
  3. [ValidateScript({Test-Path $_})]
  4. [ValidateNotNullOrEmpty()]
  5. [Parameter(Mandatory=$True)]
  6. [string]$filePath,
  7.  
  8. [Parameter(Mandatory=$True)]
  9. [ValidateNotNullOrEmpty()]
  10. [string]$replace,
  11.  
  12. [Parameter(Mandatory=$True)]
  13. [ValidateNotNullOrEmpty()]
  14. [string]$with
  15. )
  16.  
  17. $content = Get-Content $filePath
  18.  
  19. $updatedContent = $content -replace $replace, $with
  20.  
  21. Set-Content -Path $filePath -Value $updatedContent
Add Comment
Please, Sign In to add comment