For consistency, always use choco, not choco.exe.PowerShell, but it is an exe, so it cannot return PowerShell objects.įollowing these practices ensures both readability of your scripts ANDĬompatibility across different versions and editions of Chocolatey.įollowing this guide will ensure your experience is not frustratingīased on choco not receiving things you think you are passing to it. This also applies to integrations thatĪre calling Chocolatey and parsing output. Switches, there are some best practices to follow to ensure that youĭon't run into issues later. When writing scripts, such as PowerShell scripts passing options and Scripting / Integration - Best Practices / Style Guide So please split out multiple package calls when Is going to look for and try to install version 1.0.0 of every Installing multiple packages, and you use -version=1.0.0, choco Options and switches apply to all items passed, so if you are.Quote those values using "Quote Values" section above. Value or a path, PowerShell doesn't always handle it well. Periods in PowerShell: If you need to pass a period as part of a. Which means it should not require any special workarounds. V3+, you can try -% before -ia to just pass the args through as is, PowerShell.exe, you must pass it like this: -ia '/yo=""Spaces spaces""'. InĬmd.exe you must pass it like this: -ia "/yo=""Spaces spaces""". To something like a native installer, you are in for a world of fun. Pass quotes in arguments: When you need to pass quoted values to.Using the combinationĪllows for both shells to work without issue, except for when the next ( "value") but in powershell.exe you should use backticks In cmd.exe you can just use double quotes When using spaces, please use a combination of double quotes andĪpostrophes ( "'value'"). Quote Values: When you need to quote an entire argument, such as.Use Equals: You can also include or not include an equals sign.(not the global ones above), some logging may not show up until after NOTE: If debug or verbose are bundled with local options.d (debug), -f (force), -v (verbose), and -y Option Bundling / Bundled Options: One character switches can beīundled.-, /, or - (one character switches should not use -).Otherwise you may find weird/non-supported behavior. Unless stated otherwise, an option/switch should only be passed one.You can pass options and switches in the following ways: Please run chocolatey with choco command -help for specific help onĮach command. upgrade - upgrades packages from various sources.unpackself - re-installs Chocolatey base files.templates - get information about installed templates (alias for template).template - get information about installed templates.synchronize - synchronizes against system installed software - generates missing packages.sync - synchronizes against system installed software - generates missing packages.sources - view and configure default sources (alias for source).source - view and configure default sources.setapikey - retrieves, saves or deletes an API key for a particular source (alias for apikey).push - pushes a compiled nupkg to a source.pack - packages nuspec, scripts, and other Chocolatey package resources into a nupkg file.outdated - retrieves information about packages that are outdated.new - creates template files for creating a new Chocolatey package.install - installs packages using configured sources.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |