<p>Using <strong>sc</strong> command we can query, start , stop windows services.<br>
For ex:  </p>

<pre><code>sc query "windows service name"
</code></pre>

<p>The <strong>sc config</strong> command changes the configuration of the service, but I don't know how to use it.  </p>

<p>Could someone tell me how we can set the username and password for any windows service?</p>

This works:
```
```
sc.exe config "[servicename]" obj= "[.\username]" password= "[password]"
```
```
Where each of the [bracketed] items are replaced with the true arguments. (Keep the quotes, but don't keep the brackets.)
Just keep in mind that:
The spacing in the above example matters.
```
obj= "foo"
```
is correct;
```
obj="foo"
```
is not.
'.' is an alias to the local machine, you can specify a domain there (or your local computer name) if you wish.
Passwords aren't validated until the service is started
Quote your parameters, as above.  You can sometimes get by without quotes, but good luck.