5

Is there any command to run a installed package with chocolatey?

Something like

choco run console2
2
  • Not exactly sure what you are attempting to do here. Perhaps you can elaborate a bit more? Commented Feb 1, 2017 at 5:23
  • I want to execute the installed program
    – user63227
    Commented Feb 1, 2017 at 13:31

2 Answers 2

2

No, there is no command like that.

There is currently no way for Chocolatey to know how to invoke software or applications from a package. There is no property stored within packages to define this, nor is there a command available to do so. Chocolatey is a package manager, and a package is not actually just software.

Chocolatey packages don't actually even need to contain any sort of application.

The way to run software that has been installed (or deployed/dropped) by a package will vary by package, and by any installers contained within.

You can imagine that a CLI application that has simply been unzipped and shimmed (or otherwise added to PATH) will be available on the CLI (e.g. the emacs package results in emacs.exe being available), but you would just run that program - not invoke it via Chocolatey.

Similarly, an installed application will likely end up with shortcuts available (or not, depending on the installer and package logic).

2
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review Commented Jun 27, 2023 at 3:43
  • 2
    I'm sorry, is this not a very valid response to the question "Is there any command to run a installed package with chocolatey?" I understand the question - there is no such command or method for Chocolatey to invoke the content of a package - that's completely up to the package. This is, to my eyes, a valid answer to the question posed above. I'll admit it's a little curt (sorry about that), so I'll add some context.
    – Jeeva
    Commented Jun 27, 2023 at 8:17
0

Place the chocolatey bin folder on your PATH or if you don't want to do that then use the code below.

This code isn't foolproof but it would work in many cases to run a program in the choco bin folder or display the folder if no args. Place the code below in choco-run.bat and put that file in your PATH. I made use of the code here for the loop.

rem @echo off
rem rem Usage: choco-run commmand args
rem rem        choco-run (display choco bin folder)
set choco_bin=C:\ProgramData\chocolatey\bin
set arg1=%1
if /i "%arg1%"=="" (
  dir/w %choco_bin%
  goto:eof
)

set rest=
shift
:loop
if "%1"=="" goto:loop_end
set rest=%rest% %1
shift
goto:loop
:loop_end
%choco_bin%\%arg1% %rest%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .