简体   繁体   English

在powershell中获取由chocolatey安装的软件包的安装路径

[英]Getting Install path of a package just installed by chocolatey in powershell

After I install a package in powershell by using "choco install $package" where package is taken from a config file and would look like "WinRar" so I would be doing choco install WinRar , how do i get the exact path this package was just installed to? 我使用"choco install $package"在powershell中安装了一个包,其中包从配置文件中获取并且看起来像“WinRar”所以我会做choco install WinRar ,我如何得到这个包的确切路径安装到?

For example when I am installing PhantomJS using this, it gets installed to C:\\ProgramData\\chocolatey\\lib\\PhantomJS\\tools\\phantomjs-2.1.1-windows and I as the developer know that, but since I need to add this to the env path, depending on which version the install command installs, the path will be different. 例如,当我使用它安装PhantomJS时,它会被安装到C:\\ProgramData\\chocolatey\\lib\\PhantomJS\\tools\\phantomjs-2.1.1-windows而我作为开发人员知道,但是因为我需要将其添加到env路径,根据安装命令安装的版本,路径将不同。 I need to get the exact path so i can set the environmental variable to right place. 我需要获得确切的路径,以便将环境变量设置到正确的位置。

PhantomJS is just one example, but a lot of packages get installed into directories where their version is apart of the path and getting the path from the powershell install scripts would really be helpful. PhantomJS只是一个例子,但很多软件包安装在其版本不同的目录中,从powershell安装脚本获取路径确实很有帮助。

Is there anything like this available for the package manager? 包管理器有什么可用的吗? I assume figuring out where the package just got installed to should be possible because I see it displayed on my terminal window, just don't know how to access it in powershell. 我假设确定安装包的位置应该是可能的,因为我看到它显示在我的终端窗口上,只是不知道如何在PowerShell中访问它。

Thanks. 谢谢。

Currently there is not a way, but there is a thought to maybe provide back a list of package results with that information (along with more). 目前没有办法,但有一种想法可能会提供包含该信息的包结果列表(以及更多)。 That is still in a feature request so look for it to be developed in the coming months. 这仍然是一个功能请求,所以希望在未来几个月内开发它。

You could parse the Chocolatey output to determine where Chocolatey saw things get installed and we are working to make that detection even better. 您可以解析Chocolatey输出以确定Chocolatey看到的东西安装在哪里,我们正在努力使检测更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检查PowerShell 5是否已安装,如果没有安装,请通过Chocolatey进行安装 - Check if PowerShell 5 is installed and if not install it via Chocolatey 如何通过Powershell运行win32-openssh? (与Chocolatey提供程序的安装包一起安装) - How do I run win32-openssh through the powershell? (installed with install-package from chocolatey provider) 如何使用chocolatey创建和安装powershell命令包? - How to create and install a powershell command package using chocolatey? 使用巧克力制作 Powershell 表单按钮以安装 package - Making a Powershell form button to install a package using chocolatey Chocolatey 安装包失败 - Chocolatey Install Package Failing 带有Chocolatey的install-package从不向路径环境变量添加任何内容 - install-package with chocolatey never adds anything to the path environment variable Find-Package 有效,但 Install-Package 在 powershell 中使用 Chocolatey 仅显示 nuget 错误 - Find-Package works but Install-Package shows only nuget error using chocolatey in powershell 我刚刚安装的nuget包的路径是什么 - What is the path of the nuget package i just installed PowerShell - 创建一个自动脚本来安装巧克力和依赖项 - PowerShell - create an automatic script to install chocolatey and dependencies 用于安装 Chocolatey 和软件包列表的 PowerShell 脚本 - PowerShell script to install Chocolatey and a list of packages
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM