@Echo Off&&title ★ office2007 sp3 四合一绿色精简版 ★
cls
color 4a
mode con: cols=65 lines=10
set folder=%~dp0
pushd "%~dp0"
ver | find "5.0." > NUL && goto menu
ver | find "5.1." > NUL && goto menu
ver | find "5.2." > NUL && goto menu
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (goto UAC) else ( goto Administrator )
:UAC
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /b
:Administrator
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
:menu
pushd "%CD%"
CD /D "%~dp0"
echo.
echo ----------------- 2015.1.20 by xb21cn ---------------
echo.
echo                  正在安装请稍候..........
echo.
set "HKLMU=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion"
rem x64
reg query %HKLMU%\SideBySide\Winners\x86_microsoft.vc80.atl_1fc8b3b9a1e18e3b_none_bcab4e08946f6004>nul 2>nul&&goto instx
reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{710f4c1c-cc18-4c49-8cbf-51240c89a1a2}>nul 2>nul&&goto instx
rem x86
reg query %HKLMU%\Uninstall\{A49F249F-0C91-497F-86DF-B2585E8E76B7}>nul 2>nul&&goto instx
reg query %HKLMU%\Uninstall\{7299052B-02A4-4627-81F2-1818DA5D550D}>nul 2>nul&&goto instx
reg query %HKLMU%\Uninstall\{837b34e3-7c30-493c-8f6a-2b0f04e2912c}>nul 2>nul&&goto instx
start /wait vc05x86.exe /q
:instx
set route=%cd%
set route=%route:\=\\%
cd.>test.dat
for /f "tokens=1* delims=:" %%i in ('findstr /n .* OFFICE.DAT') do (
    set "var=%%j"
setlocal enabledelayedexpansion
    if not "!var!"=="" set "var=!var:D:\\OFFICE2007=%route%!"
    >>test.dat echo.!var!
endlocal
)

mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\Word 2007.lnk""):b.TargetPath=""%CD%\WINWORD.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")&SET E=完成!
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\Excel 2007.lnk""):b.TargetPath=""%CD%\EXCEL.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")&SET E=完成!
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\PowerPnt2007.lnk""):b.TargetPath=""%CD%\POWERPNT.EXE"":b.WorkingDirectory=""%~dp0"":b.Save:close")&SET E=完成!
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\Access2007.lnk""):b.TargetPath=""%CD%\MSACCESS.EXE"":b.WorkingDirectory=""%~dp0"":b.Save:close")&SET E=完成!

IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto x86
regedit /s test.dat
goto regdll
:x86
set jg=
set mb=\Wow6432Node
for /f "tokens=1* delims=:" %%i in ('findstr /n .* test.dat') do (
    set "str=%%j"
setlocal enabledelayedexpansion
    if not "!str!"=="" set "str=!str:%mb%=%jg%!"
    echo.!str!>>tmp.dat
endlocal
)
regedit /s tmp.dat
del tmp.dat
:regdll
del test.dat
REGSVR32 /s ADDINS\MSADDNDR.DLL
REGSVR32 /s ADDINS\SYMINPUT.DLL
REGSVR32 /s msxml5.dll
REGSVR32 /s VBE6.DLL
REGSVR32 /s OART.DLL
REGSVR32 /s 2052\TBLHEAD.DLL
REGSVR32 /s TCSCCONV.DLL
REGSVR32 /s FM20.DLL
REGSVR32 /s MenuFor2007.dll
REGSVR32 /s ACEDAO.DLL
REGSVR32 /s "%CommonProgramFiles%\Microsoft Shared\DAO\Dao360.dll"
REGSVR32 /s "%CommonProgramFiles%\system\ado\Msado15.dll"
if not EXIST "%APPDATA%\Microsoft\Document Building Blocks" md "%APPDATA%\Microsoft\Document Building Blocks"
copy page.dotx "%APPDATA%\Microsoft\Document Building Blocks\Building Blocks.dotx" /y
if EXIST "C:\Program Files (x86)" (md "%ProgramFiles(x86)%\Common Files\microsoft shared\OFFICE12"&copy MSO.DLL "%ProgramFiles(x86)%\Common Files\microsoft shared\OFFICE12" /y&copy EXP_*.DLL "%ProgramFiles(x86)%\Common Files\microsoft shared\OFFICE12" /y)
exit
