cmd – Run a batch as an administrator


I need to create a batch to restart a service, it must include the administrator credentials, something like this:

net stop miservicio [user][password]
net start miservicio [user][password]
set /p DUMMY = Presione enter para finalizar...

I have tried various ways and have not gotten a result to help me.

In advance, thanks community and greetings.


When executing the batch, do it as follows, that is, at the end of your code add the following:

runas /user:Administrator archivo.batch

I hope it helps you.

Scroll to Top