I wanted to clear the history of typed command lines,

So I called DOSKEY /REINSTALL as explicitly told in the help, but then, my command prompt closed !

Isn't this the right way to clear the history of typed command lines ?

  • It may have closed like that because it needed to run as administrator (and so did not run). Open cmd.exe with Run as Administrator and see how it runs this way. See the answer in this thread on clearing the history (look down to the second answer) superuser.com/questions/1185761/…
    – John
    Feb 14, 2020 at 20:01
  • Alright, thank you.
    – aybe
    Feb 15, 2020 at 22:27
  • Was my comment an answer for you?
    – John
    Feb 15, 2020 at 22:39
  • Yes, it helped me out, thank you.
    – aybe
    Feb 16, 2020 at 10:12

1 Answer 1


I suggest visiting this post .: Multi-line menu with options selection via DOSKEY

...doskey handle two buffers, the buffer of the doskey macros, and the buffer of the commands history. Apparently doskey /reinstall not works, it reset any buffer. Also /history show anything even when you see commands with F7...

Just try using:

%__APPDIR__%doskey.exe /listsize=0 && %__APPDIR__%doskey.exe /listsize=50 

This will reset your doskey history

%__APPDIR__%doskey.exe /listsize=0
%__APPDIR__%doskey.exe /listsize=50

rem ::  or...
%__APPDIR__%doskey.exe /listsize=0 && %__APPDIR__%doskey.exe /listsize=50

For additional, about your prompt closed !...

Verify if there is some bat/cmd with same name: DOSKEY.cmd DOSKEY.bat

%__APPDIR__%where.exe /r \ doskey.*
  • Use the full path/name to %__APPDIR__%DOSKEY.exe instead only DOSKEY /REINSTALL
doskey.exe /reinstall
%__APPDIR__%doskey.exe /listsize=0 && %__APPDIR__%doskey.exe /listsize=50

Obs.: Try running doskey.exe (with the full path), from one of the command line outputs below, it may be the doskey.exe file in c:\windows\system32 maybe corrupted...

%__APPDIR__%where.exe /r \ doskey.*

You must log in to answer this question.

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