Closed andre-gois closed 8 years ago
Same here, not sure how to do that.
Create:
$ Update.exe --createShortcut MyApp.exe
Remove:
$ Update.exe --removeShortcut MyApp.exe
You can see how Atom does it in CoffeeScript
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.
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)
@paulcbetts got it :) thank you very much!
thanks @lockys
@lockys can you show me an example to change shortcut name?
@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
Please, ask on SO or in slack if you still have this problem.
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!