Calling doskey /reinstall from a script

Viewed 230

I'm working on a BAT script that takes a password as an argument. I'd like to remove all mentions of the password from the command history and the output window. I added this to the end of my script:

cls
doskey /reinstall

The first time I ran my script, it worked exactly as intended. When I ran it a second time, though, it looks like doskey didn't do anything. I press the key and still get the command coming up.

Why does this only work once? How can I get this to work for multiple runs of the script? When it's being used for real, I expect it to be run back to back.

1 Answers

Do the following instead:

cls
doskey /listsize=0
doskey /listsize=200

This works across multiple calls, and doesn't interfere with the history after the script is called.

Related