Ctrl-End it All

Ctrl-End it All

  • Comments 9

Here's a great hint from one of our Windows PowerShell PMs. We all know that you can interrupt a command by typing Ctrl+C, but did you know that you can erase the end of a typed command line by pressing Ctrl+End, just like in Cmd.exe?


The Ctrl+End sequence erases all characters at or after the cursor point on the command line.


Try it. 


  1. Type a command, like:

                        get-itemproperty HKLM:\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
            (Be sure to use tab-completion to save strokes!)

  1. Use the back arrow key  (ß) to place the cursor under the "S" in "ShellIds."

  2. Press Ctrl+End.

    Now you have:

                         get-itemproperty HKLM:\Software\Microsoft\PowerShell\1\


            so you can type another useful command, like:


                        get-itemproperty HKLM:\Software\Microsoft\PowerShell\1\PowerShellEngine


Very handy. And you get it free with Windows PowerShell.


June Blender [MSFT]

Senior Programming Writer

Windows PowerShell

Leave a Comment
  • Please add 8 and 2 and type the answer here:
  • Post
  • I am sorry but "get it free with Windows PowerShell", I am a long time windows user and this is an old feature of cmd.exe which is the psh running on, the thin is that the command console is not "user friendly" at all!!!

    did you see the console2 project in sourceforge?

    I don't get it really the power shell is VERY GREAT, but the console is... well you know how the console is, but to go and say "look you can Ctrl+End and it will erase till the end and brag about that???

    by the way I am using AutoHotKey to automate a lot of things that the cmd/powershell are not doing like:

    #IfWinActive, ahk_class ConsoleWindowClass


    SendInput ! c



    SendInput ! p

    Sleep, 100

    ;WinGetActiveTitle, ttl

    ;WinMove, , ttl 0, 0

    MouseClick, left,  129,  36

    Send, {TAB}85{TAB}{TAB}85{TAB}33{ENTER}{ENTER}

    DllCall("SetCursorPos", int, 1300, int, -100)



    SendInput ! p

    Sleep, 100

    ;WinGetActiveTitle, ttl

    ;WinMove, , ttl 0, 0

    MouseClick, left,  129,  36

    Send, {TAB}135{TAB}{TAB}135{TAB}50{ENTER}{ENTER}

    DllCall("SetCursorPos", int, 1300, int, -100)



    SendInput {Home}



    SendInput {End}



    send, ^{End}

    send, ^{Home}


    ; Paste (Ctrl+V)


    SendInput ! ep


    ; Find dialog (Ctrl+Shift+F)


    SendInput ! ef


    ; Clear screen (Ctrl+Shift+X)


    SendInput {Esc}

    SendInput cls {ENTER}


    ; Set Scroll



    SendInput ! el


    ; Shift+Page up


    SendInput ! el

    SendInput {PgUp}

    SendInput {Esc}


    ; Shift+Page down


    SendInput ! el

    SendInput {PgDn}

    SendInput {Esc}



    oh, and yes Ctrl+home work as well :)

  • We hear you loud and clear on the CONSOLE issue.

    Jeffrey Snover [MSFT]

    Windows Management Partner Architect

    Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell

    Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

  • My opinion is quite different from anybody. I think that difficult keystrokes is hard to learn, but once learnt, you can't live without. Complex keystrokes is a "good" feature that exists in common *nix shells, like Bash. You can find a lot of examples here:


    I'm not sure but I think I'd already talked with Jeffrey and he explained why this is impossible to do in Powershell (because of cooked-mode and other things). But I still guess is a good thing to change in a future release.



    Vinicius Canto <scripterbr_at_gmail_dot_com>

    MVP Visual Developer - Scripting

    MCP Windows 2000 Server, Windows XP e SQL Server 2000

    Blog sobre Scripting: http://viniciuscanto.blogspot.com

  • And you can use ctrl+home to delete to the start of the line. Another very good key is F4 that deletes up to the next character you type. I often use it go get rid of the first word in a line I recall - home+f4+space.

    You should also try f7 and f8. f7 lists you old commands and f8 search command history starting with what you have written so far.

  • /\/\o\/\/,'s wondering

    I'm I the only one that really LOVES the console like it is ?

    Greeings /\/\o\/\/

  • "We all know that you can interrupt a command by typing Ctrl+C"

    Uhm... Am I the only one who, when using "Run As" to get PowerShell to run as an admin, experiences the CTRL+C shortcut NOT working? As in, it won't stop any commands at all?  Only when "running as."  I figured it was a Console bug, but maybe it's a PowerShell bug?  Or maybe my computer is foobared?  heheh.  Can anybody replicate this?  Easy test is Ping -t, since it never ends.

  • Yes, I have same issue as Timothy.

  • I also find the ctrl+c annoying.  Of course I'm using runas.  As a sys admin, it's best practice.  Please fix!

  • I have the same problem as Timothy, Jeff and Bill with ctrl+c. Additionally the command buffer doesn't work when using run-as.  Re-typing commands that should be accessable in the buffer is not my idea of a good time! What gives?

Page 1 of 1 (9 items)