Guest User

YAOCTRI_Configurator.cmd

a guest
Feb 7th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 38.53 KB | None | 0 0
  1. @cls
  2. @echo off
  3. set "SysPath=%Windir%\System32"
  4. if exist "%Windir%\Sysnative\reg.exe" (set "SysPath=%Windir%\Sysnative")
  5. set "Path=%SysPath%;%Windir%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\"
  6. set "xOS=x64"
  7. set "_ComSpec=%Windir%\System32\cmd.exe"
  8. set "_Common=%CommonProgramFiles%"
  9. set "_Program=%ProgramFiles%"
  10. if /i %PROCESSOR_ARCHITECTURE%==x86 (
  11. if not defined PROCESSOR_ARCHITEW6432 set "xOS=x86"
  12. if defined PROCESSOR_ARCHITEW6432 (
  13.   set "_ComSpec=%Windir%\Sysnative\cmd.exe"
  14.   set "_Common=%CommonProgramW6432%"
  15.   set "_Program=%ProgramW6432%"
  16.   )
  17. )
  18. set "_target=%_Common%\Microsoft Shared\ClickToRun"
  19. set "_file=%_target%\OfficeClickToRun.exe"
  20. set "_tempdir=%temp%"
  21. set "_workdir=%~dp0"
  22. set "_inipath=%~dp0"
  23. setlocal EnableDelayedExpansion
  24. fsutil dirty query %systemdrive% >nul 2>&1 || goto :E_Admin
  25. for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
  26. if %winbuild% lss 7601 goto :E_Win
  27. title Office Click-to-Run Configurator - Volume
  28. set lpid=(ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-US,es-ES,et-EE,fi-FI,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-TW,hi-IN,id-ID,kk-KZ,MS-MY,vi-VN)
  29. set lcid=(1025,1026,1029,1030,1031,1032,1033,3082,1061,1035,1036,1037,1050,1038,1040,1041,1042,1063,1062,1044,1043,1045,1046,2070,1048,1049,1051,1060,9242,1053,1054,1055,1058,2052,1028,1081,1057,1087,1086,1066)
  30. set bits=(32,64)
  31. set /a cc=0
  32. for %%# in %lpid% do (
  33. set /a cc+=1
  34. set lpid!cc!=%%#
  35. )
  36. set /a cc=0
  37. for %%# in %lcid% do (
  38. set /a cc+=1
  39. set lcid!cc!=%%#
  40. )
  41. set /a cc=0
  42. for %%# in (
  43. 5440fd1f-7ecb-4221-8110-145efaa6372f
  44. 64256afe-f5d9-4f86-8936-8840a6a4f5be
  45. 492350f6-3a01-4f97-b9c0-c7c6ddf67d60
  46. b8f9b850-328d-4355-9145-c59439a0c4cf
  47. 7ffbc6bf-bc32-4f92-8982-f9dd17fd3114
  48. 2e148de9-61c8-4051-b103-4af54baffbb4
  49. f2e724c1-748f-4b47-8fb8-8e0d210e9208
  50. ea4a4090-de26-49d7-93c1-91bff9e53fc3
  51. b61285dd-d9f7-41f2-9757-8f61cba4e9c8
  52. ) do (
  53. set /a cc+=1
  54. set ffn!cc!=%%#
  55. )
  56. set /a cc=0
  57. for %%# in (Insiders,MonthlyTargeted,Monthly,SemiAnnualTargeted,SemiAnnual,PerpetualVL2019Targeted,PerpetualVL2019,DogfoodDevMain,MicrosoftElite) do (
  58. set /a cc+=1
  59. set chn!cc!=%%#
  60. )
  61. set "line=============================================================="
  62. if exist "!_workdir!\Office\Data\*.cab" (
  63. for /f %%# in ('dir /b /ad "!_workdir!\Office\Data\" 2^>nul') do if exist "!_workdir!\Office\Data\%%#\stream*.dat" (
  64.   call :get_path "!_workdir!"
  65.   )
  66. )
  67. if defined CTRsource goto :check
  68. if exist "!_workdir!\Data\*.cab" (
  69. for /f %%# in ('dir /b /ad "!_workdir!\Data\" 2^>nul') do if exist "!_workdir!\Data\%%#\stream*.dat" (
  70.   call :get_path "!_workdir!..\"
  71.   )
  72. )
  73. if defined CTRsource goto :check
  74. for %%# in (C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) do (
  75. if exist "%%#:\Office\Data\*.cab" set "CTRsource=%%#:\"
  76. )
  77. if defined CTRsource goto :check
  78. goto :prompt
  79.  
  80. :get_path
  81. endlocal
  82. set "CTRsource=%~dp1"
  83. exit /b
  84.  
  85. :prompt
  86. cls
  87. set CTRsource=
  88. echo %line%
  89. echo Enter the directory / drive that contain "Office" folder
  90. echo ^(do not enter the path for Office folder itself^)
  91. echo %line%
  92. echo.
  93. set /p "CTRsource="
  94. if "%CTRsource%"=="" goto :eof
  95. if not exist "%CTRsource%\Office\Data\*.cab" (
  96. echo ==== ERROR ====
  97. echo Specified path is not a valid Office C2R source
  98. echo.
  99. echo Press any key to continue...
  100. pause >nul
  101. goto :prompt
  102. )
  103. goto :check
  104.  
  105. :check
  106. setlocal EnableDelayedExpansion
  107. if "!CTRsource:~-1!"=="\" set "CTRsource=!CTRsource:~0,-1!"
  108. cls
  109. echo %line%
  110. echo Source  : "!CTRsource!"
  111. echo %line%
  112. echo.
  113. copy /y nul "!CTRsource!\Office\#.rw" 1>nul 2>nul && (
  114. set CTRtype=Local
  115. if exist "!CTRsource!\Office\#.rw" del /f /q "!CTRsource!\Office\#.rw"
  116. ) || (
  117. set CTRtype=DVD
  118. )
  119. if "!CTRsource:~0,2!"=="\\" set CTRtype=UNC
  120. set /a vvv=0
  121. for /f %%# in ('dir /b /ad "!CTRsource!\Office\Data\" 2^>nul') do if exist "!CTRsource!\Office\Data\%%#\stream*.dat" if exist "!CTRsource!\Office\Data\*%%#.cab" (
  122. set /a vvv+=1
  123. set CTRver!vvv!=%%#
  124. set CTRver=%%#
  125. )
  126. if %vvv% equ 0 (
  127. echo ==== ERROR ====
  128. echo Specified path is not a valid Office C2R source
  129. echo.
  130. echo Press any key to continue...
  131. pause >nul
  132. goto :prompt
  133. )
  134. if %vvv% gtr 9 (
  135. echo.
  136. echo ==== ERROR ====
  137. echo More than 9 versions detected in Office C2R source
  138. echo remove some of them and try again
  139. echo.
  140. echo Press any key to exit...
  141. pause >nul
  142. goto :eof
  143. )
  144. if %vvv% equ 1 goto :MenuVersion2
  145.  
  146. :MenuVersion
  147. cls
  148. echo %line%
  149. echo Source  : "!CTRsource!"
  150. echo %line%
  151. echo.
  152. set inpt=
  153. set errortmp=
  154. for /l %%J in (1,1,%vvv%) do (
  155. echo. %%J. !CTRver%%J!
  156. )
  157. echo.
  158. echo %line%
  159. choice /c 123456789X /n /m "Choose a version to proceed, or press X to exit: "
  160. set errortmp=%errorlevel%
  161. if %errortmp%==10 goto :eof
  162. if %errortmp%==9 if %vvv%==9 (set inpt=9&goto :MenuVersion2)
  163. if %errortmp%==8 if %vvv%==8 (set inpt=8&goto :MenuVersion2)
  164. if %errortmp%==7 if %vvv%==7 (set inpt=7&goto :MenuVersion2)
  165. if %errortmp%==6 if %vvv%==6 (set inpt=6&goto :MenuVersion2)
  166. if %errortmp%==5 if %vvv%==5 (set inpt=5&goto :MenuVersion2)
  167. if %errortmp%==4 if %vvv%==4 (set inpt=4&goto :MenuVersion2)
  168. if %errortmp%==3 if %vvv%==3 (set inpt=3&goto :MenuVersion2)
  169. if %errortmp%==2 (set inpt=2&goto :MenuVersion2)
  170. if %errortmp%==1 (set inpt=1&goto :MenuVersion2)
  171. goto :MenuVersion
  172.  
  173. :MenuVersion2
  174. cls
  175. echo %line%
  176. echo Source  : "!CTRsource!"
  177. echo Version : %CTRver%
  178. echo %line%
  179. echo.
  180. if %vvv% gtr 1 set "CTRver=!CTRver%inpt%!"
  181. for %%# in %bits% do (
  182. if exist "!CTRsource!\Office\Data\v%%#*.cab" set vcab%%#=1
  183. )
  184. if exist "!CTRsource!\Office\Data\%CTRver%\stream.x86.x-none.dat" set stream32=1
  185. if exist "!CTRsource!\Office\Data\%CTRver%\stream.x64.x-none.dat" set stream64=1
  186. for %%# in %bits% do (
  187.   if exist "!CTRsource!\Office\Data\%CTRver%\i%%#0.cab" set icab%%#=1
  188.   if exist "!CTRsource!\Office\Data\%CTRver%\s%%#0.cab" set scab%%#=1
  189. )
  190. for /l %%J in (1,1,40) do (
  191.   if exist "!CTRsource!\Office\Data\%CTRver%\i32!lcid%%J!.cab" (set icablp32=1&set icablp32!lpid%%J!=1)
  192.   if exist "!CTRsource!\Office\Data\%CTRver%\i64!lcid%%J!.cab" (set icablp64=1&set icablp64!lpid%%J!=1)
  193.   if exist "!CTRsource!\Office\Data\%CTRver%\s32!lcid%%J!.cab" (set scablp32=1&set scablp32!lpid%%J!=1)
  194.   if exist "!CTRsource!\Office\Data\%CTRver%\s64!lcid%%J!.cab" (set scablp64=1&set scablp64!lpid%%J!=1)
  195.   if exist "!CTRsource!\Office\Data\%CTRver%\stream.x86.!lpid%%J!.dat" (set streamlp32=1&set streamlp32!lpid%%J!=1)
  196.   if exist "!CTRsource!\Office\Data\%CTRver%\stream.x64.!lpid%%J!.dat" (set streamlp64=1&set streamlp64!lpid%%J!=1)
  197. )
  198.  
  199. for %%# in %bits% do (if "!vcab%%#!"=="1" if "!icab%%#!"=="1" if "!scab%%#!"=="1" if "!stream%%#!"=="1" set main%%#=1)
  200. for %%# in %bits% do (if "!icablp%%#!"=="1" if "!scablp%%#!"=="1" if "!streamlp%%#!"=="1" set lang%%#=1)
  201. set win32=0
  202. set win64=0
  203. set wow64=0
  204. if "%main32%"=="1" if "%lang32%"=="1" set off32=1
  205. if "%main64%"=="1" if "%lang64%"=="1" set off64=1
  206. if "%xOS%"=="x86" if "%off32%"=="1" set "win32=1"
  207. if "%xOS%"=="x64" if "%off64%"=="1" set "win64=1"
  208. if "%xOS%"=="x64" if "%off32%"=="1" if "%icab64%"=="1" if "%icablp64%"=="1" set "wow64=1"
  209.  
  210. if "%xOS%"=="x86" if "%win32%"=="0" (
  211.   echo ==== ERROR ====
  212.   echo Could not detect compatible Office 32-bit for current x86 system.
  213.   echo.
  214.   echo Press any key to exit...
  215.   pause >nul
  216.   goto :eof
  217. )
  218. if "%xOS%"=="x64" if "%win64%"=="0" if "%wow64%"=="0" (
  219.   echo ==== ERROR ====
  220.   echo Could not detect compatible Office 64-bit/32-bit for current x64 system.
  221.   echo.
  222.   echo Press any key to exit...
  223.   pause >nul
  224.   goto :eof
  225. )
  226. if "%win32%"=="1" (set "CTRarc=x86"&goto :MenuArch2)
  227. if "%win64%"=="1" if "%wow64%"=="0" (set "CTRarc=x64"&goto :MenuArch2)
  228. if "%win64%"=="0" if "%wow64%"=="1" (set "CTRarc=x86"&goto :MenuArch2)
  229.  
  230. :MenuArch
  231. cls
  232. echo %line%
  233. echo Source  : "!CTRsource!"
  234. echo Version : %CTRver%
  235. echo %line%
  236. echo.
  237. echo. 1. Office 64-bit (x64)
  238. echo. 2. Office 32-bit (x86)
  239. echo.
  240. echo %line%
  241. choice /c 12X /n /m "Choose an architecture to proceed, or press X to exit: "
  242. if errorlevel 3 goto :eof
  243. if errorlevel 2 (set "win64=0"&set "CTRarc=x86"&goto :MenuArch2)
  244. if errorlevel 1 (set "wow64=0"&set "CTRarc=x64"&goto :MenuArch2)
  245. goto :MenuArch
  246.  
  247. :MenuArch2
  248. cls
  249. echo %line%
  250. echo Source  : "!CTRsource!"
  251. echo Version : %CTRver% / Arch: %CTRarc%
  252. echo %line%
  253. echo.
  254. set /a int=0
  255. for /l %%J in (1,1,40) do (
  256. call :checklp !lpid%%J! !lcid%%J!
  257. )
  258. if %int% gtr 9 (
  259. echo.
  260. echo ==== ERROR ====
  261. echo More than 9 languages detected in Office C2R source
  262. echo remove some of them and try again
  263. echo.
  264. echo Press any key to exit...
  265. pause >nul
  266. goto :eof
  267. )
  268. if %int% equ 1 goto :MenuLang2
  269. goto :MenuLang
  270.  
  271. :checklp
  272. if "%win64%"=="0" if "!icablp32%1!"=="1" if "!scablp32%1!"=="1" if "!streamlp32%1!"=="1" (
  273. set /a int+=1
  274. set zlng!int!=%1
  275. set zcul!int!=%2
  276. set lng32=%1
  277. set cul32=%2
  278. )
  279. if "%win64%"=="1" if "!icablp64%1!"=="1" if "!scablp64%1!"=="1" if "!streamlp64%1!"=="1" (
  280. set /a int+=1
  281. set zlng!int!=%1
  282. set zcul!int!=%2
  283. set lng64=%1
  284. set cul64=%2
  285. )
  286. exit /b
  287.  
  288. :MenuLang
  289. cls
  290. echo %line%
  291. echo Source  : "!CTRsource!"
  292. echo Version : %CTRver% / Arch: %CTRarc%
  293. echo %line%
  294. echo.
  295. set inpt=
  296. set errortmp=
  297. echo. 0. All
  298. for /l %%J in (1,1,%int%) do (
  299. echo. %%J. !zlng%%J!
  300. )
  301. echo.
  302. echo %line%
  303. choice /c 1234567890X /n /m "Choose language(s) to proceed, or press X to exit: "
  304. set errortmp=%errorlevel%
  305. if %errortmp%==11 goto :eof
  306. if %errortmp%==10 goto :MenuLangM
  307. if %errortmp%==9 if %int%==9 (set inpt=9&goto :MenuLang2)
  308. if %errortmp%==8 if %int%==8 (set inpt=8&goto :MenuLang2)
  309. if %errortmp%==7 if %int%==7 (set inpt=7&goto :MenuLang2)
  310. if %errortmp%==6 if %int%==6 (set inpt=6&goto :MenuLang2)
  311. if %errortmp%==5 if %int%==5 (set inpt=5&goto :MenuLang2)
  312. if %errortmp%==4 if %int%==4 (set inpt=4&goto :MenuLang2)
  313. if %errortmp%==3 if %int%==3 (set inpt=3&goto :MenuLang2)
  314. if %errortmp%==2 (set inpt=2&goto :MenuLang2)
  315. if %errortmp%==1 (set inpt=1&goto :MenuLang2)
  316. goto :MenuLang
  317.  
  318. :MenuLang2
  319. cls
  320. if %int% gtr 1 (
  321. set "lng32=!zlng%inpt%!"
  322. set "lng64=!zlng%inpt%!"
  323. set "cul32=!zcul%inpt%!"
  324. set "cul64=!zcul%inpt%!"
  325. )
  326. if %win32%==1 (
  327. set CTRlng=%lng32%&set CTRcul=%cul32%&set CTRvcab=v32_%CTRver%.cab&set CTRicab=i320.cab&set CTRicabr=i32%cul32%.cab
  328. )
  329. if %wow64%==1 (
  330. set CTRlng=%lng32%&set CTRcul=%cul32%&set CTRvcab=v32_%CTRver%.cab&set CTRicab=i640.cab&set CTRicabr=i64%cul32%.cab
  331. )
  332. if %win64%==1 (
  333. set CTRlng=%lng64%&set CTRcul=%cul64%&set CTRvcab=v64_%CTRver%.cab&set CTRicab=i640.cab&set CTRicabr=i64%cul64%.cab
  334. )
  335. set CTRstp=%CTRlng%
  336. goto :MenuInitial
  337.  
  338. :MenuLangM
  339. cls
  340. echo %line%
  341. echo Source  : "!CTRsource!"
  342. echo Version : %CTRver% / Arch: %CTRarc%
  343. echo %line%
  344. echo.
  345. set inpt=
  346. set errortmp=
  347. for /l %%J in (1,1,%int%) do (
  348. echo. %%J. !zlng%%J!
  349. )
  350. echo.
  351. echo %line%
  352. choice /c 123456789X /n /m "Choose primary language to proceed, or press X to exit: "
  353. set errortmp=%errorlevel%
  354. if %errortmp%==10 goto :eof
  355. if %errortmp%==9 if %int%==9 (set inpt=9&goto :MenuLangM2)
  356. if %errortmp%==8 if %int%==8 (set inpt=8&goto :MenuLangM2)
  357. if %errortmp%==7 if %int%==7 (set inpt=7&goto :MenuLangM2)
  358. if %errortmp%==6 if %int%==6 (set inpt=6&goto :MenuLangM2)
  359. if %errortmp%==5 if %int%==5 (set inpt=5&goto :MenuLangM2)
  360. if %errortmp%==4 if %int%==4 (set inpt=4&goto :MenuLangM2)
  361. if %errortmp%==3 if %int%==3 (set inpt=3&goto :MenuLangM2)
  362. if %errortmp%==2 (set inpt=2&goto :MenuLangM2)
  363. if %errortmp%==1 (set inpt=1&goto :MenuLangM2)
  364. goto :MenuLangM
  365.  
  366. :MenuLangM2
  367. cls
  368. for /l %%J in (1,1,%int%) do (
  369. if defined CTRlng (set "CTRlng=!CTRlng!_!zlng%%J!") else (set "CTRlng=!zlng%%J!")
  370. if defined CTRcul (set "CTRcul=!CTRcul!,!zcul%%J!") else (set "CTRcul=!zcul%%J!")
  371. )
  372. set CTRstp=!zlng%inpt%!
  373. set CTRprm=!zcul%inpt%!
  374. if %win32%==1 (
  375. set CTRvcab=v32_%CTRver%.cab&set CTRicab=i320.cab&set CTRicabr=i32%CTRprm%.cab
  376. )
  377. if %wow64%==1 (
  378. set CTRvcab=v32_%CTRver%.cab&set CTRicab=i640.cab&set CTRicabr=i64%CTRprm%.cab
  379. )
  380. if %win64%==1 (
  381. set CTRvcab=v64_%CTRver%.cab&set CTRicab=i640.cab&set CTRicabr=i64%CTRprm%.cab
  382. )
  383.  
  384. :MenuInitial
  385. set _O2019=1
  386. expand.exe -f:*.xml "!CTRsource!\Office\Data\%CTRvcab%" "!_tempdir!" >nul
  387. findstr /i Word2019Volume "!_tempdir!\VersionDescriptor.xml" >nul || set _O2019=0
  388. del /f /q "!_tempdir!\*.xml" 1>nul 2>nul
  389. set _Access=ON
  390. set _Excel=ON
  391. set _Lync=ON
  392. set _OneDrive=OFF
  393. set _OneNote=ON
  394. set _Outlook=ON
  395. set _PowerPoint=ON
  396. set _Publisher=ON
  397. set _SkypeForBusiness=ON
  398. set _Word=ON
  399. set _Project=ON
  400. set _Visio=ON
  401. set _Mondo=OFF
  402. set _O365=ON
  403. set _Pro=OFF
  404. set _Std=OFF
  405. set _PrjPro=OFF
  406. set _PrjStd=OFF
  407. set _VisPro=OFF
  408. set _VisStd=OFF
  409. set _updt=True
  410. set _eula=True
  411. set _icon=False
  412. set _shut=True
  413. set _disp=True
  414. set _actv=False
  415. set _tele=True
  416. if %_O2019%==0 goto :MenuSuite
  417. cls
  418. echo %line%
  419. echo Source  : "!CTRsource!"
  420. echo Version : %CTRver% / Arch: %CTRarc% / Lang: %CTRlng%
  421. echo %line%
  422. echo.
  423. echo. 1. Install Product Suite
  424. echo. 2. Install Single Apps
  425. echo.
  426. echo %line%
  427. choice /c 12X /n /m "Choose a menu option to proceed, or press X to exit: "
  428. if errorlevel 3 goto :eof
  429. if errorlevel 2 goto :MenuApps
  430. if errorlevel 1 goto :MenuSuite
  431. goto :MenuInitial
  432.  
  433. :MenuSuite
  434. if %_O365%==OFF if %_Pro%==OFF if %_Std%==OFF if %_Mondo%==OFF if %_PrjPro%==OFF if %_PrjStd%==OFF if %_VisPro%==OFF if %_VisStd%==OFF set _O365=ON
  435. cls
  436. echo %line%
  437. echo Source  : "!CTRsource!"
  438. echo Version : %CTRver% / Arch: %CTRarc% / Lang: %CTRlng%
  439. echo %line%
  440. echo Select Products to Install:
  441. echo.
  442. echo. 1. Office 365 ProPlus    : %_O365%
  443. echo. 2. Office Mondo 2016     : %_Mondo%
  444. if %_O2019%==1 (
  445. echo. 3. Office ProPlus 2019   : %_Pro%
  446. echo. 4. Office Standard 2019  : %_Std%
  447. echo.
  448. echo. 5. Project Pro 2019      : %_PrjPro%
  449. echo. 6. Project Standard 2019 : %_PrjStd%
  450. echo. 7. Visio Pro 2019        : %_VisPro%
  451. echo. 8. Visio Standard 2019   : %_VisStd%
  452. )
  453. echo %line%
  454. choice /c 1234567890X /n /m "Change a menu option, press 0 to proceed, 9 to go back, or X to exit: "
  455. if errorlevel 11 goto :eof
  456. if errorlevel 10 goto :MenuSuite2
  457. if errorlevel 9 goto :MenuInitial
  458. if errorlevel 8 (if %_O2019%==1 (if %_VisStd%==ON (set _VisStd=OFF) else if %_Mondo%==OFF (set _VisPro=OFF&set _VisStd=ON)))&goto :MenuSuite
  459. if errorlevel 7 (if %_O2019%==1 (if %_VisPro%==ON (set _VisPro=OFF) else if %_Mondo%==OFF (set _VisPro=ON&set _VisStd=OFF)))&goto :MenuSuite
  460. if errorlevel 6 (if %_O2019%==1 (if %_PrjStd%==ON (set _PrjStd=OFF) else if %_Mondo%==OFF (set _PrjPro=OFF&set _PrjStd=ON)))&goto :MenuSuite
  461. if errorlevel 5 (if %_O2019%==1 (if %_PrjPro%==ON (set _PrjPro=OFF) else if %_Mondo%==OFF (set _PrjPro=ON&set _PrjStd=OFF)))&goto :MenuSuite
  462. if errorlevel 4 (if %_O2019%==1 (if %_Std%==ON (set _Std=OFF) else (set _Std=ON&set _Mondo=OFF&set _O365=OFF&set _Pro=OFF)))&goto :MenuSuite
  463. if errorlevel 3 (if %_O2019%==1 (if %_Pro%==ON (set _Pro=OFF) else (set _Pro=ON&set _Mondo=OFF&set _O365=OFF&set _Std=OFF)))&goto :MenuSuite
  464. if errorlevel 2 (if %_Mondo%==ON (set _Mondo=OFF) else (set _Mondo=ON&set _O365=OFF&set _Pro=OFF&set _Std=OFF&set _PrjPro=OFF&set _PrjStd=OFF&set _VisPro=OFF&set _VisStd=OFF))&goto :MenuSuite
  465. if errorlevel 1 (if %_O365%==ON (set _O365=OFF) else (set _O365=ON&set _Mondo=OFF&set _Pro=OFF&set _Std=OFF))&goto :MenuSuite
  466. goto :MenuSuite
  467.  
  468. :MenuApps
  469. if %_Access%==OFF if %_Excel%==OFF if %_OneNote%==OFF if %_Outlook%==OFF if %_PowerPoint%==OFF if %_Publisher%==OFF if %_SkypeForBusiness%==OFF if %_Word%==OFF if %_PrjPro%==OFF if %_PrjStd%==OFF if %_VisPro%==OFF if %_VisStd%==OFF set _Word=ON
  470. cls
  471. echo %line%
  472. echo Source  : "!CTRsource!"
  473. echo Version : %CTRver% / Arch: %CTRarc% / Lang: %CTRlng%
  474. echo %line%
  475. echo Select Apps to install:
  476. echo.
  477. echo. A. Access 2019           : %_Access%
  478. echo. E. Excel 2019            : %_Excel%
  479. echo. N. OneNote 2016          : %_OneNote%
  480. echo. O. Outlook 2019          : %_Outlook%
  481. echo. P. PowerPoint 2019       : %_PowerPoint%
  482. echo. R. Publisher 2019        : %_Publisher%
  483. echo. S. SkypeForBusiness 2019 : %_SkypeForBusiness%
  484. echo. W. Word 2019             : %_Word%
  485. echo.
  486. echo. 5. Project Pro 2019      : %_PrjPro%
  487. echo. 6. Project Standard 2019 : %_PrjStd%
  488. echo. 7. Visio Pro 2019        : %_VisPro%
  489. echo. 8. Visio Standard 2019   : %_VisStd%
  490. echo.
  491. echo. D. OneDrive Desktop      : %_OneDrive%
  492. echo %line%
  493. choice /c AENOPRSWD567890X /n /m "Change a menu option, press 0 to proceed, 9 to go back, or X to exit: "
  494. if errorlevel 16 goto :eof
  495. if errorlevel 15 goto :MenuApps2
  496. if errorlevel 14 goto :MenuInitial
  497. if errorlevel 13 (if %_VisStd%==ON (set _VisStd=OFF) else (set _VisPro=OFF&set _VisStd=ON))&goto :MenuApps
  498. if errorlevel 12 (if %_VisPro%==ON (set _VisPro=OFF) else (set _VisPro=ON&set _VisStd=OFF))&goto :MenuApps
  499. if errorlevel 11 (if %_PrjStd%==ON (set _PrjStd=OFF) else (set _PrjPro=OFF&set _PrjStd=ON))&goto :MenuApps
  500. if errorlevel 10 (if %_PrjPro%==ON (set _PrjPro=OFF) else (set _PrjPro=ON&set _PrjStd=OFF))&goto :MenuApps
  501. if errorlevel 9 (if %_OneDrive%==ON (set _OneDrive=OFF) else (set _OneDrive=ON))&goto :MenuApps
  502. if errorlevel 8 (if %_Word%==ON (set _Word=OFF) else (set _Word=ON))&goto :MenuApps
  503. if errorlevel 7 (if %_SkypeForBusiness%==ON (set _SkypeForBusiness=OFF) else (set _SkypeForBusiness=ON))&goto :MenuApps
  504. if errorlevel 6 (if %_Publisher%==ON (set _Publisher=OFF) else (set _Publisher=ON))&goto :MenuApps
  505. if errorlevel 5 (if %_PowerPoint%==ON (set _PowerPoint=OFF) else (set _PowerPoint=ON))&goto :MenuApps
  506. if errorlevel 4 (if %_Outlook%==ON (set _Outlook=OFF) else (set _Outlook=ON))&goto :MenuApps
  507. if errorlevel 3 (if %_OneNote%==ON (set _OneNote=OFF) else (set _OneNote=ON))&goto :MenuApps
  508. if errorlevel 2 (if %_Excel%==ON (set _Excel=OFF) else (set _Excel=ON))&goto :MenuApps
  509. if errorlevel 1 (if %_Access%==ON (set _Access=OFF) else (set _Access=ON))&goto :MenuApps
  510. goto :MenuApps
  511.  
  512. :MenuSuite2
  513. set "_retsuite="
  514. set "_suite="
  515. set "_suit2="
  516. for /l %%J in (1,1,15) do (
  517. set "_sku%%J="
  518. )
  519. set "_pkey0="
  520. for /l %%J in (1,1,15) do (
  521. set "_pkey%%J="
  522. )
  523. set /a cc=0
  524. set /a kk=0
  525. if %_O365%==ON (
  526. set _suite=O365ProPlusRetail&set _suit2=MondoVolume
  527. set _pkey0=HFTND-W9MK4-8B7MJ-B6C4G-XQBR2
  528. ) else if %_Pro%==ON (
  529. if %winbuild% lss 10240 (set _suite=O365ProPlusRetail&set _suit2=ProPlus2019Volume) else (set _suite=ProPlus2019Volume)
  530. set _pkey0=NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP
  531. ) else if %_Std%==ON (
  532. if %winbuild% lss 10240 (set _suite=StandardRetail&set _suit2=Standard2019Volume) else (set _suite=Standard2019Volume)
  533. set _pkey0=6NWWJ-YQWMR-QKGCB-6TMB3-9D9HK
  534. ) else if %_Mondo%==ON (
  535. set _suite=MondoVolume
  536. set _pkey0=HFTND-W9MK4-8B7MJ-B6C4G-XQBR2
  537. )
  538. if %_PrjPro%==ON (
  539. set /a cc+=1
  540. if %winbuild% lss 10240 (set _sku!cc!=ProjectProRetail&set /a cc+=1&set _sku!cc!=ProjectPro2019Volume) else (set _sku!cc!=ProjectPro2019Volume)
  541. set /a kk+=1
  542. set _pkey!kk!=B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B
  543. ) else if %_PrjStd%==ON (
  544. set /a cc+=1
  545. if %winbuild% lss 10240 (set _sku!cc!=ProjectStdRetail&set /a cc+=1&set _sku!cc!=ProjectStd2019Volume) else (set _sku!cc!=ProjectStd2019Volume)
  546. set /a kk+=1
  547. set _pkey!kk!=C4F7P-NCP8C-6CQPT-MQHV9-JXD2M
  548. )
  549. if %_VisPro%==ON (
  550. set /a cc+=1
  551. if %winbuild% lss 10240 (set _sku!cc!=VisioProRetail&set /a cc+=1&set _sku!cc!=VisioPro2019Volume) else (set _sku!cc!=VisioPro2019Volume)
  552. set /a kk+=1
  553. set _pkey!kk!=9BGNQ-K37YR-RQHF2-38RQ3-7VCBB
  554. ) else if %_VisStd%==ON (
  555. set /a cc+=1
  556. if %winbuild% lss 10240 (set _sku!cc!=VisioStdRetail&set /a cc+=1&set _sku!cc!=VisioStd2019Volume) else (set _sku!cc!=VisioStd2019Volume)
  557. set /a kk+=1
  558. set _pkey!kk!=7TQNQ-K3YQQ-3PFH7-CCPPM-X4VQ2
  559. )
  560. set "_retsuite=1"
  561. if defined _suite goto :MenuExclude
  562. goto :MenuChannel
  563.  
  564. :MenuApps2
  565. set "_retsuite="
  566. for /l %%J in (1,1,15) do (
  567. set "_sku%%J="
  568. )
  569. set "_keys="
  570. set "_pkey0="
  571. for /l %%J in (1,1,15) do (
  572. set "_pkey%%J="
  573. )
  574. set /a cc=0
  575. set /a kk=0
  576. if %_Access%==ON (
  577. set /a cc+=1
  578. if %winbuild% lss 10240 (set _sku!cc!=AccessRetail&set /a cc+=1&set _sku!cc!=Access2019Volume) else (set _sku!cc!=Access2019Volume)
  579. set /a kk+=1
  580. set _pkey!kk!=9N9PT-27V4Y-VJ2PD-YXFMF-YTFQT
  581. )
  582. if %_Excel%==ON (
  583. set /a cc+=1
  584. if %winbuild% lss 10240 (set _sku!cc!=ExcelRetail&set /a cc+=1&set _sku!cc!=Excel2019Volume) else (set _sku!cc!=Excel2019Volume)
  585. set /a kk+=1
  586. set _pkey!kk!=TMJWT-YYNMB-3BKTF-644FC-RVXBD
  587. )
  588. if %_Outlook%==ON (
  589. set /a cc+=1
  590. if %winbuild% lss 10240 (set _sku!cc!=OutlookRetail&set /a cc+=1&set _sku!cc!=Outlook2019Volume) else (set _sku!cc!=Outlook2019Volume)
  591. set /a kk+=1
  592. set _pkey!kk!=7HD7K-N4PVK-BHBCQ-YWQRW-XW4VK
  593. )
  594. if %_PowerPoint%==ON (
  595. set /a cc+=1
  596. if %winbuild% lss 10240 (set _sku!cc!=PowerPointRetail&set /a cc+=1&set _sku!cc!=PowerPoint2019Volume) else (set _sku!cc!=PowerPoint2019Volume)
  597. set /a kk+=1
  598. set _pkey!kk!=RRNCX-C64HY-W2MM7-MCH9G-TJHMQ
  599. )
  600. if %_Publisher%==ON (
  601. set /a cc+=1
  602. if %winbuild% lss 10240 (set _sku!cc!=PublisherRetail&set /a cc+=1&set _sku!cc!=Publisher2019Volume) else (set _sku!cc!=Publisher2019Volume)
  603. set /a kk+=1
  604. set _pkey!kk!=G2KWX-3NW6P-PY93R-JXK2T-C9Y9V
  605. )
  606. if %_SkypeForBusiness%==ON (
  607. set /a cc+=1
  608. if %winbuild% lss 10240 (set _sku!cc!=SkypeForBusinessRetail&set /a cc+=1&set _sku!cc!=SkypeForBusiness2019Volume) else (set _sku!cc!=SkypeForBusiness2019Volume)
  609. set /a kk+=1
  610. set _pkey!kk!=NCJ33-JHBBY-HTK98-MYCV8-HMKHJ
  611. )
  612. if %_Word%==ON (
  613. set /a cc+=1
  614. if %winbuild% lss 10240 (set _sku!cc!=WordRetail&set /a cc+=1&set _sku!cc!=Word2019Volume) else (set _sku!cc!=Word2019Volume)
  615. set /a kk+=1
  616. set _pkey!kk!=PBX3G-NWMT6-Q7XBW-PYJGG-WXD33
  617. )
  618. if %_OneNote%==ON (
  619. set /a cc+=1
  620. set _sku!cc!=OneNoteVolume
  621. set /a kk+=1
  622. set _pkey!kk!=DR92N-9HTF2-97XKM-XW2WJ-XW3J6
  623. )
  624. if %_PrjPro%==ON (
  625. set /a cc+=1
  626. if %winbuild% lss 10240 (set _sku!cc!=ProjectProRetail&set /a cc+=1&set _sku!cc!=ProjectPro2019Volume) else (set _sku!cc!=ProjectPro2019Volume)
  627. set /a kk+=1
  628. set _pkey!kk!=B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B
  629. ) else if %_PrjStd%==ON (
  630. set /a cc+=1
  631. if %winbuild% lss 10240 (set _sku!cc!=ProjectStdRetail&set /a cc+=1&set _sku!cc!=ProjectStd2019Volume) else (set _sku!cc!=ProjectStd2019Volume)
  632. set /a kk+=1
  633. set _pkey!kk!=C4F7P-NCP8C-6CQPT-MQHV9-JXD2M
  634. )
  635. if %_VisPro%==ON (
  636. set /a cc+=1
  637. if %winbuild% lss 10240 (set _sku!cc!=VisioProRetail&set /a cc+=1&set _sku!cc!=VisioPro2019Volume) else (set _sku!cc!=VisioPro2019Volume)
  638. set /a kk+=1
  639. set _pkey!kk!=9BGNQ-K37YR-RQHF2-38RQ3-7VCBB
  640. ) else if %_VisStd%==ON (
  641. set /a cc+=1
  642. if %winbuild% lss 10240 (set _sku!cc!=VisioStdRetail&set /a cc+=1&set _sku!cc!=VisioStd2019Volume) else (set _sku!cc!=VisioStd2019Volume)
  643. set /a kk+=1
  644. set _pkey!kk!=7TQNQ-K3YQQ-3PFH7-CCPPM-X4VQ2
  645. )
  646. goto :MenuChannel
  647.  
  648. :MenuExclude
  649. cls
  650. echo %line%
  651. echo Source  : "!CTRsource!"
  652. echo Version : %CTRver% / Arch: %CTRarc% / Lang: %CTRlng%
  653. if defined _suit2 (
  654.   if /i not "%_suit2%"=="MondoVolume" (echo Suite   : %_suit2%) else (echo Suite   : %_suite%)
  655. ) else (
  656.   echo Suite   : %_suite%
  657. )
  658. echo %line%
  659. echo Select Apps to include ^(OFF ^= exclude^):
  660. echo.
  661. if %_Std%==OFF echo. A. Access           : %_Access%
  662. echo. E. Excel            : %_Excel%
  663. echo. N. OneNote          : %_OneNote%
  664. echo. O. Outlook          : %_Outlook%
  665. echo. P. PowerPoint       : %_PowerPoint%
  666. echo. R. Publisher        : %_Publisher%
  667. if %_Std%==OFF echo. S. SkypeForBusiness : %_Lync%
  668. echo. W. Word             : %_Word%
  669. if %_Mondo%==ON (
  670. echo. J. Project          : %_Project%
  671. echo. V. Visio            : %_Visio%
  672. )
  673. echo. D. OneDrive Desktop : %_OneDrive%
  674. echo %line%
  675. choice /c AENOPRSWJVD90X /n /m "Change a menu option, press 0 to proceed, 9 to go back, or X to exit: "
  676. if errorlevel 14 goto :eof
  677. if errorlevel 13 goto :MenuExclude2
  678. if errorlevel 12 goto :MenuSuite
  679. if errorlevel 11 (if %_OneDrive%==ON (set _OneDrive=OFF) else (set _OneDrive=ON))&goto :MenuExclude
  680. if errorlevel 10 if %_Mondo%==ON (if %_Visio%==ON (set _Visio=OFF) else (set _Visio=ON))&goto :MenuExclude
  681. if errorlevel 9 if %_Mondo%==ON (if %_Project%==ON (set _Project=OFF) else (set _Project=ON))&goto :MenuExclude
  682. if errorlevel 8 (if %_Word%==ON (set _Word=OFF) else (set _Word=ON))&goto :MenuExclude
  683. if errorlevel 7 if %_Std%==OFF (if %_Lync%==ON (set _Lync=OFF) else (set _Lync=ON))&goto :MenuExclude
  684. if errorlevel 6 (if %_Publisher%==ON (set _Publisher=OFF) else (set _Publisher=ON))&goto :MenuExclude
  685. if errorlevel 5 (if %_PowerPoint%==ON (set _PowerPoint=OFF) else (set _PowerPoint=ON))&goto :MenuExclude
  686. if errorlevel 4 (if %_Outlook%==ON (set _Outlook=OFF) else (set _Outlook=ON))&goto :MenuExclude
  687. if errorlevel 3 (if %_OneNote%==ON (set _OneNote=OFF) else (set _OneNote=ON))&goto :MenuExclude
  688. if errorlevel 2 (if %_Excel%==ON (set _Excel=OFF) else (set _Excel=ON))&goto :MenuExclude
  689. if errorlevel 1 if %_Std%==OFF (if %_Access%==ON (set _Access=OFF) else (set _Access=ON))&goto :MenuExclude
  690. goto :MenuExclude
  691.  
  692. :MenuExclude2
  693. set "_excluded=Groove"
  694. for %%J in (Access,Excel,OneDrive,OneNote,Outlook,PowerPoint,Project,Publisher,Lync,Visio,Word) do (
  695. if !_%%J!==OFF set "_excluded=!_excluded!,%%J"
  696. )
  697. goto :MenuChannel
  698.  
  699. :MenuChannel
  700. set "inpt="
  701. set "CTRffn="
  702. set "CTRchn="
  703. cls
  704. echo %line%
  705. echo Source  : "!CTRsource!"
  706. echo Version : %CTRver% / Arch: %CTRarc% / Lang: %CTRlng%
  707. echo %line%
  708. echo Select Update Channel:
  709. echo.
  710. echo. 0. Default
  711. echo. 1. Insiders                            ^|   Insiders::DevMain
  712. echo. 2. Monthly / Targeted                  ^|   Insiders::CC
  713. echo. 3. Monthly                             ^| Production::CC
  714. echo. 4. Semi-Annual / Targeted              ^|   Insiders::FRDC
  715. echo. 5. Semi-Annual                         ^| Production::DC
  716. echo. 6. Perpetual2019 VL / Targeted         ^|   Insiders::LTSC
  717. echo. 7. Perpetual2019 VL                    ^| Production::LTSC
  718. echo.
  719. echo. D. DevMain Channel                     ^|    Dogfood::DevMain
  720. echo. E. Microsoft Elite                     ^|  Microsoft::DevMain
  721. echo %line%
  722. choice /c 1234567DE09X /n /m "Choose a menu option to proceed, press 9 to go back, or X to exit: "
  723. if errorlevel 12 goto :eof
  724. if errorlevel 11 (if defined _retsuite (goto :MenuSuite) else (goto :MenuApps))
  725. if errorlevel 10 (set inpt=0&goto :MenuChannel2)
  726. if errorlevel 9 (set inpt=9&goto :MenuChannel2)
  727. if errorlevel 8 (set inpt=8&goto :MenuChannel2)
  728. if errorlevel 7 (set inpt=7&goto :MenuChannel2)
  729. if errorlevel 6 (set inpt=6&goto :MenuChannel2)
  730. if errorlevel 5 (set inpt=5&goto :MenuChannel2)
  731. if errorlevel 4 (set inpt=4&goto :MenuChannel2)
  732. if errorlevel 3 (set inpt=3&goto :MenuChannel2)
  733. if errorlevel 2 (set inpt=2&goto :MenuChannel2)
  734. if errorlevel 1 (set inpt=1&goto :MenuChannel2)
  735. goto :MenuChannel
  736.  
  737. :MenuChannel2
  738. if %inpt%==0 (
  739. expand.exe -f:*.xml "!CTRsource!\Office\Data\%CTRvcab%" "!_tempdir!" >nul
  740. for /f "tokens=3 delims=<= " %%# in ('findstr /i DeliveryMechanism "!_tempdir!\VersionDescriptor.xml" 2^>nul') do set "FFNRoot=%%~#"
  741. if "!FFNRoot!" neq "" for /l %%J in (1,1,9) do (
  742.   if /i !FFNRoot! equ !ffn%%J! set inpt=%%J
  743.   )
  744. if "!FFNRoot!" equ "" set inpt=3
  745. del /f /q "!_tempdir!\*.xml" 1>nul 2>nul
  746. )
  747. set "CTRffn=!ffn%inpt%!"
  748. set "CTRchn=!chn%inpt%!"
  749. set "_products="
  750. set "_licenses="
  751. set "_exclude1d="
  752. set "_keys="
  753. set "_skus="
  754. set "_show="
  755. set "_tmp="
  756. if defined _suite (
  757. set "_products=%_suite%.16_%CTRlng%_x-none"
  758. set "_keys=%_pkey0%"
  759. )
  760. if defined _suit2 set "_licenses=%_suit2%"
  761. if not defined _sku1 goto :MenuMisc
  762. for /l %%J in (1,1,%cc%) do (
  763. if defined _skus (set "_skus=!_skus!,!_sku%%J!") else (set "_skus=!_sku%%J!")
  764. )
  765. for /l %%J in (1,1,%kk%) do (
  766. if defined _keys (set "_keys=!_keys!,!_pkey%%J!") else (set "_keys=!_pkey%%J!")
  767. )
  768. for %%J in (%_skus%) do (
  769. set _tmp=%%J
  770. if /i "!_tmp:~-6!"=="Volume" (
  771.   if defined _show (set "_show=!_show!,%%J") else (set "_show=%%J")
  772.   )
  773. if /i "!_tmp:~-6!"=="Volume" if %winbuild% lss 10240 (
  774.   if defined _licenses (set "_licenses=!_licenses!,%%J") else (set "_licenses=%%J")
  775.   )
  776. if /i "!_tmp:~-6!"=="Volume" if %winbuild% geq 10240 (
  777.   if defined _products (set "_products=!_products!^|%%J.16_%CTRlng%_x-none") else (set "_products=%%J.16_%CTRlng%_x-none")
  778.   if %_OneDrive%==OFF (if defined _exclude1d (set "_exclude1d=!_exclude1d! %%J.excludedapps.16=onedrive") else (set "_exclude1d=%%J.excludedapps.16=onedrive"))
  779.   )
  780. if /i "!_tmp:~-6!"=="Retail" (
  781.   if defined _products (set "_products=!_products!^|%%J.16_%CTRlng%_x-none") else (set "_products=%%J.16_%CTRlng%_x-none")
  782.   if %_OneDrive%==OFF (if defined _exclude1d (set "_exclude1d=!_exclude1d! %%J.excludedapps.16=onedrive") else (set "_exclude1d=%%J.excludedapps.16=onedrive"))
  783.   )
  784. )
  785. goto :MenuMisc
  786.  
  787. :MenuMisc
  788. cls
  789. echo %line%
  790. echo Source  : "!CTRsource!"
  791. echo Version : %CTRver% / Arch: %CTRarc% / Lang: %CTRlng%
  792. echo Channel : %CTRchn%
  793. echo CDN     : %CTRffn%
  794. echo %line%
  795. echo Miscellaneous Options:
  796. echo.
  797. echo. 1. Updates Enabled     : %_updt%
  798. echo. 2. Accept EULA         : %_eula%
  799. echo. 3. Pin Icons To Taskbar: %_icon%
  800. echo. 4. Force App Shutdown  : %_shut%
  801. echo. 5. Display Level       : %_disp%
  802. echo. 6. Auto Activate       : %_actv%
  803. echo. 7. Disable Telemetry   : %_tele%
  804. echo %line%
  805. choice /c 123456790X /n /m "Change a menu option, press 0 to proceed, 9 to go back, or X to exit: "
  806. if errorlevel 10 goto :eof
  807. if errorlevel 9 goto :MenuFinal
  808. if errorlevel 8 goto :MenuChannel
  809. if errorlevel 7 (if %_tele%==True (set _tele=False) else (set _tele=True))&goto :MenuMisc
  810. if errorlevel 6 (if %_actv%==True (set _actv=False) else (set _actv=True))&goto :MenuMisc
  811. if errorlevel 5 (if %_disp%==True (set _disp=False) else (set _disp=True))&goto :MenuMisc
  812. if errorlevel 4 (if %_shut%==True (set _shut=False) else (set _shut=True))&goto :MenuMisc
  813. if errorlevel 3 (if %_icon%==True (set _icon=False) else (set _icon=True))&goto :MenuMisc
  814. if errorlevel 2 (if %_eula%==True (set _eula=False) else (set _eula=True))&goto :MenuMisc
  815. if errorlevel 1 (if %_updt%==True (set _updt=False) else (set _updt=True))&goto :MenuMisc
  816. goto :MenuMisc
  817.  
  818. :MenuFinal
  819. set _install=False
  820. set _unattend=False
  821. cls
  822. echo %line%
  823. echo Source  : "!CTRsource!"
  824. echo Version : %CTRver% / Arch: %CTRarc% / Lang: %CTRlng%
  825. echo Channel : %CTRchn%
  826. echo CDN     : %CTRffn%
  827. if defined _suite (
  828. if defined _suit2 (
  829.   if /i not "%_suit2%"=="MondoVolume" (echo Suite   : %_suit2%) else (echo Suite   : %_suite%)
  830.   ) else (
  831.   echo Suite   : %_suite%
  832.   )
  833. )
  834. if defined _skus echo SKUs    : %_show%
  835. if defined _excluded echo Excluded: %_excluded%
  836. echo Updates : %_updt% / AcceptEULA : %_eula% / Display : %_disp%
  837. echo PinIcons: %_icon% / AppShutdown: %_shut% / Activate: %_actv%
  838. echo %line%
  839. echo.
  840. echo. 1. Install Now
  841. echo. 2. Create setup configuration ^(Normal Install^)
  842. echo. 3. Create setup configuration ^(Auto Install^)
  843. echo.
  844. echo %line%
  845. choice /c 1239X /n /m "Choose a menu option to proceed, press 9 to go back, or X to exit: "
  846. if errorlevel 5 goto :eof
  847. if errorlevel 4 goto :MenuMisc
  848. if errorlevel 3 (set _unattend=True&goto :MenuFinal2)
  849. if errorlevel 2 (set _unattend=False&goto :MenuFinal2)
  850. if errorlevel 1 (set _install=True&goto :MenuFinal2)
  851. goto :MenuFinal
  852.  
  853. :MenuFinal2
  854. cls
  855. set "MyDate="
  856. for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x
  857. copy /y nul "!_workdir!\#.rw" 1>nul 2>nul && (
  858. if exist "!_workdir!\#.rw" del /f /q "!_workdir!\#.rw"
  859. ) || (
  860. set "_inipath=%SystemDrive%\Users\Public\Desktop"
  861. )
  862.  
  863. (
  864. echo [configuration]
  865. echo SourcePath="!CTRsource!"
  866. echo Type=%CTRtype%
  867. echo Version=%CTRver%
  868. echo Architecture=%CTRarc%
  869. echo O32W64=%wow64%
  870. echo Language=%CTRlng%
  871. echo LCID=%CTRcul%
  872. if defined CTRprm echo Primary=%CTRstp%,%CTRprm%
  873. echo Channel=%CTRchn%
  874. echo CDN=%CTRffn%
  875. if defined _suite (
  876. echo Suite=%_suite%
  877. if defined _suit2 echo Suite2=%_suit2%
  878. echo ExcludedApps=%_excluded%
  879. )
  880. if defined _skus (
  881. echo SKUs=%_skus%
  882. if not defined _suite if %_OneDrive%==OFF echo ExcludedApps=OneDrive
  883. )
  884. echo UpdatesEnabled=%_updt%
  885. echo AcceptEULA=%_eula%
  886. echo PinIconsToTaskbar=%_icon%
  887. echo ForceAppShutdown=%_shut%
  888. echo DisplayLevel=%_disp%
  889. echo AutoActivate=%_actv%
  890. echo DisableTelemetry=%_tele%
  891. echo AutoInstallation=%_unattend%
  892. )>"!_inipath!\C2R_Config_%MyDate:~0,8%-%MyDate:~8,4%.ini" 2>nul
  893.  
  894. if %_install%==False (
  895. echo %line%
  896. echo Done
  897. echo %line%
  898. echo.
  899. echo Press any key to exit.
  900. pause >nul
  901. goto :eof
  902. )
  903.  
  904. :MenuInstall
  905. echo %line%
  906. echo Preparing...
  907. echo %line%
  908. echo.
  909. if defined _suite (
  910. for %%# in (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) do set _excluded=!_excluded:%%#=%%#!
  911. )
  912. if %_actv%==True (set "_autoact=autoactivate=1"&set "_activate=Activate=1") else (set "_autoact="&set "_activate=")
  913. set "_CTR=HKLM\SOFTWARE\Microsoft\Office\ClickToRun"
  914. set "_Config=%_CTR%\Configuration"
  915. set "_url=http://officecdn.microsoft.com/pr"
  916.  
  917. (
  918. echo @echo off
  919. echo reg.exe query "HKU\S-1-5-19" 1^>nul 2^>nul ^|^| ^(echo Run the script as administrator^&pause^&exit /b^)
  920. echo reg.exe delete %_Config% /f /v UpdateUrl 1^>nul 2^>nul
  921. echo reg.exe delete %_Config% /f /v UpdateToVersion 1^>nul 2^>nul
  922. echo reg.exe delete %_CTR%\Updates /f /v UpdateToVersion 1^>nul 2^>nul
  923. echo reg.exe delete HKLM\SOFTWARE\Policies\Microsoft\Office\16.0\Common\OfficeUpdate /f 1^>nul 2^>nul
  924. echo start "" /WAIT "%%CommonProgramFiles%%\Microsoft Shared\ClickToRun\OfficeClickToRun.exe" ^^
  925. echo deliverymechanism=%CTRffn% platform=%CTRarc% culture=%CTRstp% b= displaylevel=%_disp% ^^
  926. echo forceappshutdown=%_shut% piniconstotaskbar=%_icon% acceptalleulas.16=%_eula% ^^
  927. echo updatesenabled.16=%_updt% updatepromptuser=True ^^
  928. echo updatebaseurl.16=%_url%/%CTRffn% ^^
  929. echo cdnbaseurl.16=%_url%/%CTRffn% ^^
  930. echo mediatype.16=%CTRtype% sourcetype.16=%CTRtype% version.16=%CTRver% ^^
  931. echo baseurl.16="!CTRsource!" ^^^^
  932. echo productstoadd="%_products%" ^^
  933. if %winbuild% geq 10240 echo pidkeys=%_keys% %_autoact% ^^
  934. if defined _suite echo %_suite%.excludedapps.16=%_excluded% ^^
  935. if defined _exclude1d echo %_exclude1d% ^^
  936. echo flt.useexptransportinplacepl=disabled flt.useofficehelperaddon=disabled flt.useoutlookshareaddon=disabled 1^>nul 2^>nul
  937. echo reg.exe add %_Config% /f /v UpdateChannel /t REG_SZ /d "%_url%/%CTRffn%" 1^>nul 2^>nul
  938. echo reg.exe add %_Config% /f /v UpdateChannelChanged /t REG_SZ /d True 1^>nul 2^>nul
  939. echo exit /b
  940. )>"!_tempdir!\C2R_Setup.bat"
  941.  
  942. set "CTRexe=1"
  943. if exist "!_file!" for /f "tokens=2-5 delims==." %%i in ('wmic datafile where "name='!_file:\=\\!'" get Version /value') do (
  944.   if %%i%%j%%k%%l geq %CTRver:.=% (set CTRexe=0)
  945. )
  946. call :StopService 1>nul 2>nul
  947. if %CTRexe%==1 (
  948. if exist "!_target!" rd /s /q "!_target!" 1>nul 2>nul
  949. md "!_target!" 1>nul 2>nul
  950. expand -f:* "!CTRsource!\Office\Data\%CTRver%\%CTRicab%" "!_target!" 1>nul 2>nul
  951. expand -f:* "!CTRsource!\Office\Data\%CTRver%\%CTRicabr%" "!_target!" 1>nul 2>nul
  952. )
  953. echo.
  954. echo %line%
  955. echo Running installation...
  956. echo %line%
  957. echo.
  958. del /f /q "%windir%\temp\*.log" 1>nul 2>nul
  959. del /f /q "!_tempdir!\*.log" 1>nul 2>nul
  960. !_ComSpec! /c ""!_tempdir!\C2R_Setup.bat" "
  961. del /f /q "!_tempdir!\C2R_Setup.bat" 1>nul 2>nul
  962. if not exist "!_Program!\Microsoft Office\root\Office16\*.dll" if not exist "%ProgramFiles(x86)%\Microsoft Office\root\Office16\*.dll" (
  963. echo.
  964. echo %line%
  965. echo Installation failed.
  966. echo %line%
  967. echo.
  968. echo Press any key to exit.
  969. pause >nul
  970. goto :eof
  971. )
  972. if defined _licenses (
  973. echo.
  974. echo %line%
  975. echo Installing Volume Licenses...
  976. echo %line%
  977. echo.
  978. call :Licenses 1>nul 2>nul
  979. )
  980. if %_tele%==True (
  981. if defined _suit2 (
  982.   if /i not "%_suit2%"=="MondoVolume" call :Telemetry 1>nul 2>nul
  983.   ) else (
  984.   call :Telemetry 1>nul 2>nul
  985.   )
  986. )
  987. echo.
  988. echo %line%
  989. echo Done.
  990. echo %line%
  991. echo.
  992. echo Press any key to exit.
  993. pause >nul
  994. taskkill /t /f /IM OfficeC2RClient.exe 1>nul 2>nul
  995. goto :eof
  996.  
  997. :StopService
  998. sc query WSearch | find /i "STOPPED" || net stop WSearch /y
  999. sc query WSearch | find /i "STOPPED" || sc stop WSearch
  1000. if exist "!_file!" (
  1001. sc query ClickToRunSvc | find /i "STOPPED" || net stop ClickToRunSvc /y
  1002. sc query ClickToRunSvc | find /i "STOPPED" || sc stop ClickToRunSvc
  1003. taskkill /t /f /IM OfficeC2RClient.exe
  1004. taskkill /t /f /IM OfficeClickToRun.exe
  1005. )
  1006. exit /b
  1007.  
  1008. :Licenses
  1009. for /f "skip=2 tokens=2*" %%A in ('reg query %_CTR% /v InstallPath') do set "_Root=%%B\root"
  1010. for /f "skip=2 tokens=2*" %%A in ('reg query %_CTR% /v PackageGUID') do set "_GUID=%%B"
  1011. for %%J in (%_licenses%) do (
  1012. if defined _ids (set "_ids=!_ids!,%%J.16") else (set "_ids=%%J.16")
  1013. reg delete %_Config% /f /v %%J.OSPPReady
  1014. )
  1015. "!_Root!\integration\integrator.exe" /I /License PRIDName=%_ids% PidKey=%_keys% %_activate% PackageGUID="%_GUID%" PackageRoot="!_Root!"
  1016. for %%J in (%_licenses%) do (
  1017. reg query %_Config% /v ProductReleaseIds | findstr /I "%%J" || (for /f "skip=2 tokens=2*" %%A in ('reg query %_Config% /v ProductReleaseIds') do reg add %_Config% /f /v ProductReleaseIds /t REG_SZ /d "%%J,%%B")
  1018. reg add %_Config% /f /v %%J.OSPPReady /t REG_SZ /d 1
  1019. )
  1020. exit /b
  1021.  
  1022. :Telemetry
  1023. if %wow64%==1 (set "_inter=Software\Wow6432Node") else (set "_inter=Software")
  1024. set "_rkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings"
  1025. set "_skey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\16.0"
  1026. set "_tkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry"
  1027. for %%# in (Count,Order) do reg add "%_rkey%" /f /v %%# /t REG_DWORD /d 1
  1028. for %%# in (DisableTelemetry,SendTelemetry) do reg add "%_tkey%" /f /v %%# /t REG_DWORD /d 1
  1029. for %%# in (qmenable,sendcustomerdata,updatereliabilitydata) do reg add "%_skey%\Common" /f /v %%# /t REG_DWORD /d 0
  1030. for %%# in (disableboottoofficestart,optindisable,shownfirstrunoptin,ShownFileFmtPrompt) do reg add "%_skey%\Common\General" /f /v %%# /t REG_DWORD /d 1
  1031. for %%# in (BootedRTM,disablemovie) do reg add "%_skey%\Firstrun" /f /v %%# /t REG_DWORD /d 1
  1032. for %%# in (EnableLogging,EnableUpload) do reg add "%_skey%\OSM" /f /v %%# /t REG_DWORD /d 0
  1033. for %%# in (accesssolution,olksolution,onenotesolution,pptsolution,projectsolution,publishersolution,visiosolution,wdsolution,xlsolution) do reg add "%_skey%\OSM\PreventedApplications" /f /v %%# /t REG_DWORD /d 1
  1034. for %%# in (agave,appaddins,comaddins,documentfiles,templatefiles) do reg add "%_skey%\OSM\PreventedSolutiontypes" /f /v %%# /t REG_DWORD /d 1
  1035. reg add "%_skey%\Common\Security\FileValidation" /f /v disablereporting /t REG_DWORD /d 1
  1036. reg add "%_skey%\Common\PTWatson" /f /v PTWOptIn /t REG_DWORD /d 0
  1037. reg add "%_skey%\Lync" /f /v disableautomaticsendtracing /t REG_DWORD /d 1
  1038. reg add "%_skey%\Outlook\Options\Mail" /f /v EnableLogging /t REG_DWORD /d 0
  1039. reg add "%_skey%\Word\Options" /f /v EnableLogging /t REG_DWORD /d 0
  1040. set "_schtasks=SCHTASKS /Change /DISABLE /TN"
  1041. set "_schedule=Microsoft\Office"
  1042. %_schtasks% "%_schedule%\OfficeInventoryAgentFallBack"
  1043. %_schtasks% "%_schedule%\OfficeTelemetryAgentFallBack"
  1044. %_schtasks% "%_schedule%\OfficeTelemetryAgentFallBack2016"
  1045. %_schtasks% "%_schedule%\OfficeInventoryAgentLogOn"
  1046. %_schtasks% "%_schedule%\OfficeTelemetryAgentLogOn"
  1047. %_schtasks% "%_schedule%\OfficeTelemetryAgentLogOn2016"
  1048. exit /b
  1049.  
  1050. :E_Admin
  1051. echo ==== ERROR ====
  1052. echo Right click on this script and select 'Run as administrator'
  1053. echo.
  1054. echo Press any key to exit...
  1055. pause >nul
  1056. goto :eof
  1057.  
  1058. :E_Win
  1059. echo ==== ERROR ====
  1060. echo Windows 7 SP1 is the minimum supported OS.
  1061. echo.
  1062. echo Press any key to exit...
  1063. pause >nul
  1064. goto :eof
Add Comment
Please, Sign In to add comment