Powershell 在新电脑上安装所有 vscode 扩展

问题描述 投票:0回答:2

我有当前的脚本,可以在新计算机上安装巧克力并安装所有主要应用程序并确认它们是最新的:

#Requires -RunAsAdministrator

# Install chocolatey packet manager
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Install needed packages (these can be changed to suit your needs)
choco install brave discord microsoft-teams microsoft-office-deployment vscode visualstudio2019community sql-server-management-studio tableau-desktop git -y

# Confirm all software is up to date
choco update all -y

我想知道是否有一种方法可以在这个脚本的末尾将我所有的 vscode 扩展安装到新电脑(Windows)上。

windows powershell visual-studio-code
2个回答
2
投票

如果有人需要,有一个用 PowerShell 编写的很酷的解决方案。 这是 Github 上的项目。 / PowerShell Gallery

总而言之,VS-Code 和扩展的安装方式如下:

Install-Script Install-VSCode; Install-VSCode.ps1 -AdditionalExtensions 'ms-azuretools.vscode-azurefunctions', 'ms-python.python'

0
投票

这是通过 PS 在 VS Code 中安装扩展的简单方法:

Start-Process "C:\Program Files\Microsoft VS Code\bin\code.cmd" -ArgumentList "--install-extension","ms-vscode.powershell","--force" -wait

如果您希望它在没有证书错误的情况下运行,则必须在

settings.json
中设置此值:

"http.proxyStrictSSL"": false
© www.soinside.com 2019 - 2024. All rights reserved.