@echo off
PUSHD %~dp0
cd /d "%~dp0"

rem ====¹«Ê½£º-Microsoft Equation 3.1

set xtext=xx64
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" set xtext=xx86

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equation" /f /ve /t REG_SZ /d "Microsoft Equation"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equation\CLSID" /f /ve /t REG_SZ /d "{0003000B-0000-0000-C000-000000000046}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equation\CurVer" /f /ve /t REG_SZ /d "Equation.3"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equation\NotInsertable" /f /ve /t REG_SZ /d ""
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equation.3" /f /ve /t REG_SZ /d "Microsoft Equation 3.1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equation.3\CLSID" /f /ve /t REG_SZ /d "{0002CE02-0000-0000-C000-000000000046}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equation.3\Insertable" /f /ve /t REG_SZ /d ""
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equations" /f /ve /t REG_SZ /d "Microsoft Equation"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equations\CLSID" /f /ve /t REG_SZ /d "{0002CE02-0000-0000-C000-000000000046}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equations\CurVer" /f /ve /t REG_SZ /d "Equation.3"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Equations\NotInsertable" /f /ve /t REG_SZ /d ""
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}" /f /ve /t REG_SZ /d "Microsoft Equation 3.1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\Conversion\Readable\Main" /f /ve /t REG_SZ /d "Equation,Equation.2,1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\DataFormats\GetSet\0" /f /ve /t REG_SZ /d "Document,1,1,3"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\DataFormats\GetSet\1" /f /ve /t REG_SZ /d "Embed_Source,1,8,1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\DataFormats\GetSet\2" /f /ve /t REG_SZ /d "1,1,1,3"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\DataFormats\GetSet\3" /f /ve /t REG_SZ /d "3,1,32,1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\DefaultIcon" /f /ve /t REG_SZ /d "%ProgramFiles%\Common Files\microsoft shared\EQUATION\EQNEDT32.exe,0"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\InProcHandler" /f /ve /t REG_SZ /d "ole2.dll"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\InprocHandler32" /f /ve /t REG_SZ /d "ole32.dll"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\ProgID" /f /ve /t REG_SZ /d "Equation.3"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\verb\0" /f /ve /t REG_SZ /d "&Edit,0,2"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\verb\1" /f /ve /t REG_SZ /d "&Open,0,2"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\VersionIndependentProgID" /f /ve /t REG_SZ /d "Equations"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0002CE02-0000-0000-C000-000000000046}\LocalServer32" /f /ve /t REG_SZ /d "%ProgramFiles%\Common Files\microsoft shared\EQUATION\EQNEDT32.EXE"

if /i not "%xtext%"=="xx86" goto aat
if not exist "%ProgramFiles%\Common Files\microsoft shared\EQUATION" md "%ProgramFiles%\Common Files\microsoft shared\EQUATION"
if not exist "%ProgramFiles%\Common Files\microsoft shared\EQUATION\EQNEDT32.EXE" copy "%CD%\EQUATION\EQNEDT32.EXE" "%ProgramFiles%\Common Files\microsoft shared\EQUATION"
if not exist "%ProgramFiles%\Common Files\microsoft shared\EQUATION\2052" md "%ProgramFiles%\Common Files\microsoft shared\EQUATION\2052"
if not exist "%ProgramFiles%\Common Files\microsoft shared\EQUATION\2052\EEINTL.DLL" copy "%CD%\EQUATION\2052\EEINTL.DLL" "%ProgramFiles%\Common Files\microsoft shared\EQUATION\2052"

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\1CF85317B34E1D111AF7000A9CA05BF0" /f /v "00002109E60090400000000000F01FEC" /t REG_SZ /d "%ProgramFiles%\Common Files\microsoft shared\EQUATION\1033\EEINTL.DLL"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\4901A44C2E196A343BC2142A62F4D1C6" /f /v "00002109E60040800000000000F01FEC" /t REG_SZ /d "%ProgramFiles%\Common Files\microsoft shared\EQUATION\2052\EEINTL.DLL"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\93AE92CC2CB71D119A12000A9CE1A22A" /f /v "00002109E60090400000000000F01FEC" /t REG_SZ /d "%ProgramFiles%\Common Files\microsoft shared\EQUATION\EQNEDT32.EXE"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\93AE92CC2CB71D119A12000A9CE1A22A" /f /v "00002109E60040800000000000F01FEC" /t REG_SZ /d "%ProgramFiles%\Common Files\microsoft shared\EQUATION\EQNEDT32.EXE"

:aat

if /i not "%xtext%"=="xx64" goto ddt
if not exist "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION" md "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION"
if not exist "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\EQNEDT32.EXE" copy "%CD%\EQUATION\EQNEDT32.EXE" "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION"
if not exist "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\2052" md "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\2052"
if not exist "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\2052\EEINTL.DLL" copy "%CD%\EQUATION\2052\EEINTL.DLL" "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\2052"

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\1CF85317B34E1D111AF7000A9CA05BF0" /f /v "00002109E60090400000000000F01FEC" /t REG_SZ /d "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\1033\EEINTL.DLL"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\4901A44C2E196A343BC2142A62F4D1C6" /f /v "00002109E60040800000000000F01FEC" /t REG_SZ /d "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\2052\EEINTL.DLL"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\93AE92CC2CB71D119A12000A9CE1A22A" /f /v "00002109E60090400000000000F01FEC" /t REG_SZ /d "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\EQNEDT32.EXE"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\93AE92CC2CB71D119A12000A9CE1A22A" /f /v "00002109E60040800000000000F01FEC" /t REG_SZ /d "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\EQNEDT32.EXE"

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}" /f /ve /t REG_SZ /d "Microsoft Equation 3.1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\Conversion\Readable\Main" /f /ve /t REG_SZ /d "Equation,Equation.2,1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\DataFormats\GetSet\0" /f /ve /t REG_SZ /d "Document,1,1,3"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\DataFormats\GetSet\1" /f /ve /t REG_SZ /d "Embed_Source,1,8,1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\DataFormats\GetSet\2" /f /ve /t REG_SZ /d "1,1,1,3"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\DataFormats\GetSet\3" /f /ve /t REG_SZ /d "3,1,32,1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\DefaultIcon" /f /ve /t REG_SZ /d "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\EQNEDT32.exe,0"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\InProcHandler" /f /ve /t REG_SZ /d "ole2.dll"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\InprocHandler32" /f /ve /t REG_SZ /d "ole32.dll"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\ProgID" /f /ve /t REG_SZ /d "Equation.3"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\verb\0" /f /ve /t REG_SZ /d "&Edit,0,2"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\verb\1" /f /ve /t REG_SZ /d "&Open,0,2"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\VersionIndependentProgID" /f /ve /t REG_SZ /d "Equations"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0002CE02-0000-0000-C000-000000000046}\LocalServer32" /f /ve /t REG_SZ /d "%ProgramFiles(x86)%\Common Files\microsoft shared\EQUATION\EQNEDT32.EXE"
:ddt
