Variable Name Change

pull/263/head
KnifMelti 2023-01-18 01:07:32 +01:00
parent d000abf675
commit 17ad60b7ce
2 changed files with 7 additions and 7 deletions

View File

@ -46,10 +46,10 @@ $CopyTo = ""
#Find/Replace text in file
#Example:
#$ModsFile = "C:\dummy.txt"
#$File = "C:\dummy.txt"
#$FindText = "brown fox"
#$ReplaceText = "white fox"
$ModsFile = ""
$File = ""
$FindText = ""
$ReplaceText = ""
@ -87,8 +87,8 @@ if ($DelFile) {
if ($CopyFile -and $CopyTo) {
Copy-ModsFile $CopyFile $CopyTo
}
if ($ModsFile -and $FindText -and $ReplaceText) {
Edit-ModsFile $ModsFile $FindText $ReplaceText
if ($File -and $FindText -and $ReplaceText) {
Edit-ModsFile $File $FindText $ReplaceText
}
if ($GrantPath) {
Grant-ModsPath $GrantPath

View File

@ -192,9 +192,9 @@ function Copy-ModsFile ($CopyFile, $CopyTo) {
Return
}
function Edit-ModsFile ($ModsFile, $FindText, $ReplaceText) {
if (Test-Path "$ModsFile") {
((Get-Content -path $ModsFile -Raw) -replace "$FindText","$ReplaceText") | Set-Content -Path $ModsFile -Force -ErrorAction SilentlyContinue | Out-Null
function Edit-ModsFile ($File, $FindText, $ReplaceText) {
if (Test-Path "$File") {
((Get-Content -path $File -Raw) -replace "$FindText","$ReplaceText") | Set-Content -Path $File -Force -ErrorAction SilentlyContinue | Out-Null
}
Return
}