This seems trivial, but I can't figure it out. Is there a native way or a .NET method to get one character at a time?
I want to take in numbers or characters from the console and perform calculations depending on what the character is. Like so:
PS C:\Users\me\> Main.ps1 L Turned Left R Turned Right R Turned Right R Turned Right L Turned Left - Goodbye PS C:\Users\me\>
which would come from a program like this:
do{
$key = Read-Char
if($key -eq "R"){Write-Host "Turned Right"}
if($key -eq "L"){Write-Host "Turned Left"}
}while($key -ne "-")Thanks.