http://www.perlmonks.org?node_id=1056292

tarunmudgal4u has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I'm working on a script wherein I want to check the current cursor position on the console whether it's at the beginning of the line or somewhere in between.

I tried using tell function but it returns total bytes rather coordinates. If I can get cursor coordinates somehow, I would be able to check the x coordinate and confirm if cursor it at the beginning of the line or not.

Please let me know your suggestions on this

  • Comment on How to get current cursor position on Windows command prompt

Replies are listed 'Best First'.
Re: How to get current cursor position on Windows command prompt
by davido (Cardinal) on Sep 30, 2013 at 06:58 UTC

    Win32::Console: ($x, $y, $size, $visible) = $CONSOLE->Cursor();. I don't use Windows much anymore, but the module looks very useful for 1980's style user interfaces. ;)


    Dave

Re: How to get current cursor position on Windows command prompt
by Marshall (Canon) on Sep 30, 2013 at 08:19 UTC
    I ask what application you are trying to accomplish?

    Can you describe this more?

    A normal command prompt application allows you to edit the input (backspace or insert/delete) and then hit "return" and the command executes.

    The normal idea of a command line is that you edit the command and then "hit enter". What is what you want different than that?