Created
December 31, 2017 02:02
-
-
Save jiro4989/22169fee49f785be8c3348bf976fda07 to your computer and use it in GitHub Desktop.
Chocolateyのインストール済みパッケージ一覧をCLIのみでpackage.configに吐き出す手順 ref: https://qiita.com/jiro4989/items/fffc433d2eddcfa8edd5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| powershell Set-ExecutionPolicy RemoteSigned | |
| powershell .\out_pkgs.ps1 | |
| powershell Set-ExecutionPolicy Restricted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $outFileName = "package.config" | |
| echo "<?xml version=`"1.0`" encoding=`"utf-8`"?>`n<packages>" | Out-File $outFileName -Encoding utf8 | |
| choco list -localonly | sls "(chocolatey|packages installed)" -NotMatch | % { | |
| $packageName = ([string]$_).Split(" ")[0] | |
| echo " <package id=`"$packageName`" />" | |
| } | Out-File $outFileName -Append -Encoding utf8 | |
| echo "</packages>" | Out-File $outFileName -Append -Encoding utf8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment