In my PowerShell script I am getting an error that I dont understand.
The error is:
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
Invalid regular expression pattern:
Menu "User" {
Button "EXDS" {
Walk_Right "EXDS"
}
}
.
At C:\test.ps1:7 char:18
+ ($output -replace <<<< $target) | Set-Content "usermenuTest2.4d.new"
+ CategoryInfo : InvalidOperation: (
Menu "User" {...do"
}
}
:String) [], RuntimeException
+ FullyQualifiedErrorId : InvalidRegularExpression
My script reads a file into a string (string A) then attempts to remove String A from another file. What does this error mean and how I can I fix it?
My code:
#set-executionpolicy Unrestricted -Force
#set-executionpolicy -scope LocalMachine -executionPolicy Unrestricted -force
$target=[IO.File]::ReadAllText(".\usermenuTest1.4d")
$output=[IO.File]::ReadAllText(".\usermenuTest2.4d")
($output -replace $target) | Set-Content "usermenuTest2.4d.new"