Teamwork / node-auto-launch

Launch applications or executables at login (Mac, Windows, and Linux)
MIT License
946 stars 113 forks source link

Windows cannot auto launch after application's install path changed. #100

Closed lanistor closed 6 months ago

lanistor commented 5 years ago

I use electron, at first, i use node x64 to build our app, and it installed in default directory c:/program file in all uses' system, and it can auto launch. However, when i change node to x32, it installed in default directory c:/program file(x86), and it cannot auto launch anymore, even i use disable() then enable.

Oxalin commented 11 months ago

It is not a bug. The app is registered with a given path when being registered. If this path is changed, Windows, or any other OS, will not be able to find the app where it was registered.

What you would have to do is to support this at the app level if you intend to change from one to the other.

Or am I missing something?

Oxalin commented 11 months ago

Oh, I think I see what you mean. The registry key should be recreated when disabling and re-enabling auto-launch.

Could you have a look where the registry key is written (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run) and look at the entries? When enabling, an entry should be added; when disabling, the entry should be removed. Since it's the same app, the previous key should be deleted when disabling and recreated with the new path when re-enabling (if the appName is the same, which is used as the description of the entry).

Oxalin commented 6 months ago

I'll close this issue. Please, reopen it if you can reproduce it or add more info.