Site icon Dotnet Helpers

How to Read Multiline User Input in Powershell

Here we will discuss about reading multi line inputs from command line using PowerShell. In some time we often get requirement to enter multiple lines or paragraphs of text as input to a PowerShell script, so we are going to discuss in this article.

Here logic is very simple, the Get-MultiLineInput function will repeatedly call Read-Host till the value entered by the user with “exit”. If user enter with “exit” then immediately it will stopping the loop.

OUTPUT:

Exit mobile version