Skip to content

app.setLoginItemSettings works incorrectly while packaged with the environment variable --win32metadata.requested-execution-level=requireAdministrator #1366

Open
@ch1ny

Description

@ch1ny

Preflight Checklist

Issue Details

  • Electron Packager Version:
    • 15.5.1
  • Electron Version:
    • 17.1.0
  • Operating System:
    • Windows 10 (21H2)

Behavior

I'm trying to add a feature to my Electron application to make it automatically run after my computer starting up. And this is my source code:

		ipcMain.on('EXCHANGE_OPEN_AT_LOGIN', (evt, openAtLogin) => {
			if (app.isPackaged) {
				app.setLoginItemSettings({
					openAtLogin,
				});
			}
		});

If I packaged my application with command like this , my application can be successfully self-booted.

electron-packager ./build SduMeeting --platform=win32 --arch=x64 --out ./dist --asar --overwrite

However, to implement certain features, I have to package it with command like this to get administrator privileges.

electron-packager ./build SduMeeting --platform=win32 --arch=x64 --out ./dist --asar --overwrite --win32metadata.requested-execution-level=requireAdministrator

The application packaged in this way cannot be opened automatically.

Additional Information

Excuse me, I'm a college student from a university in China with poor English. I wish my poor presentation wouldn't cause troubles for you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions