Created
March 12, 2020 20:57
-
-
Save MSIH/af11c595ea28bf0e6cf633124ae9a62b to your computer and use it in GitHub Desktop.
Download the latest VS Code System install file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = "https://update.code.visualstudio.com/latest/win32-x64/stable" | |
$vsCodePath = "D:\Artifacts\Software\Base\Visual Studio Code\" | |
# the url is s redirect - get the url with filename | |
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore | |
$location = $request.Headers.Location | |
$location | |
# output path is paht to vs code folder plus the file name | |
$output = $vsCodePath + $location.SubString($location.LastIndexOf('/') + 1) | |
$output | |
if (!(Test-Path $output)) { | |
Invoke-WebRequest -Uri $url -OutFile $output | |
} | |
$start = Get-Date | |
$when = $start.ToString("yyyy-MM-dd-hh-mm-ss") | |
Copy-Item ("$vsCodePath" + "VSCodeSetup-x64.exe") ("$vsCodePath" + "VSCodeSetup-x64-$when.exe") | |
Copy-Item $output ("$vsCodePath" + "VSCodeSetup-x64.exe") -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment