How to change the "Start in" path in a shortcut for an application created by Electron Builder?


I build my application (nsis) in Windows with this instruction:

electron-builder --win --x64

For convenience I also use asar: false

The "Start in" folder by default is this one:


But I need this other one:


I only see these options related to the shortcuts:

  • createDesktopShortcut = true Boolean | “always” – Whether to create desktop shortcut. Set to always if to recreate also on reinstall (even if removed by user).

  • createStartMenuShortcut = true Boolean – Whether to create start menu shortcut.

  • menuCategory = false Boolean | String – Whether to create submenu for start menu shortcut and program files directory. If true, company name will be used. Or string value.

  • shortcutName String – The name that will be used for all shortcuts. Defaults to the application name.

I can workaround this by using process.chdir()

const is_dev = require('electron-is-dev');
if (!is_dev) {

But, is there a cleaner way to change the path "Start in" folder in electron-builder?


NSIS uses $OutDir (usually the same as $InstDir) as the start-in directory when it creates shortcuts. Not sure if you can change this variable before the shortcuts are created in electron-builder but it should not be your first priority to change it.

Applications should not depend on the working directory when they are started, required resources should be loaded relative to the .exe and/or relative to special folders (%appdata% and %localappdata% etc.). When users manually create shortcuts or starts your application from the command-line/open with/drag&drop/whatever the working directory can be any directory and you should accept this and fix the application instead of relying on a fragile shortcut property.

Answered By – Anders

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published