Replace text in a file
Posted: Mon Nov 30, 2015 5:57 pm
Is there a process available to replace text in a file with the value of a variable?
For example, in the app.config, can we change the value of a key with <CustomUserInfo>?
I see that we can run a custom action, but can the custom action run a PowerShell function?
For example, in the app.config, can we change the value of a key with <CustomUserInfo>?
I see that we can run a custom action, but can the custom action run a PowerShell function?
Code: Select all
(Get-Content test.txt) | ForEach-Object { $_ -replace "foo", <CustomUserInfo> } | Set-Content test.txt