Skip to content

If i append args to autostart.opts.appPath the finally generate command is incorrect #116

Closed

Description

var appAutoLaunch = new AutoLaunch({ name: 'App',isHidden:true });
appAutoLaunch.isEnabled().then(function (isEnabled){
    if(!isEnabled){
        appAutoLaunch.opts.appPath += ` "${__filename}" "--autostart" `;
        appAutoLaunch.enable();
    }
    console.log(arguments,appAutoLaunch.opts,__filename);
});

In windows register table added command is "D:\project\vue2\node_modules\electron\dist\electron.exe "D:\project\vue2\desktop.js" "--autostart""
System will treat command arguments as part of executable file path

Activity

  1. ghost changed the title [-]I if append args to autostart.opts.appPath the finally generate command is incorrect[/-] [+]If i append args to autostart.opts.appPath the finally generate command is incorrect[/+] on Sep 13, 2023
  2. Oxalin commented on Dec 3, 2023

    @Oxalin
    Contributor

    Args are not supported in that way. Electron apps use "--process-start-args" before the args that need to be forwarded to the process to be run.

    Is your problem specific to the "autostart" in your example or do you want to use other arguments? Because "--autostart" to be the same as the purpose of auto-launch (to add an entry for launch at startup).

    Other arguments should be read at process launch from a config/preference file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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