relaunch

abstract fun relaunch(options: RelaunchOptions = definedExternally)(source)

Relaunches the app when the current instance exits.

By default, the new instance will use the same working directory and command line arguments as the current instance. When args is specified, the args will be passed as the command line arguments instead. When execPath is specified, the execPath will be executed for the relaunch instead of the current app.

Note that this method does not quit the app when executed. You have to call app.quit or app.exit after calling app.relaunch to make the app restart.

When app.relaunch is called multiple times, multiple instances will be started after the current instance exits.

An example of restarting the current instance immediately and adding a new command line argument to the new instance: