Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法开机启动 #16

Open
ClumsyLee opened this issue Oct 14, 2015 · 2 comments
Open

无法开机启动 #16

ClumsyLee opened this issue Oct 14, 2015 · 2 comments

Comments

@ClumsyLee
Copy link
Owner

目前的首要任务,不能开机启动感觉掉价不少

@ClumsyLee
Copy link
Owner Author

Windows 下

在启动目录下创建快捷方式,启动目录如下:

C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

可以用 windows-shortcuts

具体代码大概是

var ws = require('windows-shortcuts');

ws.create(path.join(
  process.env.APPDATA,
  'Microsoft/Windows/Start Menu/Programs/Startup/net.tsinghua.lnk'), process.execPath);

其中 process.execPath 是 exe 的位置

具体代码加到 main.js 的这个地方

    function install(done) {
      var target = path.basename(process.execPath);
      console.log('Creating shortcut.');
      executeSquirrelCommand(["--createShortcut", target], done);
      // 加到这里
    }

这个函数会在程序安装或更新后被调用,要在这里重新建立快捷方式

@ClumsyLee
Copy link
Owner Author

b13a48b 中实现了 Windows 下的开机启动,最后还是直接用的 Update.exe

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

No branches or pull requests

1 participant