@echo off
set key="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Battery Status"
set dir="%ProgramFiles%\Battery Status"
set prg="%ProgramFiles%\Battery Status\BattStat.exe"
set ver="0.99"
if /i x%1 equ xinstall goto install
if /i x%1 equ xuninstall goto uninstall
echo usage: %0 {install/uninstall}
pause
goto:eof

:install
taskkill /F /IM BattStat.exe >NUL:
mkdir %dir%\scripts
copy /Y BattStat.exe %dir%
copy /Y BattStatLauncher.exe %dir%
copy /Y setup.bat %dir%
attrib +h +s %dir%\setup.bat
copy /Y sample.bat %dir%\scripts

reg add %key% /v InstallLocation /d \"%dir%\" /f
reg add %key% /v UninstallString /d \"%dir%\setup.bat\"" uninstall" /f
reg add %key% /v DisplayIcon /d \"%prg%\" /f
reg add %key% /v DisplayName /d "Battery Status" /f
reg add %key% /v DisplayVersion /d %ver% /f
reg add %key% /v Publisher /d "Tom Talpey" /f
reg add %key% /v Comments /d "Battery status and power monitor" /f
reg add %key% /v URLInfoAbout /d "http://users.rcn.com/tmtalpey/BattStat" /f
reg add %key% /v EstimatedSize /t reg_dword /d 380 /f
reg add %key% /v NoModify /t reg_dword /d 1 /f
reg add %key% /v NoRepair /t reg_dword /d 1 /f
wscript makeshortcut.vbs
start "" %prg% /s
goto:eof

:uninstall
taskkill /F /IM BattStat.exe >NUL:
reg delete HKEY_CURRENT_USER\Software\TMT /F
reg delete %key% /F
rmdir /Q /S %dir%
rmdir /Q /S %ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Battery Status
