Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param(
- [Parameter(Mandatory=$true, ParameterSetName="Path", Position=0,HelpMessage='Data folder Path')]
- [string] $Path,
- [Parameter(Mandatory=$true, HelpMessage='Input the string to be replaced')]
- [string] $Input,
- [Parameter(Mandatory=$true,HelpMessage='Input the new string that need to be replaced')]
- [string] $Replace
- )
- $a = Test-Path $Path
- IF ($a -eq $True) {Write-Host "Path Exists"} ELSE {Write-Host "Path Doesnot exits"}
- $configFiles = Get-ChildItem -Path $Path -include *.pro, *.rux -recurse
- $Append = join-path -path $path *
- $b = test-path $Append -include *.pro, *.rux
- If($b -eq $True) {
- foreach ($file in $configFiles)
- {
- (Get-Content $file.PSPath) |
- Foreach-Object { $_ -replace [regex]::Escape($Input), $Replace } |
- Set-Content $file.PSPath
- }
- $wshell = New-Object -ComObject Wscript.Shell
- $wshell.Popup("Operation Completed",0,"Done",0x0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement