Reputation: 53
I'd like help in setting password in a batch file but without exposing password.
If I SET password="abc123"
, I don't want abc123 to be visible in the batch file, as other people will be running the .bat file.
Upvotes: 4
Views: 10236
Reputation: 9545
There is unfortunately no good solution to hide a password in batch
Even if you crypt
it, change it to HEX
, hide it in an Alternative Data Stream (ADS)
or whatever you want.
At a moment you have to test the value in your code with an IF
test.
At this point the password, crypted or not, will be visible or setted
in a variable that can be echoed
.
You can also compress your BAT in a self-extracting .EXE
, but this is very easy to crack, while the .BAT
file have to be decompressed before you run it (in the %temp%
folder).
So there is no way to really hide a password in a .BAT
file
Upvotes: 3
Reputation: 18827
You can try this method : Password hidden using ADS
Upvotes: 1