none
[console]::setcursorposition RRS feed

  • Question

  • I got error when try to use [console]::setcursorposition. Any suggestion? Thanks.

    PS C:\>  [console]::setcursorposition

    OverloadDefinitions                                                                                                                                                                           
    -------------------                                                                                                                                                                            
    static void SetCursorPosition(int left, int top)

    PS C:\>  [console]::setcursorposition(1,1)
    Exception calling "SetCursorPosition" with "2" argument(s): "The handle is invalid.
    "
    At line:1 char:2
    +  [console]::setcursorposition(1,1)
    +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : IOException

    Sunday, May 4, 2014 3:46 AM

Answers

  • I assume you're running that in the ISE, not PowerShell.exe. The ISE does not use the Win32 Console subsystem, which is what you control via the [Console] class. The ISE is a WinForms app, including its console pane.
    • Marked as answer by Ian3 Sunday, May 4, 2014 4:16 AM
    Sunday, May 4, 2014 3:53 AM