PSReadLine

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

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.