Welcome to FreeSoftwareServers Confluence Wiki

@ECHO OFF
CLS
setlocal ENABLEEXTENSIONS

set key="*0FF1CE*"
set threesixtyfivekey="O365*"
set keypath=

set arrsize=1
set arg[0]="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
set arg[1]="HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
for /l %%n in (0,1,%arrsize%) do (
 FOR /F "tokens=* USEBACKQ" %%N IN (`REG QUERY !arg[%%n]! /f %threesixtyfivekey% /k 2^>nul`) DO (
  ECHO "%%N" | FIND /I "HKEY">Nul && (
   If %%n == 0 (
    set arch=x32
   ) ELSE (
     set arch=x64
   )
   set keypath=%%N
   goto keypathFound
  ) 
 )
 FOR /F "tokens=* USEBACKQ" %%N IN (`REG QUERY !arg[%%n]! /f %key% /k 2^>nul`) DO (
  ECHO "%%N" | FIND /I "HKEY">Nul && ( 
   If %%n == 0 (
    set arch=x32
   ) ELSE (
     set arch=x64
   ) 
   set keypath=%%N
   goto keypathFound
  ) 
 )
)
GoTo end

:keypathFound
FOR /F "skip=2 tokens=1,2* USEBACKQ" %%N IN (`reg query "%keypath%" /t REG_SZ  /v "DisplayName"`) DO (
 IF /I "%%N" == "DisplayName" (
  SET OVer=%%P%~1
  GoTo Found
 )
)

:Found
for /f "tokens=1-20 delims=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$&*()-= " %%a in ("%OVer%") do (
   IF %%a == 64 (
     set ONum=%%b
     GoTo varset
   )
   IF %%a == 32 (
     set ONum=%%b
     GoTo varset
   )
   set ONum=%%a
)

:varset
  ::Echo Office Number: %ONum%
  ::ECHO Office Display Name:  %OVer%
  ::ECHO Software Architecture:  %arch%
::End

set batchpath=...\reg_edit.cmd"
set over=15.0
IF %ONum%==365 (
 set over=16.0
)
set regtype="REG_DWORD"
set addinname="PowerPointAddIn.ppam.ppa"

::Show-Addins in VBA Editor
call %batchpath% "HKCU\SOFTWARE\Microsoft\Office\%over%\PowerPoint\Options\" "DebugAddins" %regtype% 1

::Load-AddIn
call %batchpath% "HKCU\SOFTWARE\Microsoft\Office\%over%\PowerPoint\AddIns\PowerPointAddIn" "Path" "REG_SZ" %addinname%
call %batchpath% "HKCU\SOFTWARE\Microsoft\Office\%over%\PowerPoint\AddIns\PowerPointAddIn" "AutoLoad" %regtype% 1


::PAUSE
  • No labels