Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
properties to the fully qualified ID, the type of the error, the error message, and the target
object (which for GH CLI errors is always the command-line arguments for the failing command).
It can retrieve errors from the `$error` variable or act on an input object.
It can retrieve errors from the `$Error` variable or act on an input object.
.PARAMETER Newest
Specifies the number of error records to return, from newest to oldest.
.PARAMETER InputObject
Expand All @@ -19,7 +19,7 @@
The cmdlet gets the alternate view for the last error in the session.
.EXAMPLE
```powershell
Get-GHAConsoleError -InputObject $error[0]
Get-GHAConsoleError -InputObject $Error[0]
```
The cmdlet gets the alternate view for the last error in the session.
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/.pwsh/module/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ This cmdlet returns an alternate view of an error record for the GH CLI. It limi
properties to the fully qualified ID, the type of the error, the error message, and the target
object (which for GH CLI errors is always the command-line arguments for the failing command).

It can retrieve errors from the `$error` variable or act on an input object.
It can retrieve errors from the `$Error` variable or act on an input object.

For more information, review the [source code][utility-Get-GHAConsoleError]

Expand Down
6 changes: 3 additions & 3 deletions reference/5.1/CimCmdlets/Register-CimIndicationEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ Register-CimIndicationEvent -Query $query -SourceIdentifier "Timer"
### Example 3: Run a script when the event arrives

This example shows how to use an action in response to an event. The variable `$action` holds the
script block for **Action**, which uses the `$event` variable to access the event received from CIM.
script block for **Action**, which uses the `$Event` variable to access the event received from CIM.

```powershell
$action = {
$name = $event.SourceEventArgs.NewEvent.ProcessName
$id = $event.SourceEventArgs.NewEvent.ProcessId
$name = $Event.SourceEventArgs.NewEvent.ProcessName
$id = $Event.SourceEventArgs.NewEvent.ProcessId
Write-Host -Object "New Process Started : Name = $name ID = $id"
}
$event = @{
Expand Down
8 changes: 4 additions & 4 deletions reference/5.1/ISE/Get-IseSnippet.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ This example displays the title and description of all snippets in the session,
snippets, user-defined snippets, and imported snippets.

```powershell
$PSISE.CurrentPowerShellTab.Snippets | Format-Table DisplayTitle, Description
$psISE.CurrentPowerShellTab.Snippets | Format-Table DisplayTitle, Description
```

The `$PSISE` variable represents the Windows PowerShell ISE host program. The
**CurrentPowerShellTab** property of the `$PSISE` variable represent the current session. The
The `$psISE` variable represents the Windows PowerShell ISE host program. The
**CurrentPowerShellTab** property of the `$psISE` variable represent the current session. The
**Snippets** property represents snippets in the current session.

The `$PSISE.CurrentPowerShellTab.Snippets` command returns a
The `$psISE.CurrentPowerShellTab.Snippets` command returns a
**Microsoft.PowerShell.Host.ISE.ISESnippet** object that represents a snippet, unlike the
`Get-IseSnippet` cmdlet. `Get-IseSnippet` returns a file object (System.Io.FileInfo) that represents
a snippet file.
Expand Down
2 changes: 1 addition & 1 deletion reference/5.1/ISE/Import-IseSnippet.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ you don't need to run a command like this because modules that have snippets wil
```powershell
($env:PSModulePath).split(";") |
ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} |
ForEach-Object {$psise.CurrentPowerShellTab.Snippets.Load($_)}
ForEach-Object {$psISE.CurrentPowerShellTab.Snippets.Load($_)}
```

### Example 5: Copy all module snippets
Expand Down
2 changes: 1 addition & 1 deletion reference/5.1/ISE/New-IseSnippet.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ For more information about Windows PowerShell execution policies, see
Windows PowerShell ISE.
- To delete a snippet that you added, delete the snippet file.
- You cannot delete a built-in snippet, but you can hide all built-in snippets by using the
"$psise.Options.ShowDefaultSnippets=$false" command.
"$psISE.Options.ShowDefaultSnippets=$false" command.
- You can create a snippet that has the same name as a built-in snippet. Both snippets appear in the
snippet menu in Windows PowerShell ISE.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ non-zero integer.
### `$foreach`

Contains the enumerator (not the resulting values) of a [ForEach][56] loop. The
`$ForEach` variable exists only while the `ForEach` loop is running; it's
`$foreach` variable exists only while the `ForEach` loop is running; it's
deleted after the loop is completed.

Enumerators contain properties and methods you can use to retrieve loop values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ You can use this parameter to create a variable that contains only error
messages from specific commands and doesn't affect the behavior of the `$Error`
automatic variable. The `$Error` automatic variable contains error messages
from all the commands in the session. You can use array notation, such as
`$a[0]` or `$error[1,2]` to refer to specific errors stored in the variables.
`$a[0]` or `$Error[1,2]` to refer to specific errors stored in the variables.

> [!NOTE]
> The custom error variable contains all errors generated by the command,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ is limited to the following elements:

- All PowerShell operators, except `-match`
- `If`, `Else`, and `ElseIf` statements
- The following automatic variables: `$PsCulture`, `$PsUICulture`, `$True`,
`$False`, and `$Null`
- The following automatic variables: `$PSCulture`, `$PSUICulture`, `$true`,
`$false`, and `$null`
- Comments
- Pipelines
- Statements separated by semicolons (`;`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ for the following automatic variables:

```powershell
$_
$Args
$Input
$args
$input
$MyInvocation
$PSBoundParameters
```
Expand All @@ -144,7 +144,7 @@ variable.
For example,

```powershell
$scriptArgs = $Args
$scriptArgs = $args
$scriptname = $MyInvocation.PSCommandPath
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ following command sequence.

