Chocolatey uses PowerShell command line to keep software up-to-date

Windows software management is a tedious business. If you want to download a particular program, you have to find the relevant website, then the download link, save the file locally, grab any other components the program might need, and install everything in the right order. You’ll need to start again for every new program. And they’ll all have their own procedures for updating, or uninstalling.

What if you could automate all of this, though? Manage downloads, updates and everything else, just with a few keypresses? That’s the aim of Chocolatey, a tool which brings Linux-like package management to the PC.

The program comes in the form of a PowerShell-based command line tool. And yes, we know, that’s less than ideal, but don’t let it put you off just yet. Chocolately doesn’t require any PowerShell knowledge to use; if you use the command line occasionally then you’ll be able to try out.

Getting started is simple, as there’s nothing for you to download. Just paste the text below into a command prompt (copy it to the clipboard, launch cmd.exe, right-click in the window, select Paste) and press Enter.

@powershell -NoProfile -ExecutionPolicy unrestricted -Command “iex ((new-object net.webclient).DownloadString(‘http://chocolatey.org/install.ps1′))” && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

The Chocolatey code should download automatically, while status messages keep you up-to-date with the installation process. And when it’s done, close and reopen the command window and you’re ready to go.

Installing programs is now as simple as using the “cinst” command. Would you like a copy of Skype, for instance? Type “cinst skype” (less the quotes), press Enter, and Chocolatey will handle the rest. Or try “cinst keepas” to install KeePass Password Manager, “cinst procexp” for Process Explorer, “cinst gimp” for the GIMP image editor, and more. (Enter “clist” at the command line for the full list of packages, or use “clist | clip” to copy the list to the clipboard).

This isn’t just a matter of downloading an installation file and leaving you to do the rest, either. If a program needs something else installing before it’ll work, Chocolatey will grab that first. And as long as the application allows it, installation is silent – there’s no working your way through some tedious setup program.

Better still, Chocolatey can also handle updates for you. So if you need the latest version of Firefox, just enter “chocolatey update firefox” (or “cup firefox” for short) and it’ll be downloaded and installed.

Or, if you really want to save time, using “cup all” will check everything you’ve installed via Chocolatey and update it to the latest version.

Plainly the command line approach here is still a hassle, but the key is that it’s scriptable, and that brings some very interesting opportunities.

If you want to set up a PC to your specifications, then you could create a batch file with the appropriate “cinst” commands (as you’ve seen, they’re not exactly complicated). Once Chocolatey is installed on the target system, run the batch file and all the programs you need will be downloaded and installed. Add another shortcut to run updates – or maybe a batch file which you have Task Scheduler run once a day – and suddenly your software maintenance has become a whole lot easier.

Photo Credit: Yellowj/Shutterstock

4 Responses to Chocolatey uses PowerShell command line to keep software up-to-date

© 1998-2024 BetaNews, Inc. All Rights Reserved. Privacy Policy - Cookie Policy.