PowerTip: Use PowerShell to Display Syntax for a Cmdlet

PowerTip: Use PowerShell to Display Syntax for a Cmdlet

  • Comments 3
  • Likes

Summary: Use Windows PowerShell to display the syntax of a Windows PowerShell cmdlet.

Hey, Scripting Guy! Question How can I use Windows PowerShell to look at the syntax of a cmdlet without the distraction of a lot of additional information?

Hey, Scripting Guy! Answer Use the Get-Help cmdlet, and choose only the Syntax property. 
          (The following example uses the Get-Process cmdlet):

PS C:\> (get-help get-process).syntax

 

Get-Process [[-Name] <String[]>] [-ComputerName <String[]>] [-FileVersionInfo]

[-Module] [<CommonParameters>]

Get-Process [-ComputerName <String[]>] [-FileVersionInfo] [-Module] -InputObject

<Process[]> [<CommonParameters>]

Get-Process [-ComputerName <String[]>] [-FileVersionInfo] [-Module] -Id <Int32[]>

[<CommonParameters>]

Get-Process -Id <Int32[]> -IncludeUserName [<CommonParameters>]

Get-Process -IncludeUserName -InputObject <Process[]> [<CommonParameters>]

Get-Process [[-Name] <String[]>] -IncludeUserName [<CommonParameters>] 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • This is the reason for all PS script we need to write a clean and helpful help content

    (get-help get-process).Synopsis

    Gets the processes that are running on the local computer or a remote computer.

    (get-help get-process) | GM

    (get-help get-process).Examples

    Returns Examples - Very handy tip

  • Thank you! Very much appreaciated.

  • Nice sample. Thanks for sharing