echo off
title 绿化安装/卸载

echo %PROCESSOR_ARCHITECTURE% | findstr 64 > nul
@if ERRORLEVEL 1 (
    @set "PROGRAM_FILES86=%ProgramFiles%"
    @set "HKLM_SOFTWARE86=HKEY_LOCAL_MACHINE\SOFTWARE"
)else @if ERRORLEVEL 0 (
    @set "PROGRAM_FILES86=%ProgramFiles(x86)%"
    @set "HKLM_SOFTWARE86=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node"
)

:主菜单
color 1B
cls
echo.*-----------------------------------------------------------------------------*
echo * ***************************** 绿化安装/卸载 *********************************
echo.*-----------------------------------------------------------------------------*
echo.*    　　　　　　　　　                                                       *
echo.*         (1) 安装                                                            *
echo.*    　　　　　　　　　                                                       *
echo.*         (2) 卸载                                                            *
echo.*    　　　　　　　　　                                                       *
echo.*-----------------------------------------------------------------------------*
echo.* (A)安装  (U)卸载                                                   (X)退出  *
echo.*-----------------------------------------------------------------------------*
echo.*     请在管理员下运行...........                            (www.7down.net)  *
echo *******************************************************************************
SET /P runcd=   请输入（）中的数字键并按回车 :
if /I "%runcd%"=="1" goto Installation
if /I "%runcd%"=="2" goto Uninstallation
if /I "%runcd%"=="3" goto StartApplication
if /I "%runcd%"=="A" goto Installation
if /I "%runcd%"=="U" goto Uninstallation
if /I "%runcd%"=="UA" goto UninstallationAll
if /I "%runcd%"=="X" goto EX
goto 主菜单

:EX
exit

:StartApplication
start start Photoshop.exe
exit

:Installation
cls
color 1B
REG ADD "%HKLM_SOFTWARE86%\Adobe\Photoshop\8.0" /v "FreeBeforeSlopAdjust" /t REG_DWORD /d 0x75923000 /f
REG ADD "%HKLM_SOFTWARE86%\Adobe\Photoshop\8.0" /v "FreeSpace" /t REG_DWORD /d 0x35b67080 /f
REG ADD "%HKLM_SOFTWARE86%\Adobe\Photoshop\8.0\Registration" /v "PRODREG" /t REG_DWORD /d 0x65686669 /f

REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "DisplayVersion" /t REG_SZ /d "CS" /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "ProductID" /t REG_SZ /d "104505029715847152187925" /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "Serial" /t REG_SZ /d "911993041412716900173977" /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "Publisher" /t REG_SZ /d "Adobe Systems, Inc." /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "RegCompany" /t REG_SZ /d "Mokson" /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "RegOwner" /t REG_SZ /d "Mr. Mokson" /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "VersionMajor" /t REG_DWORD /d 0x00000008 /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "VersionMinor" /t REG_DWORD /d 0x00000000 /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "DisplayName" /t REG_SZ /d "CS" /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "DisplayIcon" /t REG_SZ /d "%cd%\Photoshop.exe,0" /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "Language" /t REG_SZ /d "zh_CN" /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "Version" /t REG_DWORD /d 0x08000000 /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "MajorVersion" /t REG_DWORD /d 0x00000008 /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "MinorVersion" /t REG_DWORD /d 0x00000000 /f
REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /v "LogMode" /t REG_DWORD /d 0x00000001 /f

@if not exist "%PROGRAM_FILES86%\Common Files\Adobe\Shell\psicon.dll" (
    @if not exist "%PROGRAM_FILES86%\Common Files\Adobe\Shell" (
        md "%PROGRAM_FILES86%\Common Files\Adobe\Shell"
    )
    copy psicon.dll "%PROGRAM_FILES86%\Common Files\Adobe\Shell\psicon.dll" /y
    
    REG ADD "HKCR\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}" /v "" /t REG_SZ /d "Photoshop Icon Handler" /f
    REG ADD "HKCR\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}\InProcServer32" /v "" /t REG_SZ /d "%PROGRAM_FILES86%\Common Files\Adobe\Shell\psicon.dll" /f
    REG ADD "HKCR\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}\InProcServer32" /v "ThreadingModel" /t REG_SZ /d "Apartment" /f

    REG ADD "HKCR\.psd" /v "" /t REG_SZ /d "Photoshop.Image.8" /f
    REG ADD "HKCR\.psd" /v "PreviousAssociation" /t REG_SZ /d "Photoshop.Image.8" /f
    REG ADD "HKCR\.psd\PersistentHandler" /v "" /t REG_SZ /d "{098f2470-bae0-11cd-b579-08002b30bfeb}" /f
    REG ADD "HKCR\.psd\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}" /v "" /t REG_SZ /d "{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}" /f

    REG ADD "%HKLM_SOFTWARE86%\Classes\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}" /v "" /t REG_SZ /d "Photoshop Icon Handler" /f
    REG ADD "%HKLM_SOFTWARE86%\Classes\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}\InProcServer32" /v "" /t REG_SZ /d "%PROGRAM_FILES86%\Common Files\Adobe\Shell\psicon.dll" /f
    REG ADD "%HKLM_SOFTWARE86%\Classes\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}\InProcServer32" /v "ThreadingModel" /t REG_SZ /d "Apartment" /f
    REG ADD "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\SharedDlls" /v "%PROGRAM_FILES86%\Common Files\Adobe\Shell\psicon.dll" /t REG_DWORD /d 0x00000001 /f
)

