I have a number of collections of software: npm-based, scoop-based, pip-based, and cygwin64-based. I also use FileHippo App Manager to update applications and have used Ninite from time to time.
I was trying to find a way of updating my PyPI collection. Below are three adapted-for-Windows approaches based on similar offerings for Linux:
- Using
pip,sedandxargs(available throughscoop)
pip freeze | sed -e "s/==.*//" | xargs pip install -U
Here we pipe pip freeze through sed replacing double-equals and everything after with an empty string, then pipe that into xargs which runs pip.
- Using
pipandsedwith a moreCMD-like approach
FOR /F %f IN ('pip freeze ^| sed -e "s/==.*//"') DO pip install -U %f
In this approach we use the file-set parameter (/F) on the for. The command between the single-quotes is evaluated (which does the pip and sed thing of #1) and every line is then placed into the %f meta-variable for execution in the do clause.
- Using
pipandCMDonly.
FOR /F "tokens=1 delims==" %f IN ('pip freeze') DO pip install -U %f
Finally, we use the for /f method but this time give extra parameters to control the parsing of the output from pip freeze: we split on = and take the first token. Each result goes into %f for processing by the do clause.
There are other ways of doing this on Windows, like PowerShell. Hopefully, someone will demonstrate how.
Top comments (0)