@ECHO OFF & CD /D %~DP0 & TITLE
>NUL 2>&1 REG.exe query "HKU\S-1-5-19" || (
    ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
    ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
    "%TEMP%\Getadmin.vbs"
    DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL
    Exit /b
)

taskkill /f /im DTLite* >NUL 2>NUL
taskkill /f /im DiscSo* >NUL 2>NUL
taskkill /f /im DTLauncher* >NUL 2>NUL

::正在添加虚拟设备支持（我的电脑里->BD-ROM 驱动器）
start /wait /B "" "%~dp0DiscSoftBusServiceLite.exe" /service

reg add "HKLM\SOFTWARE\Disc Soft\DAEMON Tools Lite" /v Path /d "%~dp0\" /F>NUL
::默认设置简体中文
reg add "HKCU\Software\Disc Soft\DAEMON Tools Lite\View" /v Language /t REG_DWORD /d 2052 /F>NUL
::取消默认开机自启动
reg add "HKCU\Software\Disc Soft\DAEMON Tools Lite\Config" /v Autostart /t REG_DWORD /d 0 /F>NUL
::默认不最小化到托盘
reg add "HKCU\Software\Disc Soft\DAEMON Tools Lite\Config" /v UseTrayAgent /t REG_DWORD /d 0 /F>NUL
::跳过启动引导动画
reg add "HKCU\Software\Disc Soft\DAEMON Tools Lite\Config" /v AppFirstRun /t REG_DWORD /d 0 /F>NUL
::自动预设免费许可
if exist "%Public%" md "%ProgramData%\DAEMON Tools Lite" 2>NUL
if not exist "%Public%" md "%AllUsersProfile%\Application Data\DAEMON Tools Lite" 2>NUL
if exist "%Public%" copy /y "license.dat" "%ProgramData%\DAEMON Tools Lite" >NUL 2>NUL
if not exist "%Public%" copy /y "license.dat" "%AllUsersProfile%\Application Data\DAEMON Tools Lite" >NUL 2>NUL

ECHO.&ECHO 绿化完成！创建快捷方式？
ECHO.&ECHO 是按任意键，否直接关闭！&PAUSE >NUL 2>NUL

mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\DAEMON Tools Lite.lnk""):b.TargetPath=""%~dp0DTLauncher.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")

CLS &ECHO.&ECHO 创建完成！&PAUSE >NUL 2>NUL & EXIT