13

When using CMD, one can press upper arrow key to retrieve old commands.

Is it possible to erase the history of these commands?
If so, how could one do so?

2
  • 2
    Alt-F7 - see this reference site. Alternatively, you can exit and start cmd again.
    – AFH
    Mar 6, 2017 at 13:04
  • @AFH You should make an answer from that comment.
    – DavidPostill
    Mar 6, 2017 at 13:16

3 Answers 3

20

There is a simple keyboard short-cut, Alt+F7.

There are very few questions on cmd that are not answered on this reference site.

Alternatively, the history is cleared every time you exit and restart cmd.

0
5

The command doskey /listsize=0 should do the trick.

1
  • 1
    Indeed it does. Interestingly, it has the additional effect of disabling history for the rest of the session (or until the list size is changed again).
    – Ben N
    Mar 10, 2017 at 20:14
0

Unlike Linux-based CLIs, In Windows all histories are cleared when you close CMD.

So, don't worry about that.

3
  • Yes I was mostly concerned about that because I remember in Linux I was able to retrieve the commands even after reboot.
    – quaeched
    Mar 6, 2017 at 18:57
  • Yeah, However or In addition, you may (again) find useful to reuse commands you have typed for next session. To be able to use them you have to install third party program called Clink. To use it just click Batch file clink.bat in program folder and to delete histories, delete file .history in folder clink_0.4.8/profile/ It is smaller program and you can just download it in ZIP because it is portable. This will be helpful also for other who find it :-))
    – WailenB
    Mar 6, 2017 at 20:30
  • 1
    First of all, welcome to Super User! We always appreciate the contributions from our community members, but can you please do us a favor? You may want to edit your answer so that it includes the suggestion related to Clink. At the moment, your initial input simply described what had already been said within the officially accepted answer. Thanks for your help.
    – Run5k
    Mar 6, 2017 at 22:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .