I am trying to replace a string in a file like this:
c:\>powershell -Command (gc D:\xxxxxxx\index.html) ^
-replace '^<script src="js/locale/languageholder.js"^>^</script^>', '' ^
| Out-File -encoding ASCII "D:\yyyyyyyyy\index.html"
the string I want to remove is:
<script src="js/locale/languageholder.js"></script>
no errors, but it is just not replaced. I assume there must be some charactors to be escaped, but couldn't figure it out.
In the code ^ is used to escape <, otherwise it will show this error:
< was unexpected at this time.
Getting the same error using \ to escape