Gehtnet
Gehtnet

Reputation: 447

Start electron app with admin privileges as default

I created an electron app which can only be started as admin, because it needs it for various command executions. Now it prompts that it must be started as admin. This question was very helpful.

Now I want to start it with admin privileges right away so windows asks for the acception. It shouldn't be able to start the app without admin privileges.

I tried adding --win32metadata.requested-execution-level=requireAdministrator, but then it writes an error on startup (always):

The application has failed to start because the side by side configuration is incorrect.

How can I achive this with the electron packager?

Upvotes: 3

Views: 3814

Answers (2)

Best choice for build an electron app is electron-builder

Upvotes: 0

pushkin
pushkin

Reputation: 10219

Your electron-packager code looks fine, and the switch works for me.

This can happen if you are missing Visual C++ Runtimes, or if they're corrupted. Try installing them from here and try again.

If that doesn't help, then you should dig into the Event Viewer, which should come installed on your machine, and see what the specific error is. This page has some additional tips on troubleshooting this issue.

Upvotes: 3

Related Questions