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 program
For an MSI package (which is most often the case in Windows) use:
choco install package-name --% -ia INSTALLDIR="c:\intall\path"
To see whether the package is an MSI one, on the Chocolatey package page, under Files, look for chocolateyInstall.ps1
and then look for:
fileType = 'msi'
It was tested with Strawberry Perl.
Of course, you can always use the paid chocolate and benefit from the ubiquitous install switch.
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>
and it seems to work like this: choco install pdftk --ia="/DIR=D:\\Tool\\PDFTk"
.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. Unfortunately you have to resupply the ini file for updates every time making it a bit tedious.
Now if you primarily use chocolatey to easily update your applications automatically and install them without manually looking for download links and cluttering your download folder with .msi, .exe and .zip files, you can simply add the chocolatey flag --notsilent
(or --not-silent
) to have the installer run normally with all the options you could normally provide to the UI as well. In most cases they are then also used for updates.