簡體   English   中英

Powershell 中 Windows 系統安裝程序腳本的 Visual Studio 代碼的任務名稱

[英]TASK Names for Visual Studio Code for Windows System Installer script in Powershell

尋找有關編寫 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 附加任務 GUI 屏幕截圖上所有復選框項目的內部名稱列表

我想打開所有其他四個任務,包括添加打開、注冊代碼和添加到路徑。 其中只有 1 個似乎是默認的。 雖然我不需要桌面圖標,但從 Inno Setup 文檔https://jrsoftware.org/ishelp/index.php?topic=setupcmdline中,我可以看到桌面圖標名稱是desktopicon 我如何以及在哪里可以找到這份清單?

感謝您的任何幫助!

繼續我的評論。 有幾個預構建的腳本,在幾個 GitHub 存儲庫中用於靜默安裝:

例子:

#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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM