Skip to content

Commit

Permalink
Fix note about executable extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwheeler committed Nov 9, 2024
1 parent 03f8d66 commit bab2044
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 131 deletions.
76 changes: 41 additions & 35 deletions reference/5.1/Microsoft.PowerShell.Core/Get-Command.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: System.Management.Automation.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Core
ms.date: 01/21/2023
ms.date: 11/09/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/get-command?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Get-Command
Expand Down Expand Up @@ -39,14 +39,15 @@ aliases, functions, filters, scripts, and applications. `Get-Command` gets the c
PowerShell modules and commands that were imported from other sessions. To get only commands that
have been imported into the current session, use the **ListImported** parameter.

Without parameters, `Get-Command` gets all of the cmdlets, functions, and aliases installed on the
computer. `Get-Command *` gets all types of commands, including all of the non-PowerShell files in
the Path environment variable (`$env:Path`), which it lists in the Application command type.
Without parameters, `Get-Command` gets all the cmdlets, functions, and aliases installed on the
computer. `Get-Command *` gets all types of commands, including all the non-PowerShell files in the
Path environment variable (`$env:PATH`), which it lists in the Application command type.

`Get-Command` that uses the exact name of the command, without wildcard characters, automatically
imports the module that contains the command so that you can use the command immediately. To enable,
disable, and configure automatic importing of modules, use the `$PSModuleAutoLoadingPreference`
preference variable. For more information, see [about_Preference_Variables](About/about_Preference_Variables.md).
preference variable. For more information, see
[about_Preference_Variables](About/about_Preference_Variables.md).

`Get-Command` gets its data directly from the command code, unlike `Get-Help`, which gets its
information from help topics.
Expand Down Expand Up @@ -74,7 +75,7 @@ Get-Command -ListImported

### Example 3: Get cmdlets and display them in order

This command gets all of the cmdlets, sorts them alphabetically by the noun in the cmdlet name, and
This command gets all the cmdlets, sorts them alphabetically by the noun in the cmdlet name, and
then displays them in noun-based groups. This display can help you find the cmdlets for a task.

```powershell
Expand All @@ -93,7 +94,7 @@ Get-Command -Module Microsoft.PowerShell.Security, Microsoft.PowerShell.Utility
### Example 5: Get information about a cmdlet

This command gets information about the `Get-AppLockerPolicy` cmdlet. It also imports the
**AppLocker** module, which adds all of the commands in the **AppLocker** module to the current
**AppLocker** module, which adds all the commands in the **AppLocker** module to the current
session.

```powershell
Expand All @@ -103,28 +104,30 @@ Get-Command Get-AppLockerPolicy
When a module is imported automatically, the effect is the same as using the Import-Module cmdlet.
The module can add commands, types and formatting files, and run scripts in the session. To enable,
disable, and configuration automatic importing of modules, use the `$PSModuleAutoLoadingPreference`
preference variable. For more information, see [about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md).
preference variable. For more information, see
[about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md).

### Example 6: Get the syntax of a cmdlet

This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the
`Get-ChildItem` cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive
that the Certificate Provider adds to the session.
`Get-ChildItem` cmdlet when it's used in the Cert: drive. The Cert: drive is a PowerShell drive that
the Certificate Provider adds to the session.

```powershell
Get-Command -Name Get-Childitem -Args Cert: -Syntax
```

When you compare the syntax displayed in the output with the syntax that is displayed when you omit
the **Args** (**ArgumentList**) parameter, you'll see that the **Certificate provider** adds a dynamic
parameter, **CodeSigningCert**, to the `Get-ChildItem` cmdlet.
When you compare the syntax displayed in the output with the syntax that's displayed when you omit
the **Args** (**ArgumentList**) parameter, you'll see that the **Certificate provider** adds a
dynamic parameter, **CodeSigningCert**, to the `Get-ChildItem` cmdlet.

For more information about the Certificate provider, see [about_Certificate_Provider](../Microsoft.PowerShell.Security/About/about_Certificate_Provider.md).
For more information about the Certificate provider, see
[about_Certificate_Provider](../Microsoft.PowerShell.Security/About/about_Certificate_Provider.md).

### Example 7: Get dynamic parameters

The command in the example uses the `Get-DynamicParameters` function to get the dynamic parameters
that the Certificate provider adds to the `Get-ChildItem` cmdlet when it is used in the Cert: drive.
that the Certificate provider adds to the `Get-ChildItem` cmdlet when it's used in the Cert: drive.

```powershell
function Get-DynamicParameters
Expand All @@ -151,7 +154,7 @@ cmdlet by another cmdlet or a provider.
### Example 8: Get all commands of all types

This command gets all commands of all types on the local computer, including executable files in the
paths of the **Path** environment variable (`$env:path`).
paths of the **Path** environment variable (`$env:PATH`).

```powershell
Get-Command *
Expand All @@ -169,7 +172,7 @@ This command gets cmdlets that have a parameter whose name includes Auth and who
Get-Command -ParameterName *Auth* -ParameterType AuthenticationMechanism
```

You can use a command like this one to find cmdlets that let you specify the method that is used to
You can use a command like this one to find cmdlets that let you specify the method that's used to
authenticate the user.

The **ParameterType** parameter distinguishes parameters that take an **AuthenticationMechanism**
Expand All @@ -189,7 +192,7 @@ CommandType Name ModuleName
Alias dir -> Get-ChildItem
```

