diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md index 3df1edf84a30..5d570c6c8eae 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md @@ -1,33 +1,31 @@ --- -description: Explains how to create a customize how PowerShell reads input at the console prompt. +description: Explains how to customize how PowerShell reads input at the console prompt. Locale: en-US -ms.date: 01/04/2018 +ms.date: 01/09/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_psconsolehostreadline?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSConsoleHostReadLine --- - # about_PSConsoleHostReadLine ## Short description - -Explains how to create a customize how PowerShell reads input at the console -prompt. +Explains how to customize how PowerShell reads input at the console prompt. ## Long description -Starting in Windows PowerShell V3, you can write a function named -PSConsoleHostReadLine that overrides the default way that console input is +Starting in Windows PowerShell 3.0, you can write a function named +`PSConsoleHostReadLine` that overrides the default way that console input is processed. -### EXAMPLES +This function is extended by the **PSReadLine** module. -The following example launches Notepad and gets input from a text File that +### Examples + +The following example launches Notepad and gets input from a text file that the user creates: ```powershell -function PSConsoleHostReadLine -{ +function PSConsoleHostReadLine { $inputFile = Join-Path $env:TEMP PSConsoleHostReadLine Set-Content $inputFile "PS > " @@ -39,18 +37,21 @@ function PSConsoleHostReadLine } ``` -### REMARKS - -By default, PowerShell reads input from the console in what is known as -"Cooked Mode" -- in which the Windows console subsystem handles all the -keypresses, F7 menus, and other input. When you press Enter or Tab, Windows -PowerShell gets the text that you have typed up to that point. There is no way -for it to know that you pressed Ctrl-R, Ctrl-A, Ctrl-E, or any other keys -before pressing Enter or Tab. In Windows PowerShell version 3, the -PSConsoleHostReadLine function solves this issue. When you define a function -named PSConsoleHostReadline in the Windows PowerShell console host, Windows +### Remarks + +By default, PowerShell reads input from the console in what is known as "Cooked +Mode" -- in which the Windows console subsystem handles all the keypresses, +F7 menus, and other input. When you press Enter or +Tab, PowerShell gets the text that you have typed up to that point. +There is no way for it to know that you pressed Ctrl+R, +Ctrl+A, Ctrl+E, or any other keys +before pressing Enter or Tab. In Windows PowerShell 3.0, +the `PSConsoleHostReadLine` function solves this issue. When you define a +function named `PSConsoleHostReadline` in the PowerShell console host, PowerShell calls that function instead of the "Cooked Mode" input mechanism. ## See Also - [about_Prompts](about_Prompts.md) +- [PSConsoleHostReadLine](/powershell/module/psreadline/psconsolehostreadline) +- [High-Level Console Modes](/windows/console/high-level-console-modes) diff --git a/reference/5.1/PSReadLine/PSConsoleHostReadLine.md b/reference/5.1/PSReadLine/PSConsoleHostReadLine.md index 5953816d8e97..6c453ee59cea 100644 --- a/reference/5.1/PSReadLine/PSConsoleHostReadLine.md +++ b/reference/5.1/PSReadLine/PSConsoleHostReadLine.md @@ -2,7 +2,7 @@ external help file: PSReadLine-help.xml Locale: en-US Module Name: PSReadLine -ms.date: 06/27/2024 +ms.date: 01/09/2025 online version: https://learn.microsoft.com/powershell/module/psreadline/psconsolehostreadline?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: PSConsoleHostReadLine diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md index e9b739371c57..0ef19bc30d29 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md @@ -1,7 +1,7 @@ --- -description: Explains how to create a customize how PowerShell reads input at the console prompt. +description: Explains how to customize how PowerShell reads input at the console prompt. Locale: en-US -ms.date: 01/04/2018 +ms.date: 01/09/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_psconsolehostreadline?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSConsoleHostReadLine @@ -9,23 +9,23 @@ title: about_PSConsoleHostReadLine # about_PSConsoleHostReadLine ## Short description -Explains how to create a customize how PowerShell reads input at the console -prompt. +Explains how to customize how PowerShell reads input at the console prompt. ## Long description Starting in Windows PowerShell 3.0, you can write a function named -PSConsoleHostReadLine that overrides the default way that console input is +`PSConsoleHostReadLine` that overrides the default way that console input is processed. -### EXAMPLES +This function is extended by the **PSReadLine** module. -The following example launches Notepad and gets input from a text File that +### Examples + +The following example launches Notepad and gets input from a text file that the user creates: ```powershell -function PSConsoleHostReadLine -{ +function PSConsoleHostReadLine { $inputFile = Join-Path $env:TEMP PSConsoleHostReadLine Set-Content $inputFile "PS > " @@ -37,18 +37,21 @@ function PSConsoleHostReadLine } ``` -### REMARKS +### Remarks By default, PowerShell reads input from the console in what is known as "Cooked -Mode" -- in which the Windows console subsystem handles all the keypresses, F7 -menus, and other input. When you press Enter or Tab, PowerShell gets the text -that you have typed up to that point. There is no way for it to know that you -pressed Ctrl-R, Ctrl-A, Ctrl-E, or any other keys before pressing Enter or Tab. -In Windows PowerShell 3.0, the PSConsoleHostReadLine function solves this -issue. When you define a function named PSConsoleHostReadline in the PowerShell -console host, PowerShell calls that function instead of the "Cooked Mode" input -mechanism. +Mode" -- in which the Windows console subsystem handles all the keypresses, +F7 menus, and other input. When you press Enter or +Tab, PowerShell gets the text that you have typed up to that point. +There is no way for it to know that you pressed Ctrl+R, +Ctrl+A, Ctrl+E, or any other keys +before pressing Enter or Tab. In Windows PowerShell 3.0, +the `PSConsoleHostReadLine` function solves this issue. When you define a +function named `PSConsoleHostReadline` in the PowerShell console host, +PowerShell calls that function instead of the "Cooked Mode" input mechanism. ## See Also - [about_Prompts](about_Prompts.md) +- [PSConsoleHostReadLine](/powershell/module/psreadline/psconsolehostreadline) +- [High-Level Console Modes](/windows/console/high-level-console-modes) diff --git a/reference/7.4/PSReadLine/PSConsoleHostReadLine.md b/reference/7.4/PSReadLine/PSConsoleHostReadLine.md index aec443eba18c..5a017c56c69e 100644 --- a/reference/7.4/PSReadLine/PSConsoleHostReadLine.md +++ b/reference/7.4/PSReadLine/PSConsoleHostReadLine.md @@ -2,7 +2,7 @@ external help file: PSReadLine-help.xml Locale: en-US Module Name: PSReadLine -ms.date: 06/27/2024 +ms.date: 01/09/2025 online version: https://learn.microsoft.com/powershell/module/psreadline/psconsolehostreadline?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: PSConsoleHostReadLine diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md index 728ced7a117f..6343d212f1e2 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md @@ -1,7 +1,7 @@ --- -description: Explains how to create a customize how PowerShell reads input at the console prompt. +description: Explains how to customize how PowerShell reads input at the console prompt. Locale: en-US -ms.date: 01/04/2018 +ms.date: 01/09/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_psconsolehostreadline?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSConsoleHostReadLine @@ -9,24 +9,23 @@ title: about_PSConsoleHostReadLine # about_PSConsoleHostReadLine ## Short description - -Explains how to create a customize how PowerShell reads input at the console -prompt. +Explains how to customize how PowerShell reads input at the console prompt. ## Long description Starting in Windows PowerShell 3.0, you can write a function named -PSConsoleHostReadLine that overrides the default way that console input is +`PSConsoleHostReadLine` that overrides the default way that console input is processed. -### EXAMPLES +This function is extended by the **PSReadLine** module. + +### Examples -The following example launches Notepad and gets input from a text File that +The following example launches Notepad and gets input from a text file that the user creates: ```powershell -function PSConsoleHostReadLine -{ +function PSConsoleHostReadLine { $inputFile = Join-Path $env:TEMP PSConsoleHostReadLine Set-Content $inputFile "PS > " @@ -38,18 +37,21 @@ function PSConsoleHostReadLine } ``` -### REMARKS +### Remarks By default, PowerShell reads input from the console in what is known as "Cooked -Mode" -- in which the Windows console subsystem handles all the keypresses, F7 -menus, and other input. When you press Enter or Tab, PowerShell gets the text -that you have typed up to that point. There is no way for it to know that you -pressed Ctrl-R, Ctrl-A, Ctrl-E, or any other keys before pressing Enter or Tab. -In Windows PowerShell 3.0, the PSConsoleHostReadLine function solves this -issue. When you define a function named PSConsoleHostReadline in the PowerShell -console host, PowerShell calls that function instead of the "Cooked Mode" input -mechanism. +Mode" -- in which the Windows console subsystem handles all the keypresses, +F7 menus, and other input. When you press Enter or +Tab, PowerShell gets the text that you have typed up to that point. +There is no way for it to know that you pressed Ctrl+R, +Ctrl+A, Ctrl+E, or any other keys +before pressing Enter or Tab. In Windows PowerShell 3.0, +the `PSConsoleHostReadLine` function solves this issue. When you define a +function named `PSConsoleHostReadline` in the PowerShell console host, +PowerShell calls that function instead of the "Cooked Mode" input mechanism. ## See Also - [about_Prompts](about_Prompts.md) +- [PSConsoleHostReadLine](/powershell/module/psreadline/psconsolehostreadline) +- [High-Level Console Modes](/windows/console/high-level-console-modes) diff --git a/reference/7.5/PSReadLine/PSConsoleHostReadLine.md b/reference/7.5/PSReadLine/PSConsoleHostReadLine.md index 160d3b632369..3abc5d6b1337 100644 --- a/reference/7.5/PSReadLine/PSConsoleHostReadLine.md +++ b/reference/7.5/PSReadLine/PSConsoleHostReadLine.md @@ -2,7 +2,7 @@ external help file: PSReadLine-help.xml Locale: en-US Module Name: PSReadLine -ms.date: 06/27/2024 +ms.date: 01/09/2025 online version: https://learn.microsoft.com/powershell/module/psreadline/psconsolehostreadline?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: PSConsoleHostReadLine