Skip to content

Instantly share code, notes, and snippets.

@jiro4989
Created December 31, 2017 02:02
Show Gist options
  • Select an option

  • Save jiro4989/22169fee49f785be8c3348bf976fda07 to your computer and use it in GitHub Desktop.

Select an option

Save jiro4989/22169fee49f785be8c3348bf976fda07 to your computer and use it in GitHub Desktop.
Chocolateyのインストール済みパッケージ一覧をCLIのみでpackage.configに吐き出す手順 ref: https://qiita.com/jiro4989/items/fffc433d2eddcfa8edd5
@echo off
powershell Set-ExecutionPolicy RemoteSigned
powershell .\out_pkgs.ps1
powershell Set-ExecutionPolicy Restricted
$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