所以我有一些代码保存在变量中,例如; Powershell脚本中的$ Macro。 我需要替换从 Dim stm 开始直到 Set al 的整行,然后将输出保存回变量$ Macro。
entry_class = "enumerate.now"
Dim stm As Object, fmt As Object, al As Object
Set stm = CreateObject("System.IO.MemoryStream")
Set fmt = CreateObject("System.Runtime.Serialization.Formatters.Binary.BinaryFormatter")
Set al = CreateObject("System.Collections.ArrayList")
Dim dec
dec = decodeHex(serialized_obj)
有人可以提供任何指示我该怎么做? 我尝试使用下面的方法,但是没有用
$macro = $macro -replace 'Dim stm As Object, fmt As Object, al As Object',' replaced code'
$macro = $macro -replace 'Set stm = CreateObject("System.IO.MemoryStream")',' replaced code'
答案 0 :(得分:0)
Powershell默认情况下不了解换行符,括号和逗号应使用反斜杠转义,并且替换时不需要正则表达式,因此您必须执行以下操作:
UPDATE CUSTOMER c SET c.state = 'CA' WHERE c.id IN (idList);