```powershell
$m = Get-PSSnapin Microsoft.PowerShell.Core
$m.LogPipelineExecutionDetails = $True
$m.LogPipelineExecutionDetails = $true
```

To disable logging, use the same command sequence to set the property value to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,8 @@ system files and folders, use the **Attributes** parameter.

### NewerThan \<DateTime\>

Returns `$True` when the `LastWriteTime` value of a file is greater than the
specified date. Otherwise, it returns `$False`.
Returns `$true` when the `LastWriteTime` value of a file is greater than the
specified date. Otherwise, it returns `$false`.

Enter a [DateTime][01] object, such as one that the [Get-Date][37] cmdlet
returns, or a string that can be converted to a **DateTime** object, such as
Expand All @@ -594,8 +594,8 @@ returns, or a string that can be converted to a **DateTime** object, such as

### OlderThan \<DateTime\>

Returns `$True` when the `LastWriteTime` value of a file is less than the
specified date. Otherwise, it returns `$False`.
Returns `$true` when the `LastWriteTime` value of a file is less than the
specified date. Otherwise, it returns `$false`.

Enter a **DateTime** object, such as one that the `Get-Date` cmdlet
returns, or a string that can be converted to a [DateTime][01] object, such as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ The next command copies the file contents to a new file,
`MyDotNetTypes.Format.ps1xml`.

```powershell
Copy-Item $PSHome\DotNetTypes.format.ps1xml MyDotNetTypes.Format.ps1xml
Copy-Item $PSHOME\DotNetTypes.format.ps1xml MyDotNetTypes.Format.ps1xml
```

