I am very new on powershell forum here. For one of my daily manually find and replace task i want to create a powershell script to find and replace some network location and replace with new one.
To find : \\filedep\iservershare\DCSVWA
Replace with \\EGSISFS01\VolksWagon\DCSVWA
I am able to replace text without any special characters but for above I am getting regular expression error.
And also after replacing above string i want to save result in a text file which logs records of files which have been updated.
PowerShell's -replace operator uses regular expressions, and also works well on collections. If your $c variable happens to just be a single string (not a collection of strings), though, you can also just use the Replace() method of the String class, which keeps regex out of the picture: