PowerTip: Use PowerShell Get-Command to Show Syntax

Summary: Use the Windows PowerShell Get-Command cmdlet to show syntax of cmdlets.

Hey, Scripting Guy! Question How can I use Windows PowerShell to explore the allowed syntax for a specific cmdlet?

Hey, Scripting Guy! Answer Use the Get-Command cmdlet, and use the –syntax switch, for example:

Get-Command Get-WinEvent -Syntax

Comments (2)

  1. Matthew says:

    How exactly does this differ from ‘get-winevent -?’

  2. QK says:

    ‘Get-command Get-WinEvent -Syntax’ displays only the syntax of the cmdlet.
    ‘Get-WinEvent -?’ displays the help info for the cmdlet on a single page, this includes Name, Synopsis, Syntax, Description, Related Links & Remarks

Skip to main content