• Narrow screen resolution
  • Wide screen resolution
  • Increase font size
  • Decrease font size
  • Default font size
  • default color
  • red color
© Diana Scherff, Amas-Veritas.com

Welcome to Amas Veritas [dot] com

Updates: Media (lyrics) has a new layout. I could never figure out how to lay it out, but it's easier to navigate now. I'm still working on a better duplicate Mamblog mod. I'm trying to make submittions easier but the poetry form died for some reason. Quizzes are also on their way from the old site. Joomla content isn't very code friendly so I'm having to rewrite old code. You can still click on News > AH v21 > Screen if you wish to use the quizzes.
 
Home arrow Tools arrow Software arrow Compare-Object [diff]
Compare-Object [diff] Print E-mail
Written by Diana, on 04-09-2007 00:03
Views 98    
Favoured None

PS C:\Users\Admin> help diff -full

NAME
    Compare-Object

SYNOPSIS
    Compares two sets of objects.

SYNTAX
    Compare-Object [-referenceObject] <PSObject[]> [-differenceObject] <PSObject[]> [-syncWindow <int>] [-property <Object[]>] [-caseSensitive] [-culture <string>] [-excludeDifferent] [-includeEqual] [-passThru] [<CommonParameters>]


DETAILED DESCRIPTION
    Compares two sets of objects. One set of objects is the Reference set and the other 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).


PARAMETERS
    -referenceObject <PSObject[]>
        Objects used as a reference for comparison.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?       false
        Accept wildcard characters?  false

    -differenceObject <PSObject[]>
        Objects to compare to those specified as reference objects.

        Required?                    true
        Position?                    2
        Default value
        Accept pipeline input?       true (ByValue)
        Accept wildcard characters?  false

    -syncWindow <int>
        Defines a search region where an attempt is made to re-sync the order if there is no match.

        Required?                    false
        Position?                    named
        Default value                5
        Accept pipeline input?       false
        Accept wildcard characters?  false

    -property <Object[]>
        Specifies the properties of the reference and difference objects to compare.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?       false
        Accept wildcard characters?  false

    -caseSensitive <SwitchParameter>
        Indicates that comparisons should be case-sensitive.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

    -culture <string>
        Specifies the culture to use for comparisons.

        Required?                    false
        Position?                    named
        Default value                <default culture>
        Accept pipeline input?       false
        Accept wildcard characters?  false

    -excludeDifferent <SwitchParameter>
        Displays only the characteristics of compared objects that are equal.

        Required?                    false
        Position?                    named
        Default value                True
        Accept pipeline input?       false
        Accept wildcard characters?  false

    -includeEqual <SwitchParameter>
        Displays characteristics of compared objects that are equal. By default, only characteristics that differ between the reference and difference object are displayed.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

    -passThru <SwitchParameter>
        Passes the object created by this cmdlet through the pipeline. By default, this cmdlet does not pass any objects through the pipeline.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

    <CommonParameters>
        This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".



INPUT TYPE
    Object


RETURN TYPE
    Objects


NOTES


        For more information, type "Get-Help Compare-Object -detailed". For technical information, type "Get-Help Compare-Object -full".

        When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".


    ----------------- EXAMPLE 1 -----------------

    C:\PS>compare-object -referenceobject $(get-content C:\test\testfile1.txt) -differenceobject $(get-content C:\test\testfile2.txt)


    This command compares the contents of two text files. It displays only those lines which appear in one or the other file, but not in both files.





    ----------------- EXAMPLE 2 -----------------

    C:\PS>compare-object -referenceobject $(get-content C:\Test\testfile1.txt) -differenceobject $(get-content C:\Test\testfile2.txt) -includeequal


    This command compares each line of content in two text files. It displays all lines of content from both files indicating whether each line appears in only textfile1.txt or textfile2.txt or appears in both of the files.





    ----------------- EXAMPLE 3 -----------------

    C:\PS>$processes_before = get-process
    notepad
    $processes_after  = get-process
    compare-object -referenceobject $processes_before -differenceobject $processes_after


    This command compares two sets of process objects. The Get-Process cmdlet is used to retrieve the processes running on the computer and store them in the $processes_before variable. An instance of Notepad is then started. The Get-Process cmdlet is used again to retrieve the processes running on the computer and store them in the $processes_after variable. In the last line, Compare-Object is used to compare the two sets of process objects, displaying the differences between them, which includes the new instance of Notepad at least.






RELATED LINKS
    Group-Object
    Measure-Object
    Sort-Object
    ForEach-Object
    New-Object
    Select-Object
    Tee-Object
    Where-Object


Last update: 04-09-2007 00:03

Published in : Tools, Windows PowerShell

Users' Comments (0) RSS feed comment

No comment posted

Add your comment



mXcomment 1.0.4 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved
 
< Prev   Next >




Double click any word on this page for a definition.
Using Firefox? Enable definitions by downloading the extension.
Sorry, this feature does not currently work in Opera or Safari.

No Users Online

Statistics

OS: FreeBSD
PHP: 5.2.1
MySQL: 4.1.21-log
Time: 05:14
Caching: Disabled
GZIP: Disabled
Members: 35
News: 2446
Web Links: 39
Visitors: 1235290

Syndicate

Login

Particls