安装后将电子应用程序路径添加到用户环境变量 [英] Adding electron application path to user environment variables after install

查看:155
本文介绍了安装后将电子应用程序路径添加到用户环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题描述:

我有电子应用,需要添加用户安装我的应用程序后将应用程序添加到用户环境变量,以便他们可以运行诸如 my-electron-app< command>之类的命令。 [< args>] 在终端中开始我的电子应用。

I have an electron application and I need to add the application to user environment variables after users install my application, so that they can run commands like this my-electron-app <command> [<args>] in the terminal to start my electron application.

我找不到解决办法以编程方式使用nodejs。 VSCode,hyper和atom是三个电子应用程序(我知道的 ),它们在用户安装应用程序后将应用程序路径添加到用户环境变量中。

I could not find a way to do this programmatically using nodejs. VSCode, hyper and atom are the three electron apps ( that I know of ) who add the application path to user environment variables after users install the application.

我正在使用电子生成器来构建NSIS安装程序。我在那里也找不到能达到目的的选项。

I'm using electron builder to build an NSIS installer. I couldn't find any options there either that serve the purpose.

问题:

用户在系统上安装我的电子应用程序后,如何将我的电子应用程序添加到用户环境变量中通过运行诸如 my-electron-app start 这样的命令来终止终端?

How can I add my electron application to user environment variables after users install my application on their system, so that they can launch my electron app from terminal by running commands like this my-electron-app start?

推荐答案

我在这里盲目猜测,因为我只浏览了几分钟的代码:似乎有一个安装后步骤,它也可能是在Hyper中使用 此处。此脚本将文件放置在用户 PATH 中的文件夹中。有关PATH环境变量的更多信息,请此处

I am blindly guessing here since I have simply browsed through the code for a couple of minutes: There seems to be a post install step which is maybe also used in Hyper here somehow. This script places a file in a folder that is probably in the user's PATH. More about the PATH environment variable here.

这篇关于安装后将电子应用程序路径添加到用户环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