178

Is there any way of clearing the command prompt screen in windows using keyboard shortcuts?

Ishan
  • 3,432
  • 10
    If keyboard shortcuts are a must for some reason you can always cook up an AutoHotkey script that sends cls<Enter> to the open command prompt window. – Karan Apr 20 '13 at 13:03
  • Simple use powerhsell. Type posershell in windows command prompt and then use (Ctrl + L) Keyboard shortcut key. After this your black cmd screen will got clear. If you don't want to be on powershell then simply type exit to switch back to windows cmd prompt mode. – Manish Jain Dec 26 '23 at 10:58

3 Answers3

218

NO, But you can use CLS command to clear the whole screen, Esc (Escape) key will clear the input line. In addition, pressing Ctrl + C will move the cursor to a new blank line.

TFM
  • 4,263
mehdi
  • 2,289
  • 4
    in powershell you can use also clear – binary_runner Dec 09 '14 at 12:23
  • 1
    I think I understand why people like to alias clear in linux to cls for the consistency between systems! – Roy Ling Nov 04 '15 at 05:40
  • Typing 'cls' + Enter (Return) is 4 keystrokes. That's pretty close to the 2 or probably 3 you'd need for a keyboard shortcut. – Dvaeer Apr 29 '21 at 10:05
  • @Dvaeer with a keyboard shortcut I could e.g. clear the terminal without removing the command I was typing - please don't assume there's only the one use case you can come up with – mccc Oct 12 '22 at 08:17
32

If you really really want to do that with a keyboard shortcut (myself included) you might turn to using autohotkey and write a little script like this:

; -------------------------------------------------------------------------
; Cntr-L should clear screen
; -------------------------------------------------------------------------
#IfWinActive ahk_class ConsoleWindowClass
^L::
Send cls{Enter}
return

#IfWinActive

what the script does ...

  • first look if one is within console application
  • if CTRL+L is pressed
  • write cls to the console and then hit ENTER
3

So long i also research but found best way to achieve this by defining Doskey Macro

i defined macro like this

doskey 1=cd\ $T cls

this will do two things by simple writing 1 and hit enter

  1. Bring you on clean Command route
  2. Clear entire screen

Note: you can add multiple desire command under one macro by separating them with $T

RAJA
  • 29
  • Maximum answers are already given but I can give you a small hack is to just switch to powershell via windows cmd – Manish Jain Dec 26 '23 at 10:54