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.

How can I clear the current line in the command prompt? (I'm using Windows 7.)

Too often, I enter a command, execute it, get many lines of output, then wish to enter another command. But before entering the second command, I press the up arrow key to review the first command, then I find I have to hold backspace for 30-or so characters. (I can't just press down again to get an empty line. Nor can I get it by pressing up again.)

share|improve this question
    
@myrddim has it but that aside, some poor alternatives are keep tapping up until you have something short then hold backspace. another one is make the command be a bad command or filename, or rather, an "'sdfd' is not recognised as an internal or external command" so move the cursor a bit with left arrow and just tap a letter or don't and just tap a letter at the end, mess up the cmd input, then hit ENTER, get that error and the next line will be blank. –  barlop Mar 5 '12 at 18:55
    
@barlop That is indeed a poor workaround! It only takes one keystroke. If you can't use the Esc key, you could use AutoHotkey to simulate it. –  iglvzx Mar 5 '12 at 19:20

1 Answer 1

up vote 38 down vote accepted

The Escape (Esc) key will clear the input line.

In addition, pressing Ctrl+C will move the cursor to a new, blank line. This may be helpful as the input you just reviewed remains visible while you type the new command.

share|improve this answer
3  
And if you want to clear the whole screen, you can use the cls command. :) –  iglvzx Mar 5 '12 at 18:52
3  
As a side note, on UNIX it's ctrl+u. –  0sh Oct 22 '12 at 23:12
1  
Which would be relevant if the question wasn't specifically targeted at the Windows 7 command prompt. :-) Also, I believe this is shell specific, as I am reasonably certain some shells have the same behavior as Windows when pressing Ctrl+C. –  Myrddin Emrys Oct 22 '12 at 23:19
    
and how do you remove all the text so you can't scroll up? –  FutuToad Jul 26 at 16:55
1  
@FutuToad the clear command will do what you ask. –  Myrddin Emrys Jul 28 at 3:57

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.