I am writing a command line code to perform some operations which require a password from the user.I am reading the password from cmd using set/p "pass=>" . But while using this the password being typed is displayed. I do not want it to be displayed on the cmd window. what modification should i make?
Asked
Active
Viewed 1,609 times
0
-
Can you edit to add details about what (if anything) you do want displayed? – APH May 16 '15 at 06:09
-
2check this : http://stackoverflow.com/a/24396149/388389 – npocmaka May 16 '15 at 06:15
-
Am using this for locking the folder in windows using cmd. For which I found the code in Google. But the password entered in that is displayed as it is.I want nothing to be displayed when I type the password. – Akhil Mohan May 16 '15 at 11:22
-
If npocmaka's password masking suggestion is not going to work for you, then you could forego storing the password in a variable and instead have the script relaunch itself using `runas`. That would prompt for a password and remain silent during user entry, if I recall correctly. And maybe under the `runas` context, additional authentication won't be needed. – rojo May 16 '15 at 16:04
-
Shameless self-plug: 5 years ago, I've written [a tiny C# Console application that lets you read-in text input from the user in a batch file without echoing it back to the console](http://blog.magerquark.de/scriptpw-dll-on-windows-2008-and-windows-7-scriptpw-password/). Maybe you could use this application in your batch file, too. – Uwe Keim May 16 '15 at 19:42
1 Answers
0
I think CMD does not work in this way. i am guessing you have some sort of a if statement on the inside that will start to run the rest of the program if your input is right. batch files is just a way to get your daily operations faster :)
cls
after "password" typed will prevent people from seeing the password after it was entered.
or maybe this post can help you: Can I mask an input text in a bat file

Community
- 1
- 1

elektronet
- 108
- 13