Skip to main content

更新便携版

编写更新脚本

# Stop script on error
$ErrorActionPreference = 'Stop'

# Application folder
$AppDir = "你的vscode路径\"
# Latest stable version (Win32-x64)
$Url = 'https://update.code.visualstudio.com/latest/win32-x64-archive/stable'
# Downloaded zip file
$DownloadFile = [System.IO.Path]::GetTempFileName() + '.zip'
# Download and unlock file
Invoke-WebRequest -uri $Url -OutFile $DownloadFile
Unblock-File $DownloadFile

# Unzip, overwrite code.exe
Expand-Archive -Force -Path $DownloadFile -DestinationPath $AppDir
# Remove temp file
Remove-Item -force -recurse $DownloadFile

Write-Output 'Finished.'

保存update.ps1文件 打开方式是powershell 执行这个脚本