powershell - How to get default install location of a chocolatey package? - Stack Overflow

I'm trying to find the default install location of chocolatey packages.So I tried this :PS C:&g

I'm trying to find the default install location of chocolatey packages.

So I tried this :

PS C:\> . $env:ChocolateyInstall\lib\chocolatey-core.extension\extensions\Get-AppInstallLocation.ps1
PS C:\> $location = Get-AppInstallLocation 'Mozilla Firefox*ESR'
PS C:\> echo $location
PS C:\> 

But the location returned here is an empty string.

How can I do that ?

I'm trying to find the default install location of chocolatey packages.

So I tried this :

PS C:\> . $env:ChocolateyInstall\lib\chocolatey-core.extension\extensions\Get-AppInstallLocation.ps1
PS C:\> $location = Get-AppInstallLocation 'Mozilla Firefox*ESR'
PS C:\> echo $location
PS C:\> 

But the location returned here is an empty string.

How can I do that ?

Share Improve this question asked Mar 3 at 17:55 SebMaSebMa 4,8291 gold badge39 silver badges49 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0
  • While you can get detailed information about locally installed Chocolatey packages per se - e.g. with
    choco list FirefoxESR -v[1] - it will not reveal their installation directories.

  • As this SU answer explains, it is inherent in the open-ended nature of Chocolatey that it can not generally know where packages are ultimately installed, given that it wraps a variety of installers that opaquely determine their installation locations.

    • However, some of the other answers there offer limited discovery options that may or may not work for you; they are based on examining Chocolatey's logs or inferring the true executable locations from the shim executables that Chocolatey creates.
  • As for what you tried:

    • The purpose of the Get-AppInstallLocation function that the script of the same name defines, if sourced, is to locate executables by their file names (optionally with the .exe extension), using discovery mechanisms that aren't Chocolatey-specific.

    • That is, you can use this function to generally locate executables, irrespective of whether they were installed with Chocolatey or not, based on an executable's file name - which, in the case of Chocolatey-installed packages, may or may not - and probably typically won't - equal the package name.


[1] This assumes specifying an exact package name. For wildcard support, you can use
choco search 'Mozilla Firefox*ESR' -v, for instance, though that by definition could match multiple packages that are available online and also wouldn't tell you whether the matching packages are actually locally installed or not. More work would be needed to limit matches to locally installed packages.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745079433a4610033.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信