Multiple commands to a single call to choco.exe
A script that I use to configure my system has to make multiple calls to choco.exe.
choco feature enable --name=allowGlobalConfirmation
choco feature enable --name=useEnhancedExitCodes
choco source add --name=user --source=$ChocoUserSource
choco install --accept-license dropbox googlechrome spotify
choco pin add --name=dropbox
choco pin add --name=googlechrome
choco pin add --name=spotify
choco upgrade --accept-license firefox emacs
choco upgrade microsoft-office-deployment --params="'/64bit /Product:O365ProPlusRetail /Exclude:Publisher,Groove,Access'"
The repeated calls to choco.exe are slow even if things are fast after it starts up. It would be nice if there were a way to provide a script to choco that would do lots of these things at once. For example, desired would be to write a script like myinstallscript.choco:
feature enable --name=allowGlobalConfirmation
feature enable --name=useEnhancedExitCodes
source add --name=user --source=<source details here>
install --accept-license dropbox googlechrome spotify
pin add --name=dropbox
pin add --name=googlechrome
pin add --name=spotify
upgrade --accept-license <list of packages here>
upgrade microsoft-office-deployment --params="'/64bit /Product:O365ProPlusRetail /Exclude:Publisher,Groove,Access'"
and run with choco script myinstallscript.choco. It would also be useful to be able to combine some of the above lines. For example, one could enable multiple features at once, pin multiple packages at once, or specify pins at the same time as installation. The top script could then become
choco feature enable --name=allowGlobalConfirmation --name=useEnhancedExitCodes
choco source add --name=user --source=$ChocoUserSource
choco upgrade --accept-license dropbox[pin] googlechrome[pin] spotify[pin] firefox emacs microsoft-office-deployment[params="'/64bit /Product:O365ProPlusRetail /Exclude:Publisher,Groove,Access'"]
The packages.config file can only be used to install, not upgrade, and I don't see a way to get it to specify things like pins either.
This seems like a really cool thing! Like a script given to choco with only choco commands in it.
.chocoscript files when? 😁
I like the .choco format idea. I don't see it as a replacement for full PowerShell scripts, but this could be really beneficial for starting a choco shell and then running everything in order. Should also note how things should exit when there are errors, continue, etc.