Powershell: null file always generated (output of Compare-Object)

前端 未结 2 1207
面向向阳花
面向向阳花 2020-11-22 07:42

The most popular answer for this question involves the following Windows powershell code (edited to fix a bug):

$file1 = Get-Content C:\\temp\\file1.txt  
$f         


        
2条回答
  •  迷失自我
    2020-11-22 08:34

    Perhaps instead of

    $LeftSide = ($Diff | Where-Object {$_.SideIndicator -eq '<='}).InputObject  
    

    PowerShell 2 might work better with:

    $LeftSide = $Diff | Where-Object {$_.SideIndicator -eq '<='} | 
                Foreach-object { $_.InputObject } 
    

提交回复
热议问题