Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I m looking for a way to map CNTRL+p and CNTRL+n in command prompt to previous and next command in history. I m aware of F3 and up/down key but I m habituated to CNTRL+p/n on linux.

share|improve this question

migrated from stackoverflow.com May 29 '12 at 10:10

This question came from our site for professional and enthusiast programmers.

1  
CMD also supports arrow keys (/) to navigate the command history. Pretty addictive hotkeys they are. –  Andriy M May 29 '12 at 7:19
    
yeah I know about that , but its faster with cntrl+p/n as they are almost below the finger. Going and pressing those arrow keys is pain . –  Vihaan Verma May 29 '12 at 7:33

1 Answer 1

up vote 1 down vote accepted

You can translate Ctrl-P, Ctrl-N to Up and Down keys with AutoHotKey.

^P::
    send {Up}
    return

^N::
    send {Down}
    return

You can limit the translation to happen only in Cmd.exe window:

^P::
    IfWinActive, Your-command-window-title...
    {
        send {Up}
    } else {
        send ^P
    }
    return

^N::
    (similar to above)

Well, I'm in Linux box, so I don't know the exact window title of cmd.exe, check it yourself.. Hope it works!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.