Windows Command Prompt (cmd.exe) lets us quickly open applications, execute tasks, troubleshoot some Windows issues, etc. by typing command lines. After working with the command prompt for a while in a single session, the command prompt window can become cluttered, so it is important to know how to clear the screen.
In this article, we will learn quick ways to Clear Command Prompt in Windows
Clear Command Prompt with CLS Command
This method is the most genuine and easiest method to clear the Command prompt you just need to type "cls" on the command prompt and your screen will be clear. Please follow the steps below:
Open the Windows Search Bar, type Command Prompt, and click on Open
Enter multiple standard commands into the blank cmd screen.
Next type CLS and press Enter button. This will clear all the previously entered commands from the CMD screen in Windows.
Keyboard Shortcut to Clear Command Prompt Screen
There are no keyboard shortcuts to clear the screen in command Prompt, but you cal press ESC to clear the input line and Cntrl + C to move the cursor to the new blank line.
But If you really want to clear CMD with a keyboard shortcut then you have to use the AutoHotkey and write the following script that sends cls<Enter> to the open command prompt window.
; -------------------------------------------------------------------------
; Keyboard Shortcut Cntr + L should clear CMD screen
; -------------------------------------------------------------------------
#IfWinActive ahk_class ConsoleWindowClass
^L::
Send cls{Enter}
return
#IfWinActive
Working of Script
- First, the script will check if one is within a console application
- And if CTRL+L is pressed
- Write cls to the console and then hit ENTER
How to View CMD Commands History?
Open the command prompt and type doskey /history command line, and hit Enter. This will display all the commands you previously entered in the same sequence.
Alternatively, you can also press Press F7 to see all previously entered commands.
How to Save Command Prompt History?
Sometimes you may need to save your history of command you typed in a Command Prompt window for the future. For this just need to type command doskey /history > filename.txt and press Enter.
For example:
doskey /history > D:pythoncommands.txt
Next, you can save the Commands history in a TXT, HTML, CSV, RTF file.
Alternatively, you can also run the doskey /history command, and then copy & paste command history to another application and save it.
Conclusion
There is one method to clear the command prompt screen in Windows and i.e. run cls command, but if you are bounded to use keyword shortcut to clear the cmd screen then you have to write a custom script using AutoHotKey as explained above in the article.
Hope this article be helpful for you.
-
MiniTool
-
MiniTool News Center
- [SOLVED] How to Clear Command Prompt Screen Windows 10
By Alisa | Follow |
Last Updated December 29, 2022
This post provides quick ways to clear Command Prompt (cmd.exe) screen in Windows 10. For troubleshooting Windows problems, MiniTool software also provides some free tools like free data recovery software, hard drive partition manager, PC backup software, etc.
Windows Command Prompt (cmd.exe) lets us quickly open applications, execute tasks, troubleshoot some Windows issues, etc. by typing command lines. After you type many command lines and finish the tasks, or type wrong command lines, how to clear Windows Command Prompt screen in Windows 10?
Check the easy ways below for how to clear CMD screen in Windows 10.
Clear Command Prompt Screen with CLS Command
After you open Command Prompt in Windows 10, and enter multiple command lines in the screen, you can type cls command line in Command Prompt window, and hit Enter button. This will clear the CMD screen in Windows 10. All typed previous commands in Command Prompt window will be cleared.
Close Command Prompt and Open It Again to Clear Screen
You can also close Command Prompt window and open again, it will also clear the Command Prompt screen in Windows 10.
Clear Command Prompt Screen with Keyboard Shortcut?
If the Command Prompt window is cluttered and you want to clear the screen, you may wonder if there is a keyboard shortcut to easily clear it. Some online posts suggest using Alt + F7 keyboard shortcut to clear the command history. But I tried this way, it doesn’t work.
How to View Command Prompt Command History
After you type a series of command lines in Command Prompt window, you can type doskey /history command line, and hit Enter. This command will display all the commands you typed in the same sequence as you entered.
To view all command lines you entered in Command Prompt window after you access CMD, you can also press F7 key. This will pop up a window with a list of all previous typed command lines. You can use the Up and Down arrow key to select any command line in the list and press Enter to locate it.
How to Save Command Prompt History
You can enter this command line doskey /HISTORY > filename.txt to save the commands history to a TXT, HTML, CSV, RTF file. You can enter a file name and a file extension. The file will be saved to the location where you execute this command.
What You Can Do with Command Prompt
You can use Windows Command Prompt to do many things. Below we introduces three common usages of Command Prompt. Press Windows + R, type cmd, and hit Enter to open Command Prompt.
Organize Your Hard Drive Partitions
You can run Windows Diskpart utility in Command Prompt to manage computer hard drive partitions.
You can type diskpart in Command Prompt window to open Windows Diskpart tool. Below is how to partition external hard drive with Diskpart.
- list disk
- select disk * (select the external hard disk)
- create partition primary size=* (specify a partition size in MB)
- assign letter=* (set a drive letter for the new partition)
- format fs=ntfs quick
- exit
Check and Repair Disk Errors
You can also type chkdsk *: /f /r command in Command Prompt, and hit Enter to use Windows CHKDSK to check and repair hard disk errors. Replace “*” with the target partition drive letter.
Detect and Repair Corrupt System Files
If your computer has problems, you can use Windows SFC tool to check and repair corrupted system files. You can type sfc /scannow command in Command Prompt, and hit Enter to use SFC tool to find and repair corrupted/missing system files.
Verdict
In conclusion, the easiest way to clear Command Prompt screen is to use CLS command or restart Command Prompt application.
About The Author
Position: Columnist
Alisa is a professional English editor with 4-year experience. She loves writing and focuses on sharing detailed solutions and thoughts for computer problems, data recovery & backup, digital gadgets, tech news, etc. Through her articles, users can always easily get related problems solved and find what they want. In spare time, she likes basketball, badminton, tennis, cycling, running, and singing. She is very funny and energetic in life, and always brings friends lots of laughs.
Содержание
- Способ 1: Очистка текущей строки
- Способ 2: Скрытие всех записей
- Способ 3: Пользовательский файл запуска
- Вопросы и ответы
Способ 1: Очистка текущей строки
Избавиться от введенного ранее текста в «Командной строке» Windows 10 можно с помощью всего одной кнопки на клавиатуре – «ESC». После нажатия клавиши все символы без исключения будут удалены по аналогии с многократным нажатием клавиши «Backspace».
Основной альтернативой кнопке «ESC» в Windows 10 выступает сочетание клавиш «CTRL+C», которое присутствует в большинстве операционных систем с консолью. В этом случае все символы со строки будут моментально удалены, произведен автоматический переход на новую строку и остановлены любые ранее запущенные команды.
Клавишу «Backspace» можно также использовать для частичной, но более быстрой очистки консоли в сочетании с другими кнопками. Так, например, комбинация «CTRL+Backspace» позволяет удалять идущие друг за другом символы без пробелов, включая цифры и любые другие знаки.
Способ 2: Скрытие всех записей
Единственный доступный в настоящее время способ очистки всех записей в рамках рабочего окна «Командной строки» Windows 10 заключается в использовании указанной ниже команды. В этом случае после введения символов, регистр которых не играет никакой роли, и последующего нажатия «ENTER», все данные на экране будут удалены и сброшены до одной единственной стартовой строки.
cls
Помимо данной команды, как нетрудно догадаться, всегда можно вручную закрыть консоль с помощью крестика в углу экрана или комбинации клавиш «ALT+F4», что приведет к автоматической очистке. Однако здесь важно учитывать, что выполняемые команды, как правило, не останавливаются до завершения или нажатия «CTRL+C».
Способ 3: Пользовательский файл запуска
Хоть это не особо критично на первый взгляд, вполне можно начать работу с изначально полностью чистой консолью без дополнительных данных о версии системы и разработчике. Для этого откройте стандартный «Блокнот» или любой другой текстовый редактор и одной строкой укажите следующее содержимое.
cmd /k cls
Данный документ необходимо сохранить в любом удобном месте с расширением «.bat» и в будущем использовать в качестве ярлыка запуска «Командной строки». Только в таком случае она будет открываться с одной единственной строкой, будь то «С:Windowssystem32» или пользовательское расположение, что вполне можно контролировать через дополнительные команды в файле.
Еще статьи по данной теме:
Помогла ли Вам статья?
Download PC Repair Tool to quickly find & fix Windows errors automatically
If you have been wondering about how to clear the CMD screen in Windows 11/10, this post is going to help you. The Command Prompt, aka CMD, is a command-line interpreter on your Windows PCs, the official name, however, is Windows Command Processor. You need to use a special syntax to put in your commands here. You simply need to put the commands as a line of text and hit Enter, and then your system executes it. CMD is basically used to perform administrative activities and run troubleshoots for the bugs and issues on your PC.
The CMD window sometimes gets very cluttered and in that case, well, you can always close and reopen a new window, there is a simple way to clear the entire CMD screen with just a simple command and start afresh. Let’s see how.
To clear the CMD screen on your Windows 11/10 PC, you just a simple command – Type, CLS
and hit Enter.
Your cluttered CMD screen will be clear in a jiffy and you can start afresh.
If in any case, you cannot type the command CLS, which may happen if your C, L, or S keys are not working on your keyboard, you can use the virtual keyboard to put in the command.
If in the worst case, if that too is not working, you have to close and reopen the CMD window. You can close it simply by clicking on the X button in the top right corner.
If your mouse or cursor is not working and you can’t click on the X button, type Exit
and hit Enter.
This command will close the CMD screen and then you can reopen it and start afresh.
Clear text from CMD Screen
If you don’t want to clear the entire screen and just remove some text or a particular line from the CMD screen, there are different commands for that.
To clear a single line from your CMD screen
Press the Escape key on your keyboard and you can clear the last line or command you have typed on CMD. But if you are looking for a key or command to clear the line before the prompt, there is no command for that.
Delete one character from the command in CMD
If you want to delete just a single character from the command you have typed, you can use the Backspace key on your keyboard.
Delete one word in CMD
Use Ctrl+Backspace to delete one word from the command
Stop the command you are running in CMD
Use Ctrl+C to terminate the current command line or end any process running.
Read: How to view, save and clear Command Prompt command History
How do I close the CMD Window?
You can use the Exit command and hit Enter, use the keys Alt+F4 or you can simply click on the X button on the top right corner of the Window to close the CMD window.
How do you end a process in CMD?
Press Ctrl+C to end any running process in CMD.
Read next: Command Prompt Tips and Tricks.
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.
Clear your Command Prompt screen with three letters
What to Know
- In Command Prompt, type: cls and press Enter. Doing this clears the entire application screen.
- Close and reopen Command Prompt. Click the X on the top right of the window to close it, then reopen it as usual.
- Press the ESC key to clear the line of text and move back to the Command Prompt.
This article explains how to clear the screen in the Command Prompt application on Windows. You can use a simple command or just close and reopen Command Prompt. We also have a bonus section at the end of this how-to for clearing a line, character, or word.
Clear the Command Prompt Screen With a Command
Unlike many things on your computer, there aren’t several ways to clear the screen in Command Prompt. There is one basic command that will rid the screen of its history.
Type the following command and hit Enter:
cls
You’ll then have a nice and clean Command Prompt screen where you can start fresh.
Clear the Screen By Closing and Reopening Command Prompt
If, for some reason, you cannot issue the above command to clear the screen, just close and then open Command Prompt again.
Maybe your keyboard is on the fritz or has a broken C, L, or S key. (Hey, things happen!)
Close Command Prompt by clicking the X on the top right corner of the window. You can also right-click the icon in your Task Bar and select Close Window.
Then, reopen it as you normally would and you’re back in command.
To quickly exit and close Command Prompt at the same time, type: exit and hit Enter.
Bonus: Clear Text on the Command Prompt Screen
Maybe you don’t necessarily need to clear the entire Command Prompt screen, but just the current line or some text in it. Here are a few helpful key presses to keep in mind.
- Escape: Clear the current line of text; it removes the text and moves your cursor back to the prompt.
- Backspace: Delete one character to the left of your cursor.
- Ctrl+Backspace: Delete one word to the left of your cursor.
- Ctrl+C: Stop the line you’re typing or the command you’re running and move to a new prompt on the following line.
FAQ
-
How do I clear Command Prompt history in Windows?
Your command history clears every time you close the Command Prompt. Close the window manually or use the Alt+F4 keyboard shortcut.
-
How can I view a list of all command prompts?
Use the help command: Enter help to see a list of available commands. To get more information about a particular command, type help command name.
Thanks for letting us know!
Get the Latest Tech News Delivered Every Day
Subscribe
The command prompt is a keyboard-based feature that is integrated into the Windows OS. The software has a long list of applications, such as changing network profiles or writing batch files to alter the way other programs run. The command prompt window can get cluttered after operating with the command prompt for a while in a single session so it is important to know how to clear the screen. So, in this guide, you will learn how to clear Command Prompt screen in Windows 10 in different ways using command and keyboard shortcut keys.
Meanwhile, there are still some Windows users that do not know how to clear the command prompt screen in Windows 10. Sometimes, you enter multiple command lines for troubleshooting or any other purpose and you enter a command or command you do not intend to in a Command Prompt. That’s why you need to know how to clear the command prompt (cmd).
You Might Also Like: How to Find and Use Clipboard on Windows 10
What You Will Learn Here:
- What’s Command Prompt?
- How to Clear CMD Screen in Windows 10
- Method #1. Clear CMD Screen using Keyboard Shortcut Key (Esc)
- Method #2. Clear CMD Screen in Windows using CLS Command
- Method #3. Close and Reopen Command Prompt
- How to View Command Prompt Command History
What’s Command Prompt?
Command Prompt is an application for the parser of command lines available on most Windows operating systems. This is used to execute Commands entered. Most of those commands automate tasks through scripts and batch files, perform advanced administrative functions, and troubleshoot or solve certain types of Windows problems.
Meanwhile, Command Prompt is formally referred to as the Windows Command Processor, but it is often referred to as the command shell or prompt cmd, or sometimes its filename cmd.exe as well. To know about 10 Useful Windows Networking Commands click here.
How to Clear CMD Screen in Windows 10
So, here you will learn different ways to clear the CMD screen using a keyboard shortcut key and also using a single command line to completely clear the entire command prompt screen in Windows 10.
Method #1. Clear CMD Screen using Keyboard Shortcut Key (Esc)
If you have entered a command that you do not intend in the CMD screen. to remove the command from the command prompt screen, press the Esc key on your keyboard.
Note: Using the Esc key won’t work if you have entered multiple command lines. It will work when the command isn’t entered.
For the purpose of this guide, I entered the command “SYSTEMINFO“. To clear the entered command, I will simply press the Esc key which is located on the top left-hand corner.
As you can see in the screenshot below the command prompt screen is cleared now.
Method #2. Clear CMD Screen in Windows using CLS Command
Upon opening Command Prompt in Windows 10, and entering several command lines on the keyboard, you can type the command line CLS in the Command Prompt window, and press Enter. It will wipe out Windows 10’s CMD screen. All previous commands typed in the Command Prompt window are removed.
Clear CMD Screen in Windows using CLS Command
The CLS command clears everything from the Command Prompt screen and gives you a clean screen.
Method #3. Close and Reopen Command Prompt
You can also close the Command Prompt window and open it again, the Command Prompt screen in Windows 10 will be cleared as well. Meanwhile, simply type exit or press Alt + F4 to close the command prompt screen immediately in Windows 10 and reopen it.
Type exit or press Alt + F4 to close CMD
How to View Command Prompt Command History
To view Command Prompt history after you type a series of command lines in the Command Prompt window and simply type doskey /history command line and press enter.
This command shows all of the commands that you typed in the same sequence that you entered.
Or on the Command Prompt home screen, press the F7 key to access the menu which has all of your previously executed commands listed in chronological order.
Press the F7 key to View the CMD History
Wrapping Up
That’s it. This is how you can clear Command Prompt screen in Windows 10. You can use the methods described in this guide to clear the command prompt in Windows 10. Use the Esc key to clear a single command before entering it. While using the CLS command can clear the whole command prompt screen. At last, to view the CMD history type doskey /history and press enter, or simply press F7 while the command prompt is open.
Read More:
-
21 CMD Commands All Windows Users Should Know
ShaadLife Team
We are professional How-to content writers. As a tech enthusiast and geek, we love to write and share articles about different operating systems such as Android, Windows, macOS, iOS, and some other products like a smartwatch and smart TV.
Is there any way of clearing the command prompt screen in windows using keyboard shortcuts?
asked Apr 20, 2013 at 5:44
1
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,2632 gold badges30 silver badges37 bronze badges
answered Apr 20, 2013 at 5:52
mehdimehdi
2,1991 gold badge10 silver badges5 bronze badges
4
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
answered Aug 13, 2015 at 12:17
4
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
- Bring you on clean Command route
- Clear entire screen
Note: you can add multiple desire command under one macro by separating them with $T
answered Oct 11, 2017 at 9:15
RAJARAJA
195 bronze badges
Please can any one help me out how to clear the command prompt in windows while using mysql in command prompt
how can i clear the screen
Please can any one help me out how to clear the command prompt in windows while using mysql in command prompt
how can i clear the screen
asked Oct 16, 2014 at 15:56
2
Currently, it’s not possible to do so in Windows. It’s possible to do it in Linux (CTRL+L). You can only exit MySql, type in CLS, and re-enter MySql.
See: How to clear mysql screen console in windows?
answered Oct 16, 2014 at 16:06
You can use ‘cls’ command to clear the screen in the window CMD.
answered Apr 10, 2020 at 10:40
Pranay kumarPranay kumar
1,8774 gold badges20 silver badges43 bronze badges
Windows doesn’t provide direct commands to perform this. Linux has ctrl+l
to do the same. But in windows, you have to exit MySQL with q
or ctrl+c
and then use CLS
to clear your screen and login again to mysql.
answered Oct 16, 2014 at 16:02
vembutechvembutech
1,5941 gold badge10 silver badges15 bronze badges
I solve it like this. it will work. try it please.
write a bat file
@mysql -uroot -p123456 -D%1 -e%2
named it mysqldb.bat.
then use the bat:
mysqldb.bat dbname "select * from tablename;"
cls
answered Apr 23, 2021 at 3:08