Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Can't create Desktop and Start Menu Icon #87

Closed
andre-gois opened this issue Dec 3, 2015 · 9 comments
Closed

Can't create Desktop and Start Menu Icon #87

andre-gois opened this issue Dec 3, 2015 · 9 comments

Comments

@andre-gois
Copy link

Can someone point in the right direction?

I've built the installer and I'm able to run the app, I just can't figure out how to create the shortcuts.
It seems the code will go in the squirrelCommand switch in my main .js file, can anyone show me an example?

Thanks!

@enicolasgomez
Copy link

Same here, not sure how to do that.

@kevinmartin
Copy link

Create:
$ Update.exe --createShortcut MyApp.exe

Remove:
$ Update.exe --removeShortcut MyApp.exe

You can see how Atom does it in CoffeeScript

@lockys
Copy link

lockys commented Dec 23, 2015

I use below code to create shortcut. It works, but it creates the desktop shortcuts called Electron.
Does anyone know how to customized the name of the shortcut?

function exeSquirrelCommand(args, cb) {
    var updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe');
    var child = childProcess.spawn(updateDotExe, args, { detached: true });
    child.on('close', function() {
       cb();
    });
};

function install(cb) {
    var target = path.basename(process.execPath);
    exeSquirrelCommand(["--createShortcut", target], cb);
};

....

case '--squirrel-install':
  install(app.quit);

I have tried to change the target to <my-app>.exe, but it seems not a right solution.

@anaisbetts
Copy link
Contributor

The Desktop shortcut info will be based on the EXE's File Properties (i.e. right click on file => Properties), electron-packager lets you change this (or a bunch of other Electron tooling things)

@lockys
Copy link

lockys commented Dec 24, 2015

@paulcbetts got it :) thank you very much!

@shenlq
Copy link

shenlq commented Jan 6, 2016

thanks @lockys

@shenlq
Copy link

shenlq commented Jan 6, 2016

@lockys can you show me an example to change shortcut name?

@lockys
Copy link

lockys commented Jan 28, 2016

@shenlq, sorry, I missed this thread.
Maybe you have already solved this problem.
But this is the command to do it using electron-packager.
In this way, you can customize your name of shortcut on the desktop.
In your project folder:

$ electron-packager . <output-name> --platform=win32 --arch=ia32 --version=0.34.2 --overwrite --icon=Icon.ico --version-string.ProductName=<product-name>

You can change the exe's file properties using the optional parameter called --version-string.ProductName=<product-name>
More detail: https://github.com/maxogden/electron-packager#packageropts-callback

@havenchyk
Copy link
Contributor

Please, ask on SO or in slack if you still have this problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants