Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling doskey /reinstall from a script

Tags:

batch-file

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.

like image 358
Dov Avatar asked Jul 15 '26 12:07

Dov


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.

like image 147
Dov Avatar answered Jul 18 '26 03:07

Dov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!