本帖最后由 yhcfsr 于 2019-1-16 01:04 编辑
回复 2# ivor
一个很诡异的问题.代码在ISE中,第一次执行,显示如下错误
然后,再运行一次又正常了.- 找不到“replace”的重载,参数计数为:“3”。
- 所在位置 C:\Users\CF\Desktop\无标题2.ps1:3 字符: 2
- + ([regex]$pattern='(?=.*BENDE)(?=.*LASTF).*\r?\n?').replace([IO.File]: ...
- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : NotSpecified: (:) [], MethodException
- + FullyQualifiedErrorId : MethodCountCouldNotFindBest
复制代码 另一个诡异的问题是,右键以powershell运行脚本,无论如何都会有上述的重载错误.
测试环境WIN10,PS版本如下:
- Name Value
- ---- -----
- PSVersion 5.1.17763.134
- PSEdition Desktop
- PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
- BuildVersion 10.0.17763.134
- CLRVersion 4.0.30319.42000
- WSManStackVersion 3.0
- PSRemotingProtocolVersion 2.3
- SerializationVersion 1.1.0.1
复制代码
|