Although it is typically used on cmdlets and functions, `Get-Command` also gets scripts, functions,
Although it's typically used on cmdlets and functions, `Get-Command` also gets scripts, functions,
aliases, and executable files.

The output of the command shows the special view of the **Name** property value for aliases. The
Expand Down Expand Up @@ -220,7 +223,8 @@ the **All** parameter, `Get-Command` gets all commands with the specified name a
execution precedence order. To run a command other than the first one in the list, type the fully
qualified path to the command.

For more information about command precedence, see [about_Command_Precedence](About/about_Command_Precedence.md).
For more information about command precedence, see
[about_Command_Precedence](About/about_Command_Precedence.md).

### Example 12: Get the name of a module that contains a cmdlet

Expand All @@ -235,7 +239,7 @@ The command uses the **ModuleName** property of all commands.
Microsoft.PowerShell.Utility
```

This command format works on commands in PowerShell modules, even if they are not imported into the
This command format works on commands in PowerShell modules, even if they're not imported into the
session.

### Example 13: Get cmdlets and functions that have an output type
Expand Down Expand Up @@ -288,10 +292,10 @@ get the first net adapter that the cmdlet returns.
Indicates that this cmdlet gets all commands, including commands of the same type that have the same
name. By default, `Get-Command` gets only the commands that run when you type the command name.

For more information about the method that PowerShell uses to select the command to run when
multiple commands have the same name, see [about_Command_Precedence](About/about_Command_Precedence.md).
For information about module-qualified command names and running commands that do not run by default
because of a name conflict, see [about_Modules](About/about_Modules.md).
For more information about the order that PowerShell searches for commands, see
[about_Command_Precedence](About/about_Command_Precedence.md). For information about
module-qualified command names and running commands that don't run by default because of a name
conflict, see [about_Modules](About/about_Modules.md).

This parameter was introduced in Windows PowerShell 3.0.

Expand All @@ -311,15 +315,15 @@ Accept wildcard characters: False
### -ArgumentList
Specifies an array of arguments. This cmdlet gets information about a cmdlet or function when it is
Specifies an array of arguments. This cmdlet gets information about a cmdlet or function when it's
used with the specified parameters ("arguments"). The alias for **ArgumentList** is **Args**.
To detect dynamic parameters that are available only when certain other parameters are used, set the
value of **ArgumentList** to the parameters that trigger the dynamic parameters.
To detect the dynamic parameters that a provider adds to a cmdlet, set the value of the
**ArgumentList** parameter to a path in the provider drive, such as WSMan:, HKLM:, or Cert:. When
the command is a PowerShell provider cmdlet, enter only one path in each command. The provider
**ArgumentList** parameter to a path in the provider drive, such as `WSMan:`, `HKLM:`, or `Cert:`.
When the command is a PowerShell provider cmdlet, enter only one path in each command. The provider
cmdlets return only the dynamic parameters for the first path the value of **ArgumentList**. For
information about the provider cmdlets, see [about_Providers](About/about_Providers.md).

Expand Down Expand Up @@ -348,18 +352,19 @@ The acceptable values for this parameter are:

- `All`: Gets all command types. This parameter value is the equivalent of `Get-Command *`.

- `Application`: Gets non-PowerShell files in paths listed in the **Path** environment variable
(`$env:path`), including `.txt`, `.exe`, and `.dll` files. For more information about the **Path**
environment variable, see [about_Environment_Variables](About/about_Environment_Variables.md).
- `Application`: Searches folders in the `$env:PATH` environment variable for non-PowerShell
executable files. On Windows, executable files have a file extension that is listed in the
`$env:PATHEXT` environment variable. For more information, see
[about_Environment_Variables](About/about_Environment_Variables.md).

- `Cmdlet`: Gets all cmdlets.

- `ExternalScript`: Gets all `.ps1` files in the paths listed in the **Path** environment variable
(`$env:path`).
(`$env:PATH`).

- `Filter` and `Function`: Gets all PowerShell advanced and simple functions and filters.

- `Script`: Gets all script blocks. To get PowerShell scripts (`.ps1 `files), use the
- `Script`: Gets all script blocks. To get PowerShell scripts (`.ps1` files), use the
`ExternalScript` value.

- `Workflow`: Gets all workflows. For more information about workflows, see Introducing Windows
Expand Down Expand Up @@ -409,7 +414,7 @@ A module specification is a hashtable that has the following keys.
- `RequiredVersion` - Specifies an exact, required version of the module. This can't be used with
the other Version keys.

You cannot specify the **FullyQualifiedModule** parameter in the same command as a **Module**
You can't specify the **FullyQualifiedModule** parameter in the same command as a **Module**
parameter. The two parameters are mutually exclusive.

```yaml
Expand Down Expand Up @@ -629,7 +634,8 @@ Accept wildcard characters: True

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](About/about_CommonParameters.md).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](About/about_CommonParameters.md).

## INPUTS

Expand All @@ -641,7 +647,7 @@ You can pipe command names to this cmdlet.

### System.Management.Automation.CommandInfo

This cmdlet returns objects derived from the **CommandInfo** class. The type of object that is
This cmdlet returns objects derived from the **CommandInfo** class. The type of object that's
returned depends on the type of command that `Get-Command` gets.

### System.Management.Automation.AliasInfo
Expand Down
Loading

0 comments on commit bab2044

Please sign in to comment.