How to Tell if a Diamond is Real
Q&A for How to Add a Password to a .Bat File
Coming soon
Search
-
QuestionWhat if I did not add .bat at the end of codes?SunbakedcowCommunity AnswerIt would save as a .txt file.
-
QuestionThis is a nice idea. However, nothing prevents a user from editing the file and seeing the clear text password. What can be done to prevent that?Community AnswerHide the password .bat file. Attrib it +s +h. And then call it from another, single line .bat, file. That would make it a bit more difficult to edit.
-
QuestionOF the bat file is opened by using Notepad, it will show the code right?Community AnswerYes. This method only does the real batch code if the correct password is entered. Basically, this method only password protects running the program.
-
QuestionHow do I make it secure, as I can look inside of it and find the password?ArroganceTop AnswererBatch files were never intended to be secure, and it's a fool's errand to try. The proper way to store passwords is in a hash. You then run the user's input through the same hashing tool, and if the result is the same, then you proceed. If not, you return an error. The only tool Windows has built-in (in Windows 7, 8, and 10) that can be put to this sort of use is certutil. First, put the password you want to use in a file ( echo password1234 > password.txt ). Then get the hash of the file ( certutil -hashfile password.txt > hashfile.txt ). When the user attempts to enter a password, you do the same thing, redirect their password to a file, get the hash and store it. Then compare the files.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit