0

I want to start an exe-file as admin with node. Tried something like this, but this dont want to work:

exec('runas /user:Administrator "app.exe"', function(err, data) {  
                        console.log(err)                       
});

Im always getting this error: Error: Command failed: runas /user:Administrator "app.exe"

Any Ideas?

1 Answers1

0

According to the documentation of runas you should include the ComputerName like this:

If you want to use the Administrator account on your computer, for the /user: parameter, type one of the following:

**/user:<**AdministratorAccountName>@<ComputerName>

**/user:<ComputerName>\<**AdministratorAccountName>    <----- here
Always Learning
  • 5,510
  • 2
  • 17
  • 34