Skip to content

Commit

Permalink
Better install, uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
tommaier123 committed Jun 5, 2022
1 parent c826702 commit 5f4e880
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 10 deletions.
21 changes: 16 additions & 5 deletions Install/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@ goto check_Permissions

net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: Administrative permissions confirmed.
echo Success: Administrative permissions confirmed
) else (
echo Failure: Current permissions inadequate.
echo Failure: Current permissions inadequate. Run as Administrator
goto end
)

pause >nul

echo[
taskkill /IM "XBatteryStatus.exe" /F
timeout /T 1 /nobreak
timeout /T 1 /nobreak >nul
xcopy /s %~dp0\XBatteryStatus.exe "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp" /Y
start "" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\XBatteryStatus.exe"

if %errorLevel% == 0 (
echo[
echo Success: Installation successful
) else (
echo[
echo Failure: Installation unsuccessful
)

:end
pause
28 changes: 23 additions & 5 deletions Install/uninstall.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
@echo off

if not exist "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\XBatteryStatus.exe" (
echo Already uninstalled
goto end
)

goto check_Permissions

:check_Permissions
echo Administrative permissions required. Detecting permissions...

net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: Administrative permissions confirmed.
echo Success: Administrative permissions confirmed
) else (
echo Failure: Current permissions inadequate.
echo Failure: Current permissions inadequate. Run as Administrator
goto end
)

pause >nul
echo[

taskkill /IM "XBatteryStatus.exe" /F
timeout /T 1 /nobreak
del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\XBatteryStatus.exe" /Y
timeout /T 1 /nobreak >nul
del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\XBatteryStatus.exe"

if %errorLevel% == 0 (
echo[
echo Success: Uninstallation successful
) else (
echo[
echo Failure: Uninstallation unsuccessful
)

:end
pause

0 comments on commit 5f4e880

Please sign in to comment.