|
| 1 | +@echo off |
| 2 | +setlocal EnableExtensions |
| 3 | + |
| 4 | +set "DRYRUN=0" |
| 5 | +if /I "%~1"=="/dry-run" set "DRYRUN=1" |
| 6 | +if /I "%~1"=="--dry-run" set "DRYRUN=1" |
| 7 | + |
| 8 | +set "FAILURES=0" |
| 9 | + |
| 10 | +echo ====================================================== |
| 11 | +echo ThreadPilot Uninstall Utility |
| 12 | +echo ====================================================== |
| 13 | +echo. |
| 14 | + |
| 15 | +if "%DRYRUN%"=="1" ( |
| 16 | + echo Running in DRY-RUN mode. No changes will be made. |
| 17 | + echo. |
| 18 | +) else ( |
| 19 | + set /p CONFIRM=Proceed with uninstall? [Y/N]: |
| 20 | + if /I not "%CONFIRM%"=="Y" ( |
| 21 | + echo Uninstall cancelled. |
| 22 | + goto :finish |
| 23 | + ) |
| 24 | +) |
| 25 | + |
| 26 | +echo [STEP] Remove ThreadPilot services |
| 27 | +if "%DRYRUN%"=="1" ( |
| 28 | + echo [DRY-RUN] Would stop and delete services matching ThreadPilot* |
| 29 | +) else ( |
| 30 | + powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-Service -ErrorAction SilentlyContinue | Where-Object { $_.Name -like 'ThreadPilot*' -or $_.DisplayName -like 'ThreadPilot*' } | ForEach-Object { try { if ($_.Status -ne 'Stopped') { Stop-Service -Name $_.Name -Force -ErrorAction SilentlyContinue }; sc.exe delete $_.Name | Out-Null } catch { } }" >nul 2>&1 |
| 31 | + if errorlevel 1 ( |
| 32 | + set /a FAILURES+=1 |
| 33 | + echo [WARN] Service cleanup reported errors |
| 34 | + ) else ( |
| 35 | + echo [OK] Service cleanup complete |
| 36 | + ) |
| 37 | +) |
| 38 | + |
| 39 | +echo [STEP] Remove scheduled tasks |
| 40 | +if "%DRYRUN%"=="1" ( |
| 41 | + echo [DRY-RUN] Would remove scheduled tasks matching ThreadPilot* |
| 42 | +) else ( |
| 43 | + powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-ScheduledTask -TaskName 'ThreadPilot*' -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$false -ErrorAction SilentlyContinue" >nul 2>&1 |
| 44 | + schtasks /Delete /TN "ThreadPilot_Startup" /F >nul 2>&1 |
| 45 | + echo [OK] Scheduled task cleanup complete |
| 46 | +) |
| 47 | + |
| 48 | +echo [STEP] Remove autorun and application registry keys |
| 49 | +if "%DRYRUN%"=="1" ( |
| 50 | + echo [DRY-RUN] Would remove HKCU and HKLM ThreadPilot registry keys |
| 51 | +) else ( |
| 52 | + reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "ThreadPilot" /f >nul 2>&1 |
| 53 | + reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "ThreadPilot" /f >nul 2>&1 |
| 54 | + reg delete "HKCU\Software\ThreadPilot" /f >nul 2>&1 |
| 55 | + reg delete "HKLM\Software\ThreadPilot" /f >nul 2>&1 |
| 56 | + reg delete "HKLM\Software\WOW6432Node\ThreadPilot" /f >nul 2>&1 |
| 57 | + echo [OK] Registry cleanup complete |
| 58 | +) |
| 59 | + |
| 60 | +echo [STEP] Remove Windows Firewall rules |
| 61 | +if "%DRYRUN%"=="1" ( |
| 62 | + echo [DRY-RUN] Would remove firewall rules named ThreadPilot and ThreadPilot* |
| 63 | +) else ( |
| 64 | + netsh advfirewall firewall delete rule name="ThreadPilot" >nul 2>&1 |
| 65 | + netsh advfirewall firewall delete rule name="ThreadPilot*" >nul 2>&1 |
| 66 | + echo [OK] Firewall cleanup complete |
| 67 | +) |
| 68 | + |
| 69 | +echo [STEP] Remove MSIX installations |
| 70 | +if "%DRYRUN%"=="1" ( |
| 71 | + echo [DRY-RUN] Would remove installed and provisioned ThreadPilot MSIX packages |
| 72 | +) else ( |
| 73 | + powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-AppxPackage -AllUsers *ThreadPilot* -ErrorAction SilentlyContinue | ForEach-Object { Remove-AppxPackage -Package $_.PackageFullName -AllUsers -ErrorAction SilentlyContinue }" >nul 2>&1 |
| 74 | + powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -like '*ThreadPilot*' } | ForEach-Object { Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName -ErrorAction SilentlyContinue | Out-Null }" >nul 2>&1 |
| 75 | + echo [OK] MSIX cleanup complete |
| 76 | +) |
| 77 | + |
| 78 | +echo [STEP] Remove residual folders |
| 79 | +if "%DRYRUN%"=="1" ( |
| 80 | + echo [DRY-RUN] Would remove AppData, LocalAppData, ProgramData, and Program Files folders |
| 81 | +) else ( |
| 82 | + rd /s /q "%APPDATA%\ThreadPilot" >nul 2>&1 |
| 83 | + rd /s /q "%LOCALAPPDATA%\ThreadPilot" >nul 2>&1 |
| 84 | + rd /s /q "%PROGRAMDATA%\ThreadPilot" >nul 2>&1 |
| 85 | + rd /s /q "%ProgramFiles%\ThreadPilot" >nul 2>&1 |
| 86 | + rd /s /q "%ProgramFiles(x86)%\ThreadPilot" >nul 2>&1 |
| 87 | + for /d %%D in ("%LOCALAPPDATA%\Packages\PrimeBuild.ThreadPilot*") do rd /s /q "%%~fD" >nul 2>&1 |
| 88 | + echo [OK] Residual folder cleanup complete |
| 89 | +) |
| 90 | + |
| 91 | +echo [STEP] Remove shortcuts |
| 92 | +if "%DRYRUN%"=="1" ( |
| 93 | + echo [DRY-RUN] Would remove Start Menu and Desktop shortcuts |
| 94 | +) else ( |
| 95 | + del /f /q "%APPDATA%\Microsoft\Windows\Start Menu\Programs\ThreadPilot.lnk" >nul 2>&1 |
| 96 | + del /f /q "%PUBLIC%\Desktop\ThreadPilot.lnk" >nul 2>&1 |
| 97 | + del /f /q "%USERPROFILE%\Desktop\ThreadPilot.lnk" >nul 2>&1 |
| 98 | + echo [OK] Shortcut cleanup complete |
| 99 | +) |
| 100 | + |
| 101 | +echo. |
| 102 | +if "%FAILURES%"=="0" ( |
| 103 | + echo Uninstall completed successfully. |
| 104 | +) else ( |
| 105 | + echo Uninstall completed with %FAILURES% warning^(s^). Review output above. |
| 106 | +) |
| 107 | +echo ThreadPilot uninstall routine has finished. |
| 108 | +echo. |
| 109 | + |
| 110 | +:finish |
| 111 | +if "%DRYRUN%"=="1" goto :exit |
| 112 | +pause |
| 113 | + |
| 114 | +:exit |
| 115 | +exit /b 0 |
0 commit comments