@Echo off
>nul 2>&1 dism|| (
>"%tmp%\run.vbs" echo CreateObject("Shell.Application"^).ShellExecute "cmd.exe", "/c %~s0", "", "runas", 1
"%tmp%\run.vbs"& del /q "%tmp%\run.vbs"& goto :eof
)
cd /d %~dp0
set "id=492350f6-3a01-4f97-b9c0-c7c6ddf67d60"
if exist Office for /f %%a in ('dir office\data\* /b/ad') do set ver=%%a& goto inst
set tdir="%tmp%\###_office_###"
2>nul (rd /q/s %tdir%& del /f/a/q %tdir%& md %tdir%)&& pushd %tdir%|| (pause& goto :eof)
curl -LO#
https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip
tar -xf aria2-1.37.0-win-64bit-build1.zip
set i=& for /f "tokens=1,2 delims=: " %%a in (
'curl -sf
https://mrodevicemgr.officeapps.live.com/mrodevicemgrsvc/api/v2/C2RReleaseData'
) do if not defined i (if "%%a"==""Id"" if "%%b"=="4," set i=1) else if "%%a"==""AvailableBuild"" set ver=%%b& goto next
:next
set ver=%ver:~1,-2%
set url=
http://officecdn.microsoft.com.edgesuite.net/DB/%id%/Office/Data
for /r %%a in (aria*.exe) do set a2c=%%a -Z -R -s10 -x10 --file-allocation=trunc --summary-interval=0 --console-log-level=error
%a2c% -d"%~dp0Office\Data" %url%/v64.cab %url%/v64_%ver%.cab
%a2c% -d"%~dp0Office\Data\%ver%" ^
%url%/%ver%/a640_exp.cab ^
%url%/%ver%/i641049.cab ^
%url%/%ver%/s641049.cab ^
%url%/%ver%/stream.x64.ru-RU.dat ^
%url%/%ver%/stream.x64.ru-RU.dat.cat ^
%url%/%ver%/i640.cab ^
%url%/%ver%/i640.cab.cat ^
%url%/%ver%/s640.cab ^
%url%/%ver%/stream.x64.x-none.dat ^
%url%/%ver%/stream.x64.x-none.dat.cat
popd& rd /q/s %tdir%
:inst
:: Приложения которые устанавливать не нужно
set "productexclusion=MondoVolume.excludedapps.16=groove,onedrive,lync,onenote,publisher,project"
set "pth=%ProgramW6432%\Common Files\microsoft shared\ClickToRun"
md "%pth%"& expand "%CD%\Office\Data\%ver%\i640.cab" -F:* "%pth%"
"%pth%\OfficeClickToRun.exe" platform=x64 culture=ru-ru ^
productstoadd=MondoVolume.16_ru-ru_x-none %productexclusion% ^
cdnbaseurl.16=
http://officecdn.microsoft.com/pr/%id% baseurl.16="%CD%" ^
version.16=%ver% mediatype.16=Local sourcetype.16=Local bitnessmigration=False deliverymechanism=%id% ^
updatesenabled.16=False acceptalleulas.16=True autoactivate=0 displaylevel=True pidkeys=HFTND-W9MK4-8B7MJ-B6C4G-XQBR2
cd /d "%ProgramW6432%\Microsoft Office\Office16"|| goto :eof
cscript //nologo ospp.vbs /sethst:kms.digiboy.ir
cscript //nologo ospp.vbs /setprt:1688
cscript //nologo ospp.vbs /act