Launch Electron app at login


#1

Hi,

Is there a way to tell an Electron application to launch at Windows login ?
(And to set it as app settings)

Thanks !


#2

Couldn’t you just put the application in the “Startup” folder undar “All Programs”? See this.

This is more of a Windows question and less of an Atom/Electron question.


#3

Yes but I would like to find a way to set if the application must run at startup, from my application’s settings.


#4

Then have the action of checking the box create a shortcut in the startup folder.

Take a look at: this superuser question which says where the Windows “All Programs” folder is. Also take a look at this NPM package. If you can get this to work, you are golden. If not, getting this to work could be ugly…


#5

NO! PLEASE DON’T DO THIS!

As a former Windows Program Manager, seeing posts like this make me cringe. There are many apps that think they need to do this, but really they don’t. Unless you’re a service that needs to run all the time, you shouldn’t add this option. Every app or service that isn’t part of Windows loading at startup will further delay when the desktop will be “ready” for the user. This contributes a lot to the perception that Windows is slow, has bloatware/crapware, etc. If you do a clean install of Windows, boot and login is super fast. It slows down over time because there are many apps & services that want to load at login. Indulge me for a second and run msconfig from Start->Run. Look at the “Services” and “Startup” tabs to review what you’re loading. I bet it’s more than you expected. Now reflect on whether you really want to do this :confounded:

If you really feel the need to offer this capability, create/modify the appropriate registry keys during install. If you’re using an installer, you’ll be able to change regkeys pretty easily. NSIS is an open source installer platform you can use. https://github.com/szwacz/electron-boilerplate has a script that changes some regkeys that you can reference.

If you need the application to have a setting to load at startup, look using at the shell.openItem() method to run a script or copy a shortcut to the startup folder as @DepthDeluxe suggests. You won’t be able to change the registry here automatically since you’ll need to cross a security boundary (i.e. run as admin).

If you’re building this app for a business and you want all employees to get this when they log in, you should manage it all through group policy, not on install or through app settings.

Hope this helps!


#6

I actually got this working (for an internal company app I might add) by using:


#7

may auto-launch can help you


#8

The auto-launch package will do this for you on all three platforms.
https://www.npmjs.com/package/auto-launch