在 powershell 中比较两个文件时比较对象的输出意味着什么

What does output of compare-object mean when comparing two files in powershell

下面的脚本包含两个文件,但我不清楚下面的 sideIndicator 箭头和点的理解输出:

...<=

 What does the above actually mean ?

这里是比较脚本:

  Compare-Object -referenceobject (Get-Content C:\Users\admin\Desktop\powershell_scripts\zz.txt) -differenceobject (Get-Content C:\Users\admin\Desktop\powershell_scripts\allstudents5.txt) -SyncWindow 100 -includeequal

AD\zpjnbb                ... <=                                                                   
AD\zhjfhg                ... <=    
                             <=                                    
                             <=   

在 PowerShell 中,您可以使用 Get-Help CmdLet 了解更多信息:

Get-Help Compare-Object -ShowWindow

直接来自 Description:

Description

The Compare-Object cmdlet compares two sets of objects. One set of objects is the "reference set," and the other set is the "difference set."

The result of the comparison indicates whether a property value appeared only in the object from the reference set (indicated by the <= symbol), only in the object from the difference set (indicated by the => symbol) or, if the IncludeEqual parameter is specified, in both objects (indicated by the == symbol).

NOTE: If the reference set or the difference set is null ($null), Compare-Object generates a terminating error.

逻辑上的一个小例子:

Compare-Object -ReferenceObject ('A', 'B') -DifferenceObject ('B','C') -IncludeEqual

InputObject    SideIndicator                                            
-----------    -------------                                            
B              ==                                                       
C              =>                                                       
A              <=  

更多示例您可以尝试:

Get-Help Compare-Object -Examples