Here a first attempt at the top of my head.
$configFiles = Get-ChildItem . *.config -rec
foreach ($file in $configFiles)
{
(Get-Content $file.PSPath) |
Foreach-Object { $_ -replace "Dev", "Demo" } |
Set-Content $file.PSPath
}
More Related Contents:
- Renaming files by reformatting existing filenames – placeholders in replacement strings used with the -replace operator
- PowerShell script not zipping correct files
- Recursively rename files using find and sed
- How to redirect the output of a PowerShell to a file during its execution
- Replace CRLF using powershell
- What’s the difference between .replace and -replace in powershell?
- Watch file for changes and run command with powershell
- How to get disk capacity and free space of remote computer
- How to replace multiple strings in a file using PowerShell
- PowerShell script to check an application that’s locking a file?
- How to get started with PowerShell? [closed]
- How can I run a PowerShell script with white spaces in the path from the command line?
- Passing a function to Powershell’s (replace) function
- Using Powershell environmental variables as strings when outputting files
- PowerShell says “execution of scripts is disabled on this system.”
- Create objects with custom properties containing derived filesystem path information and export them to a CSV – calculated properties
- Using a Variable (PowerShell) inside of a command
- Changing PowerShell’s default output encoding to UTF-8
- PowerShell outputting array items when interpolating within double quotes
- PSCustomObject to Hashtable
- Saving credentials for reuse by powershell and error ConvertTo-SecureString : Key not valid for use in specified state
- How to use the curl command in PowerShell?
- Ignoring an errorlevel != 0 in Windows PowerShell (ISE)
- DateTime subtraction not working in PowerShell – assignment vs. equality operator
- Loading Assemblies from NuGet Packages
- Output file doesn’t match Write-Host
- How to execute a PowerShell function several times in parallel?
- Can’t install nuget package because of “Failed to initialize the PowerShell host”
- How to run powershell command in batch file
- Prevent trailing newline in PowerShell Out-File command