Compare string doesn't compare each word

Hi,
I have two text files with values in it as below;
File A
hello
superman
spiderman

File B
batman
coolguy
spiderman
When I use command compare-object $A $B I get below result, please help as I need each word to be compared but here it takes file A words as whole line and gives result as ‘Hello Superman spiderman’ =>

Possibly a problem with the line break characters although I can’t replicate it. How was the text file generated and how are you getting the files in $a and $b? Get-Content?

Hi Matt,
Yes, I use get-content to get $A and $B. The compare works when I run command in below format :frowning:
compare-object $(get-content C:\Temp\Ref.txt) $(get-content C:\Temp\Des.txt) -IncludeEqual

Thanks,
Kishor