diff --git a/docs/api/app.md b/docs/api/app.md index 2a137c2983..d465922ce8 100755 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -1302,23 +1302,24 @@ Returns `Object`: Set the app's login item settings. To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows], -you'll want to set the launch path to Update.exe, and pass arguments that specify your -application name. For example: +you'll want to set the launch path to your executable's name but a directory up, which is +a stub application automatically generated by Squirrel which will automatically launch the +latest version. ``` js const { app } = require('electron') const path = require('node:path') const appFolder = path.dirname(process.execPath) -const updateExe = path.resolve(appFolder, '..', 'Update.exe') -const exeName = path.basename(process.execPath) +const ourExeName = path.basename(process.execPath) +const stubLauncher = path.resolve(appFolder, '..', ourExeName) app.setLoginItemSettings({ openAtLogin: true, - path: updateExe, + path: stubLauncher, args: [ - '--processStart', `"${exeName}"`, - '--process-start-args', '"--hidden"' + // You might want to pass a parameter here indicating that this + // app was launched via login, but you don't have to ] }) ```