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 the free version you have to pass the directory as an addtional input argument:
choco install theapp -y --ia "folder switch"
Challenge is that the switch differs from installer to installer.
tools\chocolateyInstall.ps1. If there is no such file go back to search an use the "... .installer" version of the app.Search for fileType = exe. This was the case for most of my tested apps (see below). If it's the case search for silentArgs. If there is a:
/S: use --ia "/D=C:\new\path. Note: single backslashes, double backslashes didn't work for me. Also no backslash before the = sign, gave me also an error. /VERYSILENT: use --ia /DIR=C:\new\path. The verysilent switch belongs to the InnoSetup Installer.something else: google "app silent install", determine the path switch and enter accordingly: --ia "..."fileType = msi: use --ia INSTALLDIR="C:\new\path" (I did not test this)
Do a non-silent installment: choco install theapp --notsilent
I wrote a powershell script which either installs apps in their default location or to a new one (provided by you). Applications are provided as a dictionary containing package-name as key and optional input arguments as value. Be aware of the single and double quotation marks.
# --------------------------------------------------------------
# If installation should be in specific path, then provide it as value in the Dict / Hash table.
# Additional choco installer switches have to be set after the path.
$packToInstall= @{
notepadplusplus='';
vlc=''; # Install Dir can only be set via registry
irfanview='';
irfanviewplugins='';
teamviewer='/D=D:\Programme\choco\TeamViewer"';
vscode='"/DIR=D:\Programme\choco\vsCode" /NoDesktopIcon /NoQuicklaunchIcon';
'cpu-z.install'='"/DIR=D:\Programme\choco\cpu-z" ';
}
# --------------------------------------------------------------
# -------------- Script Start ----------------------------------
ForEach($key in $packToInstall.Keys){
if ($packToInstall[$key]) {
choco install $key -y --ia $packToInstall[$key]
}
else {
# Default installer
choco install $key -y
}
}
Save as script.ps1 and run as admin. If the execution policies trouble you: PowerShell.exe -ExecutionPolicy UnRestricted -File .\script.ps1
(I cannot comment directly because of my score, sorry)