I have a directory (which is later archived) in which a shortcut to an executable file (.exe), which itself is a few directories deeper. The first problem encountered is ".lnk" shortcuts require exact path. E.g. "D:/someFolder/parentOfShortcut/files/dir/dir/dir/software.exe commandForTheExe" and if the directory parentOfShortcut is moved to the root (for example), the shortcut will be still looking for the app in "D:/someFolder/parentOf...". I thought of using a ".bat" file, however, that's a Windows-only solution, while the app itself is compatible also with both Linux and MacOS. The second problem of the ".bat" is that users never trust that type of files so does any antivirus software.

It is a quandary that the location of parentOfShortcut can be anywhere since users download that folder (as a .zip archive) and are free to save it in any given directory on their machine.

For reference, here's the exact file structure

(unknown path)/MySoftware(.zip)
    +- Shortcut.lnk
    |- files
        |- node_modules
            |- dist
                +- theApp.exe (with command "boot.main")


The .exe can't be moved, for it depends on .dll files in the same, in the upper and in some lower-level directories.

  • How is the app itself cross-platform? Mac apps tend to be bundles with the executable at a given level, myApp.app/Contents/MacOs/myApp so should always 'know where they are'.
    – Tetsujin
    Commented Sep 5, 2018 at 7:04
  • @Tetsujin The path is not really unknown; it depends on where the user installs the archive.
    – undefined
    Commented Sep 5, 2018 at 7:10
  • apps go in /Applications usually or for single user ~/Applications. Finder will know where it is anyway. They are normally delivered as ,dmg files with a handy drag & drop to Apps, unless they need an installer & elevated permissions.
    – Tetsujin
    Commented Sep 5, 2018 at 7:13
  • @Tetsujin I am not personally a macOS user, but the application (Electron) claims to be executable and fully functioning under that platform.
    – undefined
    Commented Sep 5, 2018 at 7:15
  • You could use a ".bat" file for Windows and other scripts for Linux & Mac. But the usual solution is to have a platform-dependent installation script that will create the link.
    – harrymc
    Commented Sep 5, 2018 at 7:18

1 Answer 1


I'm not a user of Electron, but here are some some resources I collected.

For creating desktop shortcuts you would need an installation program. There are a couple of such cross-platform products that are said to be capable of this, although it's somewhat unclear how well they works on the various platforms.

Not being a user of Electron, I can't test these products, but can contribute these details.

For electron-builder, one Github post says :

Set createDesktopShortcut to always.

"nsis": {
      "createDesktopShortcut": "always"

Whether to create desktop shortcut. Set to always if to recreate also on reinstall (even if removed by user).

A StackOverflow post contains various advice, but adds this specifically for electron-forge apparently for Windows:

you may want to try a config that looks like this :

"electronPackagerConfig": {
  "icon": "Icon",
    "ProductName": "My App",
    "CompanyName": "My Company"

More info here: https://github.com/electron-userland/electron-forge/issues/89

Another answer in the same post adds this for electron-builder :

Try to use electron-builder if you get painful with Squirrel. You can use the command as below to make your installer for Windows: electron-builder path/to/your-electron-packager-output --platform=win --out=path/to/your-installer-output --config=path/to/builder.json --target=win

Sample content for builder.json:

{ "win": { "title": "My Production Name", "icon": "path/to/your-icon.ico", "version": "1.0.0", "publisher": "Your Company Name" } }

P.s: You must install NSIS and add NSIS path into PATH environment before you run the above command.

Have a look at this other StackOverflow post Creating a desktop shortcut via Squirrel events with Electron that seems worth reading, since it shows a procedure that is reported as working.

You could on the other hand refrain from using any of the electron packagers and do it yourself with a proven cross-platform installer, such as the following:

I hope that this can get you started. Don't assume that any of the electron package builders will work for all operating systems, so you might need more than one. Test everything, assume nothing, is my advice.

  • It all seems solid, alas, I am having problems with my Internet and am therefore unable to check the resources you provided. I will make sure to review that tomorrow (Friday).
    – undefined
    Commented Sep 13, 2018 at 10:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .