|
| 1 | +@echo off |
| 2 | +setlocal enabledelayedexpansion |
| 3 | + |
| 4 | +REM Define URLs and paths |
| 5 | +set OfficeToolURL=https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_17830-20162.exe |
| 6 | +set TempPath=%TEMP%\OfficeInstall |
| 7 | +set OfficeToolPath=%TempPath%\OfficeDeploymentTool.exe |
| 8 | +set Config64Bit=%TempPath%\Configuration-64bit.xml |
| 9 | + |
| 10 | +REM Ensure the temp folder exists |
| 11 | +if not exist "%TempPath%" mkdir "%TempPath%" |
| 12 | + |
| 13 | +REM Download the Office Deployment Tool |
| 14 | +echo Downloading Office Deployment Tool... |
| 15 | +curl -o "%OfficeToolPath%" "%OfficeToolURL%" -s --fail |
| 16 | +if errorlevel 1 ( |
| 17 | + echo ERROR: Failed to download Office Deployment Tool. |
| 18 | + exit /b 1 |
| 19 | +) |
| 20 | + |
| 21 | +REM Extract the Office Deployment Tool |
| 22 | +echo Extracting Office Deployment Tool... |
| 23 | +"%OfficeToolPath%" /quiet /extract:"%TempPath%" |
| 24 | +if errorlevel 1 ( |
| 25 | + echo ERROR: Failed to extract Office Deployment Tool. |
| 26 | + exit /b 1 |
| 27 | +) |
| 28 | + |
| 29 | +REM Create the configuration file |
| 30 | +echo Creating the configuration file... |
| 31 | +( |
| 32 | + echo ^<Configuration^> |
| 33 | + echo ^<Add OfficeClientEdition="64" Channel="PerpetualVL2024"^> |
| 34 | + echo ^<Product ID="ProPlus2024Volume"^> |
| 35 | + echo ^<Language ID="en-us" /^> |
| 36 | + echo ^</Product^> |
| 37 | + echo ^</Add^> |
| 38 | + echo ^<RemoveMSI /^> |
| 39 | + echo ^</Configuration^> |
| 40 | +) > "%Config64Bit%" |
| 41 | + |
| 42 | +REM Run the Office setup with the configuration file |
| 43 | +echo Running Office setup... |
| 44 | +"%TempPath%\Setup.exe" /configure "%Config64Bit%" |
| 45 | +if errorlevel 1 ( |
| 46 | + echo ERROR: Installation failed. Please check the logs. |
| 47 | + exit /b 1 |
| 48 | +) |
| 49 | + |
| 50 | +echo Installation completed successfully! |
| 51 | +exit /b 0 |
0 commit comments