-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateEdge.cmd
More file actions
46 lines (34 loc) · 1.3 KB
/
Copy pathUpdateEdge.cmd
File metadata and controls
46 lines (34 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@echo off
setlocal enabledelayedexpansion
echo Updating Microsoft Edge to the latest stable build...
:: Set local variables for clean handling
set "EDGE_MSI=%TEMP%\MicrosoftEdgeEnterpriseX64.msi"
:: Clean up any lingering files from previous failed runs
if exist "%EDGE_MSI%" del /f /q "%EDGE_MSI%"
:: 1. Download using static fwlink and -L flag to follow Microsoft's download server redirects
curl -s -L -o "%EDGE_MSI%" "https://go.microsoft.com/fwlink/?LinkID=2093437"
:: 2. Check if file exists AND verify it isn't an empty 0-byte file
if exist "%EDGE_MSI%" (
:: Call a local block to check file size safely
call :CheckFileSize "%EDGE_MSI%"
) else (
echo ERROR: Failed to download the Edge MSI installer. Check internet connection.
)
:: Skip past the subroutine block so it doesn't run twice
goto :EndEdgeUpdate
:CheckFileSize
:: %~z1 expands the first argument passed to this subroutine to its file size in bytes
if "%~z1"=="0" (
echo ERROR: Curl pulled down an empty 0-byte file! Installation aborted.
del /f /q %1
) else (
echo [OK] Verified valid payload download (%~z1 bytes). Installing...
start /wait "" msiexec.exe /i %1 /qn /norestart
del /f /q %1
echo Edge update process complete.
)
goto :eof
:EndEdgeUpdate
echo Edge update process complete
pause
endlocal