Remove command from auto-completion / history

Posted on

QUESTION :

In windows command prompt, say we are running a command (batch file)

runtest

but we typo as

runtet

Then when we press F8 next time at ‘run’,it will still pop with ‘runtet’.

Is there any way to remove this incorrect command from auto completion list without restarting the cmd prompt? Or a better way to achieve this?

Without restarting because, there are other commands which are relevant for auto completion and also the environment (though it can be set by batch file).

ANSWER :

Certainly is.

Try pressing up-arrow rather than F8 to return to previous lines. You can then use left/right-arrow to position the cursor. By default, any characters you type will be inserted at the cursor (you can change this); pressing INSert toggles between insert and overtype mode.

I’ll let you guess what Del Home and down-arrow do…

Pressing enter will execute the reformed line and replace the history-list pointer to the last command entered (ie. the reformed line)

Just press F8 multiple times till you reach the correct command, or press F7 to select the command easily.

You can completely clear command history using Alt+F7, but cannot selectively delete a single command.

Leave a Reply

Your email address will not be published.