Ethan O'Brien Asked: 2021-03-02 07:53:05 +0800 CST2021-03-02 07:53:05 +0800 CST 2021-03-02 07:53:05 +0800 CST 有没有办法制作一个脚本来更新铬,而不是每次都下载和提取它 772 我想知道是否有办法制作一个脚本(对于 Windows)来自动下载和提取铬。 windows google-chrome 1 个回答 Voted Best Answer Ethan O'Brien 2021-03-02T07:53:05+08:002021-03-02T07:53:05+08:00 这是答案。打开 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() 如果脚本有任何问题,请告诉我
这是答案。打开 powershell 编辑器并复制并粘贴它。
如果脚本有任何问题,请告诉我