【问题标题】:Export matching result from 2 variables从 2 个变量中导出匹配结果
【发布时间】:2019-03-13 15:14:51
【问题描述】:

我想将另外两个匹配值导出到一个变量中。

例如:

$a

C: 丁: F: G:

$b

C: G: H:

$c 变量结果将是

C: G:

我没有找到任何允许执行此类操作的函数。

【问题讨论】:

  • 我很难相信任何非零数量的研究都不应该出现Compare-Object

标签: powershell variables compare export matching


【解决方案1】:

您正在寻找Compare-Object。以下内容适用于您的示例:

$c = (Compare-Object -ReferenceObject $a -DifferenceObject $b -IncludeEqual -ExcludeDifferent).InputObject

【讨论】:

    猜你喜欢
    • 2014-10-21
    • 2014-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多