@echo off & color 1f & mode con cols=78 lines=15 & title 업데이트 정리 우클릭 메뉴 등록 & pushd "%~dp0"

net sess>nul 2>&1||(start mshta.exe vbscript:code(close(Execute("CreateObject(""Shell.Application"").ShellExecute""%~0"",,,""RunAs"",1"^)^)^)&exit)

echo.
echo.
echo. 
echo                      ==================================
echo                             우클릭 메뉴 등록 : 1
echo.                          
echo                             우클릭 메뉴 제거 : 2
echo                      ==================================
echo.
echo.
Set /p cmenu="선택:"

echo.
if /i "%cmenu%"=="1" (
xcopy "%~dp0"\UpdateClean %windir%\UpdateClean /yi > nul
reg add "HKCR\DesktopBackground\Shell\UpdateClean" /v "SubCommands" /d "UpdateClean\Script;UpdateClean\CompactOS" /f > nul
reg add "HKCR\DesktopBackground\Shell\UpdateClean" /v "MUIVerb" /d "업데이트 정리" /f > nul
reg add "HKCR\DesktopBackground\Shell\UpdateClean" /v "icon" /d "%windir%\UpdateClean\CleanIcon.ico" /f > nul
reg add "HKCR\DesktopBackground\Shell\UpdateClean" /v "Position" /d "bottom" /f > nul
reg add "HKCR\DesktopBackground\Shell\UpdateClean" /v "SeparatorBefore" /d "" /f > nul
reg add "HKCR\DesktopBackground\Shell\UpdateClean" /v "SeparatorAfter" /d "" /f > nul

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\Script" /v "" /d "업데이트 청소" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\Script" /v "icon" /d "cleanmgr.exe" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\Script\Command" /v "" /d "%windir%\UpdateClean\UpdateClean.bat" /f > nul

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS" /v "SubCommands" /d "UpdateClean\CompactOS\Status;UpdateClean\CompactOS\Compress;UpdateClean\CompactOS\Compress+;UpdateClean\CompactOS\Uncompress" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS" /v "MUIVerb" /d "업데이트후 시스템 압축" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS" /v "icon" /d "imageres.dll,226" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS" /v "CommandFlags" /t REG_DWORD /d "32" /f > nul

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Status" /v "" /d "시스템 압축 상태" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Status" /v "icon" /d "imageres.dll,205" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Status\Command" /v "" /d "cmd /s /k compact /compactos:query & color 1f" /f > nul

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Compress" /v "" /d "시스템 기본 압축" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Compress" /v "icon" /d "imageres.dll,166" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Compress\Command" /v "" /d "%windir%\UpdateClean\CompactAlways.bat" /f > nul

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Compress+" /v "" /d "시스템 +압축" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Compress+" /v "icon" /d "%windir%\UpdateClean\compact.ico" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Compress+\Command" /v "" /d "%windir%\UpdateClean\CompactOs.bat" /f > nul

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Uncompress" /v "" /d "시스템 압축 해제" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Uncompress" /v "icon" /d "shell32.dll,45" /f > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean\CompactOS\Uncompress\Command" /v "" /d "cmd /s /k compact /compactos:never & color 1f" /f > nul 
cls
echo.
echo.
echo.
echo.
echo                  우클릭 메뉴에 등록되었습니다.아무키나 누르세요 & pause > nul
exit
) else if /i "%cmenu%"=="2" ( 
reg delete "HKCR\DesktopBackground\Shell\UpdateClean" /f > nul
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\UpdateClean" /f > nul
rmdir /s /q "%windir%\UpdateClean" > nul
) else (echo waro)
cls
echo.
echo.
echo.
echo.
echo                       우클릭 메뉴에서 제거 되었습니다 & ping -n 3 127.0.0.1 >nul

