Variable Name Change
parent
d000abf675
commit
17ad60b7ce
|
@ -46,10 +46,10 @@ $CopyTo = ""
|
||||||
|
|
||||||
#Find/Replace text in file
|
#Find/Replace text in file
|
||||||
#Example:
|
#Example:
|
||||||
#$ModsFile = "C:\dummy.txt"
|
#$File = "C:\dummy.txt"
|
||||||
#$FindText = "brown fox"
|
#$FindText = "brown fox"
|
||||||
#$ReplaceText = "white fox"
|
#$ReplaceText = "white fox"
|
||||||
$ModsFile = ""
|
$File = ""
|
||||||
$FindText = ""
|
$FindText = ""
|
||||||
$ReplaceText = ""
|
$ReplaceText = ""
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ if ($DelFile) {
|
||||||
if ($CopyFile -and $CopyTo) {
|
if ($CopyFile -and $CopyTo) {
|
||||||
Copy-ModsFile $CopyFile $CopyTo
|
Copy-ModsFile $CopyFile $CopyTo
|
||||||
}
|
}
|
||||||
if ($ModsFile -and $FindText -and $ReplaceText) {
|
if ($File -and $FindText -and $ReplaceText) {
|
||||||
Edit-ModsFile $ModsFile $FindText $ReplaceText
|
Edit-ModsFile $File $FindText $ReplaceText
|
||||||
}
|
}
|
||||||
if ($GrantPath) {
|
if ($GrantPath) {
|
||||||
Grant-ModsPath $GrantPath
|
Grant-ModsPath $GrantPath
|
||||||
|
|
|
@ -192,9 +192,9 @@ function Copy-ModsFile ($CopyFile, $CopyTo) {
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
function Edit-ModsFile ($ModsFile, $FindText, $ReplaceText) {
|
function Edit-ModsFile ($File, $FindText, $ReplaceText) {
|
||||||
if (Test-Path "$ModsFile") {
|
if (Test-Path "$File") {
|
||||||
((Get-Content -path $ModsFile -Raw) -replace "$FindText","$ReplaceText") | Set-Content -Path $ModsFile -Force -ErrorAction SilentlyContinue | Out-Null
|
((Get-Content -path $File -Raw) -replace "$FindText","$ReplaceText") | Set-Content -Path $File -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue