0

I have this following code

$filenameFormat1 = "new_permission.txt" 
$approvedLogsName = "last_permissions.txt"
Compare-Object -referenceobject $(get-content "E:\\logs\$approvedLogsName") -differenceobject $(get-content "E:\\logs\$filenameFormat1") | 
Out-File E:\\logs\output.txt

When I run this code in the PowerShell ISE, I get both '<=', '=>' Side Indicators. But If I run it on normal PowerShell or CMD, the SideIndicator is completely missing.

There's no error messages.

I tried adding the where-object as in this question PowerShell Compare-Object SideIndicator. If I run it with

where-object -eq '=>'

It prints the all the list items which are '=>' but if I change the side, the result again missing the SideIndicator completely

Any tips or suggestions will be highly appreciated

Mujahid
  • 1,227
  • 5
  • 32
  • 62
  • It works for me. Can you show the contents of the two files, at least enough to reproduce the problem? `where-object -eq '=>'` gives me a syntax error. Note that compare-object sorts the two files before comparing them. Out-file will convert the result to text and add formatting. No indicators could also mean the files are equal, or you're comparing two empty files. – js2010 May 20 '20 at 13:26
  • I suggest adding the output of `$PSVersionTable` to your question. I have personally had some odd new issues with output in PowerShell 7 (very recent release) which I didn't see on Windows PowerShell 5.1 or PowerShell 6.x. – Dusty Vargas May 20 '20 at 23:43

0 Answers0