Why do I get an exception calling 'ReadKey'? RRS feed

  • Question

  • Hello,

    I run the following code in my script.  What displays is 'Press any key to continue' which is the intent, but then the following error occurs without a key being pressed and the script proceeds.  I dont understand the error. Any insight as to why I see this error?

    write-Host "Press any key to continue.."
    $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

    Exception calling "ReadKey" with "1" argument(s): "The method or operation is not 
    At C:\adtest.ps1:247 char:1
    + $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : NotImplementedException

    Thanks for your help! SdeDot

    Friday, February 8, 2013 6:13 PM


All replies