powershell win_autoinstall_chocolatey.ps1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell win_autoinstall_chocolatey.ps1相关的知识,希望对你有一定的参考价值。

#########################
# Autoinstall script using chocolatey
#########################
# Note: Net 4.0 must be installed prior to running this script
#
#Modify this line to change packages
$items = @("ccleaner", "microsoftsecurityessentials", "7zip", "adobereader", "javaruntime", "libreoffice", "googlechrome", "firefox", "vim", "teracopy", "winscp", "wget", "putty", "emacs", "hg")


#################
# Create packages.config based on passed arguments
#################
$xml = '<?xml version="1.0" encoding="utf-8"?>'+ "`n" +'<packages>' + "`n"
foreach ($item in $items)
{
  $xml += "`t" +'<package id="' + $item + '"/>' + "`n"
}
$xml += '</packages>'
 
$file = ([system.environment]::getenvironmentvariable("userprofile") + "\packages.config")
$xml | out-File $file
 
####
# Install chocolatey
####
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
 
 
######
# Install packages with cinst
######
 
cinst $file
 
 
########
# Delete packages.config
Remove-Item $file

以上是关于powershell win_autoinstall_chocolatey.ps1的主要内容,如果未能解决你的问题,请参考以下文章

powershell PowerShell:启动PowerShell作为其他用户提升

powershell [提示输入powershell] #powershell #input #prompt

powershell 测量PowerShell命令或PowerShell脚本的速度

powershell远程下载exe并执行

powershell 使用啥端口

如何在不卸载powershell的情况下,有效禁用/启用powershel