I have a batch file that installs a Windows service. The service needs to run under a specific user account. Does anybody know how to set the user account through the batch file instead of using the Windows "Services" GUI?
Windows – Set user account for a Windows service
servicewindows
Best Answer
To change an existing service, use the
sc config
command. To change the "foo" service to use the "DOMAIN\User" credential with the password "password", execute:Be sure to put spaces between the equals signs and the arguments.
If you're using
sc create
to create the service just add theobj=
andpassword=
arguments and you're done.