echo ***************************************************************************
echo.
echo     安装完成......
echo.
echo ***************************************************************************
start Photoshop.exe
exit

:Uninstallation
cls
color 1B
REG DELETE "%HKLM_SOFTWARE86%\Adobe\Photoshop\8.0" /f
REG DELETE "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /f
REG DELETE "%HKLM_SOFTWARE86%\Classes\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}" /f
REG DELETE "HKCU\Software\Adobe\Photoshop\8.0" /f

@if exist "%USERPROFILE%\AppData\Roaming\Adobe\Photoshop\8.0" (
    rd /q/s "%USERPROFILE%\AppData\Roaming\Adobe\Photoshop\8.0"
)
@if exist "%USERPROFILE%\Application Data\Adobe\Photoshop\8.0" (
    rd /q/s "%USERPROFILE%\Application Data\Adobe\Photoshop\8.0"
)
echo ***************************************************************************
echo.
echo     卸载完成......
echo.
echo ***************************************************************************
pause
exit

:UninstallationAll
cls
color 1B
REG DELETE "%HKLM_SOFTWARE86%\Adobe\Photoshop\8.0" /f
REG DELETE "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\Uninstall\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}" /f
REG DELETE "%HKLM_SOFTWARE86%\Classes\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}" /f

REG DELETE "%HKLM_SOFTWARE86%\Microsoft\Windows\CurrentVersion\SharedDlls" /v "%PROGRAM_FILES86%\Common Files\Adobe\Shell\psicon.dll" /f
REG DELETE "HKCU\Software\Adobe\Photoshop\8.0" /f
REG DELETE "HKCR\CLSID\{0B6DC6EE-C4FD-11d1-819A-00C04FB69B4D}" /f
REG DELETE "HKCR\.psd" /f
REG DELETE "HKCR\Applications\Photoshop.exe" /f
REG DELETE "HKCR\Photoshop.Application" /f
REG DELETE "HKCR\Photoshop.Application.8" /f
REG DELETE "HKCR\Photoshop.Image" /f
REG DELETE "HKCR\Photoshop.Image.8" /f
REG DELETE "HKCR\Photoshop.PlugIn" /f

@if exist "%USERPROFILE%\AppData\Roaming\Adobe\Photoshop\8.0" (
    rd /q/s "%USERPROFILE%\AppData\Roaming\Adobe\Photoshop\8.0"
)
@if exist "%USERPROFILE%\Application Data\Adobe\Photoshop\8.0" (
    rd /q/s "%USERPROFILE%\Application Data\Adobe\Photoshop\8.0"
)

@if exist "%PROGRAM_FILES86%\Common Files\Adobe\Shell\psicon.dll" (
    del /f "%PROGRAM_FILES86%\Common Files\Adobe\Shell\psicon.dll"
)
@if exist "%PROGRAM_FILES86%\Common Files\Adobe\Color" (
    rd /q/s "%PROGRAM_FILES86%\Common Files\Adobe\Color"
)
@if exist "%PROGRAM_FILES86%\Common Files\Adobe\Hyphenation" (
    rd /q/s "%PROGRAM_FILES86%\Common Files\Adobe\Hyphenation"
)
@if exist "%PROGRAM_FILES86%\Common Files\Adobe\TypeSpt" (
    rd /q/s "%PROGRAM_FILES86%\Common Files\Adobe\TypeSpt"
)
echo ***************************************************************************
echo.
echo     卸载完成......
echo.
echo ***************************************************************************
pause
exit