Powershell中用于Windows系统安装程序的Visual Studio代码脚本的TASK名称



正在寻找有关编写PowerShell脚本以安装Visual Studio代码的帮助。我已经下载了Windows 64系统安装程序:VSCodeSetup-x64-1.56.2

到目前为止我的脚本:

$fullPath = <<Installer location>>
$vscApp = "VSCodeSetup-x64-1.56.2"
$appPath = join-path $fullPath $vscApp
Write-Host "App Path" $appPath
$arguments = '/SILENT /ALLUSERS /mergetasks="!runcode,????, ????, ???? ,????"'
Start-Process $appPath $arguments -Verb RunAs -Wait

我需要";选择附加任务";选择附加任务GUI屏幕截图

我想打开所有四个其他任务,包括"添加打开"、"注册代码"one_answers"添加到路径"。其中只有1个似乎是默认的。虽然我不需要Inno Setup文档中的桌面图标,https://jrsoftware.org/ishelp/index.php?topic=setupcmdline,我可以看到桌面图标的名称是desktopicon。如何以及在哪里可以找到此列表?

感谢您的帮助!

继续我的评论。有几个预构建的脚本,在几个GitHub Repos中用于静默安装:

示例:

#Install-VSCode
# Download URL, you may need to update this if it changes
$downloadUrl = "https://go.microsoft.com/fwlink/?LinkID=623230"
# What to name the file and where to put it
$installerFile = "vscode-install.exe"
$installerPath = (Join-Path $env:TEMP $installerFile)
# Install Options
# Reference:
# http://stackoverflow.com/questions/42582230/how-to-install-visual-studio-code-silently-without-auto-open-when-installation
# http://www.jrsoftware.org/ishelp/
# I'm using /silent, use /verysilent for no UI
# Install with the context menu, file association, and add to path options (and don't run code after install: 
$installerArguments = "/silent /mergetasks='!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath'"
#Install with default options, and don't run code after install.
#$installerArguments = "/silent /mergetasks='!runcode'"
Write-Verbose "Downloading $installerFile..."
Invoke-Webrequest $downloadUrl -UseBasicParsing -OutFile $installerPath
Write-Verbose "Installing $installerPath..."
Start-Process $installerPath -ArgumentList $installerArguments -Wait
Write-Verbose "Cleanup the downloaded file."
Remove-Item $installerPath -Force

您还可以自动安装VSCode扩展。

示例:

Visual Studio代码:PowerShell入门https://social.technet.microsoft.com/wiki/contents/articles/35780.visual-studio-code-getting-started-with-powershell.aspx

code --install-extension ms-vscode.powershell

最新更新