console.readlinescriptcsconsole.readkey

Reading user input from powershell through scriptcs


Here I have a problem to read user inputs from Command prompt or windows powershell through scriptcs.I tried with Console.ReadLine(),Console.Read() or Console.ReadKey() wrapped it around Convert.ToString() to get user response but none of them gives result.Do I need any special package to handle the user input. Any help is appreciated.


Solution

  • I got the solution I was previously executing through Windows power shell and so I don't get the response as desired while using Console.ReadLine() or Console.Read().It appears as if it got hanged and processing instruction indefinitely. But when I work the scriptcs code in command prompt it reads the input and works as expected.