I'm trying to set the admin password through a .bat file using the command
net user Administrator my_password
if I'm writing that exact line in a command prompt everything works fine, I can login again after I have logged out or restarted. When I run the .bat file I'm unable to login after I've logged out or restart. What is the difference and how can I make it work from a .bat file or other script?
EDIT: I'm running the .bat file simply by clicking on it, I am logged in as administrator. The command does give a success message and it obviously changes the password since I can't use the old password afterwards.
I suppose your password contains a percent sign.
The difference is that percent signs at the cmd prompt are preserved.
But in a batch file the parser tries to expand a variable with percent sign, but when the percent expression isn't valid it will be removed.
If you want to use the password in a batch file you only have to double the percents.
More infos about variable expansion at How does CMD.EXE parse scripts?