r/learnprogramming • u/Rolloveralready • 17h ago
Encrypt password in bat
I have a bat file which sets a username and password for a service.
sc.exe config "myService" obj= "MYDOMAIN\myuser" password= "redacted"
Is it possible to encrypt the password?
1
Upvotes
2
u/bravopapa99 17h ago
Maybe use something like Hashicorp Vault, or similar.
https://www.hashicorp.com/products/vault
I have used this years back, open source solutions may well exist.
1
u/Environmental_Mix856 15h ago
Does it have to be a bat file? Powershell can at least encrypt into a secondary file. Or use a vault like people are suggesting, azure key vault, google secret manager.
4
u/doctorfluffy 17h ago
You can hash it and save the hash I guess.