【问题标题】:TASK Names for Visual Studio Code for Windows System Installer script in PowershellPowershell 中 Windows 系统安装程序脚本的 Visual Studio Code 的任务名称
【发布时间】:2021-06-07 18:07:20
【问题描述】:

寻求有关编写 PowerShell 脚本以安装 Visual Studio Code 的帮助。 我已经下载了 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

我需要“选择附加任务”上所有复选框项目的内部名称列表 Select Additional Tasks GUI Screenshot

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

感谢您的所有帮助!

【问题讨论】:

  • 关注这个话题:stackoverflow.com/questions/65410865/… 我正在尝试这两个选项:1 /SAVEINF 来获取列出它们的文件。
  • /SAVEINF="vscInstallLog" 添加到我的参数列表后。然后对位于 C:\Windows\SysWOW64 中的文件进行文件搜索,我能够打开文件并找到我的任务列表:Tasks=addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath
  • 为什么标记为 PowerShell?这不是 PowerShell 问题。这是一个如何静默自动安装 VSCode 的问题。安装过程与从 ​​cmd.exe、VBScript 或 Powershell 相同。您所追求的一切都在 VSCode 文档中。 As well as very clearly documented/shown in many blogs/articles, etc.

标签: powershell visual-studio-code


【解决方案1】:

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

Example:

#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 扩展。

Example:

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

code --install-extension ms-vscode.powershell

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-11
    • 1970-01-01
    • 2019-01-20
    • 2021-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-25
    相关资源
    最近更新 更多