I would like to first find the file name (e.g XXX.txt) (which can be anything, BBB is just an example) stored in the .ps1 file and if found replace that by a value entered in the console. then I will update with a new one such as test.txt instead of xxx.txt
$DName = read-host -prompt "Please Enter File Name"
(Get-Content "C:\run.ps1") |
Foreach-Object { $content = $_ -replace "$????","$DName" } |
Set-Content "C:\run.ps1"
run.ps1 file:
$line = ''
Get-Content C:\bulk\XXX.txt |
Select-String -Pattern 'TEMP' |
ForEach-Object {
#blah blah
}