Open the `MyDotNetTypes.Format.ps1xml` file in any XML or text editor, such as
Expand Down Expand Up @@ -451,7 +451,7 @@ $Parms = @{
Pattern = "System.IO.DirectoryInfo"
}
Select-String @Parms
Copy-Item $PSHome\FileSystem.format.ps1xml .\MyFileSystem.Format.ps1xml
Copy-Item $PSHOME\FileSystem.format.ps1xml .\MyFileSystem.Format.ps1xml
Update-FormatData -PrependPath $PSHOME\Format\MyFileSystem.Format.ps1xml
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ processing, and an `end` block for one-time post-processing.
```powershell
Function Test-ScriptCmdlet
{
[CmdletBinding(SupportsShouldProcess=$True)]
[CmdletBinding(SupportsShouldProcess=$true)]
Param ($Parameter1)
begin{}
process{}
Expand Down Expand Up @@ -423,15 +423,15 @@ need to declare or enumerate the command parameters, or change the function
when command parameters change.

The following sample function calls the `Get-Command` cmdlet. The command uses
`@Args` to represent the parameters of `Get-Command`.
`@args` to represent the parameters of `Get-Command`.

```powershell
function Get-MyCommand { Get-Command @Args }
function Get-MyCommand { Get-Command @args }
```

You can use all the parameters of `Get-Command` when you call the
`Get-MyCommand` function. The parameters and parameter values are passed to the
command using `@Args`.
command using `@args`.

```powershell
Get-MyCommand -Name Get-ChildItem
Expand All @@ -443,7 +443,7 @@ CommandType Name ModuleName
Cmdlet Get-ChildItem Microsoft.PowerShell.Management
```

The `@Args` feature uses the `$Args` automatic parameter, which represents
The `@args` feature uses the `$args` automatic parameter, which represents
undeclared cmdlet parameters and values from remaining arguments.

For more information, see [about_Splatting][19].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ processing, and an `end` block for one-time post-processing.
```powershell
Function Test-ScriptCmdlet
{
[CmdletBinding(SupportsShouldProcess=$True)]
[CmdletBinding(SupportsShouldProcess=$true)]
param ($Parameter1)
begin{}
process{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When you use the `CmdletBinding` attribute, PowerShell automatically adds the
Common Parameters. You can't create any parameters that use the same names as
the Common Parameters. For more information, see [about_CommonParameters][06].

Beginning in PowerShell 3.0, you can use splatting with `@Args` to represent
Beginning in PowerShell 3.0, you can use splatting with `@args` to represent
the parameters in a command. Splatting is valid on simple and advanced
functions. For more information, see [about_Functions][14] and
[about_Splatting][17].
Expand Down Expand Up @@ -413,7 +413,7 @@ parameter is used in a command.
By default, all function parameters are positional. PowerShell assigns position
numbers to parameters in the order the parameters are declared in the function.
To disable this feature, set the value of the `PositionalBinding` argument of
the **CmdletBinding** attribute to `$False`. The `Position` argument takes
the **CmdletBinding** attribute to `$false`. The `Position` argument takes
precedence over the value of the `PositionalBinding` argument of the
**CmdletBinding** attribute. For more information, see `PositionalBinding` in
[about_Functions_CmdletBindingAttribute][12].
Expand Down Expand Up @@ -1203,7 +1203,7 @@ function Test-UserDrivePath{
[ValidateUserDrive()]
[string]$Path
)
$True
$true
}

Test-UserDrivePath -Path C:\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ the Common Parameters. For more information, see [about_CommonParameters][02].
PowerShell binds the parameters of functions that have the `CmdletBinding`
attribute in the same way that it binds the parameters of compiled cmdlets. The
`$PSCmdlet` automatic variable is available to functions with the
`CmdletBinding` attribute, but the `$Args` variable is not available.
`CmdletBinding` attribute, but the `$args` variable is not available.

In functions that have the `CmdletBinding` attribute, unknown parameters and
positional arguments that have no matching positional parameters cause
Expand Down Expand Up @@ -174,8 +174,8 @@ lists the changes that the command would make, instead of running the command.
## PositionalBinding

The **PositionalBinding** argument determines whether parameters in the
function are positional by default. The default value is `$True`. You can use
the **PositionalBinding** argument with a value of `$False` to disable
function are positional by default. The default value is `$true`. You can use
the **PositionalBinding** argument with a value of `$false` to disable
positional binding.

The **PositionalBinding** argument is introduced in Windows PowerShell 3.0.
Expand All @@ -188,11 +188,11 @@ function command.
When parameters are not positional (they are "named"), the parameter
name (or an abbreviation or alias of the name) is required in the command.

When **PositionalBinding** is `$True`, function parameters are positional by
When **PositionalBinding** is `$true`, function parameters are positional by
default. PowerShell assigns position number to the parameters in the order in
which they are declared in the function.

When **PositionalBinding** is `$False`, function parameters are not positional
When **PositionalBinding** is `$false`, function parameters are not positional
by default. Unless the **Position** argument of the **Parameter** attribute is
declared on the parameter, the parameter name (or an alias or abbreviation)
must be included when the parameter is used in a function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ any PowerShell modules.
If this policy setting isn't configured, the **LogPipelineExecutionDetails**
property of each module determines whether PowerShell logs the execution events
of that module. By default, the **LogPipelineExecutionDetails** property of all
modules is set to `$False`.
modules is set to `$false`.

To turn on module logging for a module, use the following command format. The
module must be imported into the session and the setting is effective only in
Expand All @@ -80,7 +80,7 @@ Import-Module <Module-Name>

To turn on module logging for all sessions on a particular computer, add the
previous commands to the 'All Users' PowerShell profile
(`$Profile.AllUsersAllHosts`).
(`$PROFILE.AllUsersAllHosts`).

For more information about module logging, see
[about_Modules](about_Modules.md).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ mode:

- `$PSCulture`
- `$PSUICulture`
- `$True`
- `$False`
- `$Null`
- `$true`
- `$false`
- `$null`

Module manifests are loaded in `RestrictedLanguage` mode and may use these
additional variables:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how to edit commands at the PowerShell command prompt.
Locale: en-US
ms.date: 09/12/2022
ms.date: 02/24/2025
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_line_editing?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Line_Editing
Expand All @@ -15,8 +15,16 @@ Describes how to edit commands at the PowerShell command prompt.

## Long description

The PowerShell console has some useful keyboard shortcuts to help you edit
commands at the PowerShell command prompt.
The PSReadLine module provides useful keyboard shortcuts to help you edit
commands at the PowerShell command prompt. The key bindings discussed in this
article are the default key bindings on Windows platforms. You can create
custom key bindings by using the `Set-PSReadLineKeyHandler` command.

You can change the edit mode using the `Set-PSReadLineOption` command.
PSReadLine has three edit modes: `Emacs`, `Vi`, and `Windows`.

To see the current edit mode, use the `Get-PSReadLineOption` command. To see a
list of the current key bindings, use the `Get-PSReadLineKeyHandler` command.

### Add a line

Expand Down Expand Up @@ -76,6 +84,10 @@ key. To scroll through a list of values, press the <kbd>Tab</kbd> key again.

## See also

- [about_Command_Syntax](about_Command_Syntax.md)
- [about_Path_Syntax](about_Path_Syntax.md)
- [about_PSReadline](../../PSReadline/About/about_PSReadline.md)
- [about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md)
- [about_Tab_Expansion](about_Tab_Expansion.md)
- [Get-PSReadLineOption](xref:PSReadLine.Get-PSReadLineOption)
- [Get-PSReadLineKeyHandler](xref:PSReadLine.Get-PSReadLineKeyHandler)
- [Set-PSReadLineOption](xref:PSReadLine.Set-PSReadLineOption)
- [Set-PSReadLineKeyHandler](xref:PSReadLine.Set-PSReadLineKeyHandler)
- [Using PSReadLine key handlers](/powershell/scripting/learn/shell/using-keyhandlers)
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ For example, the following command creates a session option object.
```powershell
[System.Management.Automation.Remoting.PSSessionOption]@{
IdleTimeout=43200000
SkipCnCheck=$True
SkipCnCheck=$true
}
```

Expand Down Expand Up @@ -291,7 +291,7 @@ cmdlet can be a hash table.
```powershell
New-PSSession -ComputerName Server01 -SessionOption @{
IdleTimeout=43200000
SkipCnCheck=$True
SkipCnCheck=$true
}
Register-ScheduledJob -Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{
Frequency="Daily"
Expand Down
Loading