Search code examples
batch-filehideuser-input

Hide Input in Batch File


I was wondering how I would go about Hiding the input from a 'set /p' command in a batch file.

set /p Password=What is your password?

We all know that inputting your password, you would be able to see it. How would I go 'bout hiding it ?

I tried conset.exe from here. And used:

conset /PH Password=What is your password?

And i get "Conset: Error setting variable" :(

Another idea I had, was to change the colour of the console window. But how could I change the colour on the same line? So that you could see the question, but not see the answer?

Any ideas from the pros?


Solution

  • You can probably look at the answers here: Can I mask an input text in a bat file

    I think EditV32.exe and EditV64.exe are the best options you have (and since you were OK to use conset, which as far as I know does not come with Windows, I don't think you would oppose to using editv?)

    http://www.westmesatech.com/editv.html

    Also: http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/7d2d92a5-5d59-4954-bf3e-22eeb5cf0ee6/