我想知道是否有办法制作一个脚本(适用于 Windows)来自动下载和提取铬。
答案1
这是答案。打开 powershell 编辑器并复制并粘贴它。
Write-Output 'Updating Chromium'
$ProgressPreference = 'SilentlyContinue'
cd $env:userprofile\AppData\Local\Temp
Write-Output 'Downloading'
Invoke-WebRequest https://download-chromium.appspot.com/dl/Win_x64?type=snapshots -OutFile
$env:userprofile\AppData\Local\Temp\Chromium.zip
Remove-Item "$env:userprofile\Local Apps\chrome-win" -Recurse
Write-Output 'Unpacking Files'
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}
Unzip "$env:userprofile\AppData\Local\Temp\Chromium.zip" "$env:userprofile\Local Apps"
Remove-Item '$env:userprofile\AppData\Local\Temp\Chromium.zip'
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Chrome.lnk")
$Shortcut.TargetPath = "$env:userprofile\Local Apps\chrome.exe"
$Shortcut.Save()
如果脚本有任何问题,请告诉我