共用方式為


PSReadLine Module

PSReadLine 模組包含 Cmdlet,可讓您在 PowerShell 中自定義命令行編輯環境。

自 Windows PowerShell 5.1 隨附的版本以來,PSReadLine 有許多更新。

  • PowerShell 7.4.0 隨 PSReadLine 2.3.4 一起提供
  • PowerShell 7.3.0 隨 PSReadLine 2.2.6 一起提供
  • PowerShell 7.2.5 附帶 PSReadLine 2.1.0
  • PowerShell 7.0.11 隨 PSReadLine 2.0.4 一起提供
  • PowerShell 5.1 附帶 PSReadLine 2.0.0

這些文章介紹了 PSReadLine 的 2.2.6 版。

備註

從 PowerShell 7.0 開始,如果偵測到螢幕助讀程式程式,PowerShell 會略過 Windows 上的自動載入 PSReadLine。 目前,PSReadLine 不適用於螢幕助讀程式。 Windows 上 PowerShell 7.0 的預設轉譯和格式設定可正常運作。 您可以視需要手動載入模組。

PSReadLine Cmdlet

指令程式 Description
Get-PSReadLineKeyHandler

Gets the key bindings for the PSReadLine module.

Get-PSReadLineOption

Gets values for the options that can be configured.

PSConsoleHostReadLine

This function is the main entry point for PSReadLine.

Remove-PSReadLineKeyHandler

Removes a key binding.

Set-PSReadLineKeyHandler

Binds keys to user-defined or PSReadLine key handler functions.

Set-PSReadLineOption

Customizes the behavior of command line editing in PSReadLine.