@echo off
PUSHD %~dp0
SET PATH=%PATH%;%CD%;%CD%\OSPP
SET "MSharedPATH=%CD%\MShared"
IF /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
    SET "ARCH=X64"
    SET "SYSPath=%SystemRoot%\sysWOW64"
) ELSE (
    SET "ARCH=X86"
    SET "SYSPath=%SystemRoot%\system32"
)
cls
echo.
echo   ÕýÔÚÐ¶ÔØ£¬ÇëÉÔµÈ¡­¡­¡­¡­
echo.
regedit /s "ospp\unist.dat"
copy "ospp\unist.dat" "%temp%\unist.dat" /y>nul
"%~dp0ospp\fr.exe" "%TEMP%\unist.dat" -fic:"\Wow6432Node" -t:""
regedit /s "%TEMP%\unist.dat"
del /f /q "%TEMP%\unist.dat"
REGSVR32 /u /s "%MSharedPATH%\Portal\PortalConnectCore.dll"
REGSVR32 /u /s "%MSharedPATH%\MSClientDataMgr\MSCDM.dll"
REGSVR32 /u /s "%MSharedPATH%\Office16\MSOXEV.dll"
REGSVR32 /u /s "%MSharedPATH%\Office16\msoshext.dll"
REGSVR32 /u /s "%MSharedPATH%\VBA\VBA7.1\VBE7.dll"
REGSVR32 /u /s "%CD%\Office16\Addins\OTKLOADR.dll"
REGSVR32 /u /s "%CD%\Office16\ACCWIZ.dll"
REGSVR32 /u /s "%CD%\Office16\CHART.DLL"
REGSVR32 /u /s "%CD%\Office16\IEAWSDC.dll"
REGSVR32 /u /s "%CD%\Office16\MSOEURO.dll"
REGSVR32 /u /s "%CD%\Office16\MSOHEV.dll"
REGSVR32 /u /s "%CD%\Office16\MSOHEVI.dll"
REGSVR32 /u /s "%CD%\Office16\MSRTEDIT.dll"
REGSVR32 /u /s "%CD%\Office16\REFEDIT.dll"
REGSVR32 /u /s "%CD%\Office16\NAME.dll"
REGSVR32 /u /s "%CD%\Office16\OSF.dll"
REGSVR32 /u /s "%CD%\Office16\MSADDNDR.dll"
REGSVR32 /u /s "%SYSPath%\FM20.DLL"
del /f /q "%SYSPath%\fm20.dll"
del /f /q "%SYSPath%\fm20chs.dll"
del /f /q "%SYSPath%\VEN2232.OLB"
del /f /q "%windir%\ShellNew\ACCESS.MDB"
del /f /q "%windir%\ShellNew\EXCEL.XLS"
del /f /q "%windir%\ShellNew\EXCEL12.XLSX"
del /f /q "%windir%\ShellNew\PWRPNT.PPT"
rd /s /q "%APPDATA%\Microsoft\Access"
rd /s /q "%APPDATA%\Microsoft\PowerPoint"
rd /s /q "%APPDATA%\Microsoft\Office"
rd /s /q "%APPDATA%\Microsoft\Excel"
rd /s /q "%APPDATA%\Microsoft\Word"
rd /s /q "%APPDATA%\Microsoft\Templates"
rd /s /q "%APPDATA%\Microsoft\AddIns"
rd /s /q "%APPDATA%\Microsoft\Proof"
rd /s /q "%APPDATA%\Microsoft\CLView"
rd /s /q "%APPDATA%\Microsoft\UProof"
rd /s /q "%APPDATA%\Microsoft\Bibliography"
rd /s /q "%APPDATA%\Microsoft\QuickStyles"
rd /s /q "%APPDATA%\Microsoft\Spelling"
rd /s /q "%APPDATA%\Microsoft\Document Building Blocks"
rd /s /q "%UserProfile%\AppData\Local\Microsoft\Office"
rd /s /q "%ProgramFiles(x86)%\Microsoft.NET\Primary Interop Assemblies"
rd /s /q "%ProgramFiles%\Microsoft.NET\Primary Interop Assemblies"
del /f /q "%USERPROFILE%\Desktop\Word 2016.lnk"
del /f /q "%USERPROFILE%\Desktop\excel 2016.lnk"
del /f /q "%USERPROFILE%\Desktop\PowerPnt2016.lnk"
del /f /q "%USERPROFILE%\Desktop\Access2016.lnk"
rd /s /q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Office 2016"
for /f "tokens=3" %%i in ('Reg Query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Desktop" ') do (set "ppath=%%~i")
del /f /q "%ppath%\Word 2016.lnk"
del /f /q "%ppath%\excel 2016.lnk"
del /f /q "%ppath%\PowerPnt2016.lnk"
del /f /q "%ppath%\Access2016.lnk"
echo [Version]>"%TEMP%\re.inf"
echo Signature="$CHICAGO$">>"%TEMP%\re.inf"
echo [Defaultinstall]>>"%TEMP%\re.inf"
RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 128 %TEMP%\re.inf
del /f /q "%TEMP%\re.inf"
ver|find "6.0." >NUL && goto delwin7
ver|find "6.1." >NUL && goto delwin7
exit
:delwin7
net stop osppsvc >nul 2>nul
sc delete osppsvc >nul 2>nul
net localgroup administrators "Network Service" /del >nul 2>nul
regsvr32 /u /s "%CommonProgramFiles%\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPWMI.dll"
regsvr32 /u /s "%CommonProgramFiles(x86)%\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPWMI.dll"
takeown /f "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat"
icacls "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat" /grant administrators:F /t
rd /s /q "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform"
rd /s /q "%CommonProgramFiles%\Microsoft Shared\OfficeSoftwareProtectionPlatform"
rd /s /q "%CommonProgramFiles(x86)%\Microsoft Shared\OfficeSoftwareProtectionPlatform"
exit
