Chocolatey Install Windows

Posted on by admin

I've installed Chocolatey, but I would like it to install programs to another drive instead of C. C is only a small SSD, but I have other drives where I usually install programs to.

Any ideas?

Hazz22Hazz22

6 Answers

Chocolatey FOSS

For each application, you would need to know its command line switch used during installation to change its installation directory and pass it using --installArgs. See Install Command (choco install) and Overriding default install directory or other advanced install concepts.

Another way to ensure a different drive is to relocate your Program Files to a different drive. You may want to look that up; it is possible to do.

Chocolatey Licensed Versions

We've added the ubiquitous install switch! If you need to override the install directory and you don't want to do all of the work to determine what that switch is, you have the option to use one switch with Chocolatey - Ubiquitous Install Directory Option (Licensed Editions Only).

NOTE: We need to ensure the longevity of the Chocolatey community somehow, and that is to have a FOSSium (freemium) model. The Pro version is $8/month (annually $96), costs you less than eating out once a month, gets you some awesome features, and ensures that the community infrastructure continues to provide a great service and improve. While you are using a free service (the community repository, aka https://chocolatey.org/packages), it is not free to provide that service. So we select certain premium features to go into those versions to provide enough value to be worth the price.

ferventcoderferventcoder

You could move the Chocolatey directory to another location then create a hard symbolic link from the default location - see The Complete Guide to Creating Symbolic Links (AKA Symlinks) on Windows.

I.e. mklink /J C:/ProgramData/chocolatey D:/my/new/location

The old pirate bay browser version

But be sure to create the usual backups, restore points, etc. before doing anything.

Matt GrundyMatt Grundy

For an MSI package (which is most often the case in Windows) use:

To see whether the package is an MSI one, on the Chocolatey package page, under Files, look for chocolateyInstall.ps1 and then look for:

It was tested with Strawberry Perl.

Of course, you can always use the paid chocolate and benefit from the ubiquitous install switch.

antonioantonio

I've found another simple trick - install choco as usual, and right after installation move the c:programdatachocolatey directory anywhere you like, and then update ChocolateyInstall environment variable and also update PATH environment variable so choco's bin subfolder is found after moving it.

Of course, I don't know if it fine with any other packages, but I just installed 7zip and docker-machine with no problems, so seems to work.

quetzalcoatlquetzalcoatl

It looks like Chocolatey has now created a ubiquitous switch:

I've not had chance to use this personally, but it looks like this would do the trick. If a little manual per application.

Hazz22Hazz22

Adding to @antonio's answer I wanted to put my findings on other cases for setting the installation directory.

For fileType = 'exe' there seem to be two types of installers which you can tell apart with the given silentArgs (also in the chocolateyInstall.ps1).

So far I found /S as silentArgs and some longer stuff starting with /VERYSILENT /NORESTART (which seems to be an InnoSetup installer).

  • /S: After testing I found this to be working (7zip as example):
    choco install 7zip.install -y --ia '/D=D:Destination' (Note: This also triggers debugging output. If you have a solution that doesn't, please tell me!)
  • /VERYSILENT /NORESTART ..: According to the InnoSetup Installer CLI docs the switch should be /DIR=<path> although I am not sure how to apply it.

A lot of installers also don't use any of the above. VirtualBox for example expects certain installation arguments, the jdk8 package has params to set a directory that way etc. If you cannot match the silentArgs and fileType with the above you will have to do a little research.
For VirtualBox I ran the installer with /? and got a popup explaining the parameters that could be added.
For Mozilla Firefox I found a community post that explained what flags and switches were allowed for the installer.

Codes

geisterfurz007geisterfurz007

protected by cassiomolinFeb 28 at 17:03

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged windowschocolatey or ask your own question.