@echo off
title IDM Activation
@setlocal DisableDelayedExpansion
fltmc >nul 2>&1 || (
  echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\GetAdmin.vbs"
  echo UAC.ShellExecute "%~fs0", "", "", "runas", 1 >> "%temp%\GetAdmin.vbs"
  cmd /u /c type "%temp%\GetAdmin.vbs">"%temp%\GetAdminUnicode.vbs"
  cscript //nologo "%temp%\GetAdminUnicode.vbs"
  del /f /q "%temp%\GetAdmin.vbs" >nul 2>&1
  del /f /q "%temp%\GetAdminUnicode.vbs" >nul 2>&1
  exit
)

tasklist /fi "IDMan.exe" |find ":" > nul
cls
if errorlevel 1 taskkill /f /im "IDMan.exe"

:CheckOS
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)

:64BIT
echo OS 64bit
del "%PROGRAMFILES(X86)%\Internet Download Manager\IDMan.exe"
Copy "%~dp0Jamu\IDMan.exe" "%PROGRAMFILES(x86)%\Internet Download Manager\IDMan.exe"

regedit /s "%~dp0Jamu\IDM_Reg_Reset.reg"
regedit /s "%~dp0Jamu\64bit.reg"
echo.
echo IDM Running...
start "" "%PROGRAMFILES(X86)%\Internet Download Manager\IDMan.exe"
GOTO END

:32BIT
echo OS 32bit
del "%PROGRAMFILES%\Internet Download Manager\IDMan.exe"
Copy "%~dp0Jamu\IDMan.exe" "%PROGRAMFILES%\Internet Download Manager\IDMan.exe"

regedit /s "%~dp0Jamu\IDM_Reg_Reset.reg"
regedit /s "%~dp0Jamu\32bit.reg"
echo.
echo IDM Running...
start "" "C:\Program Files\Internet Download Manager\IDMan.exe"
GOTO END

:END