-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.bat
More file actions
58 lines (50 loc) · 1.54 KB
/
Copy pathuninstall.bat
File metadata and controls
58 lines (50 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@echo off
setlocal EnableDelayedExpansion
:: InterfaceX Uninstaller
:: Removes files and PATH entry
echo.
echo ============================================
echo InterfaceX - Uninstaller
echo ============================================
echo.
set "INSTALL_DIR=%LOCALAPPDATA%\InterfaceX"
:: Check if installed
if not exist "%INSTALL_DIR%\interfacex.bat" (
echo InterfaceX is not installed.
echo Nothing to do.
pause
exit /b 0
)
:: Confirm
set /p CONFIRM=" Remove InterfaceX? This will delete all presets. [Y/n]: "
if /i "!CONFIRM!" == "n" (
echo Uninstall cancelled.
pause
exit /b 0
)
:: Remove directory
echo Removing files...
rmdir /s /q "%INSTALL_DIR%" 2>nul
if exist "%INSTALL_DIR%" (
echo [WARN] Could not fully remove %INSTALL_DIR%
echo Some files may be in use. Try closing all terminals first.
) else (
echo [OK] Files removed.
)
:: Remove from PATH
echo Cleaning PATH...
powershell -NoProfile -Command ^
"$userPath = [Environment]::GetEnvironmentVariable('Path', 'User');" ^
"$installDir = '%INSTALL_DIR%';" ^
"$paths = $userPath -split ';' | Where-Object { $_ -ne '' -and $_.TrimEnd('\') -ne $installDir.TrimEnd('\') };" ^
"$newPath = $paths -join ';';" ^
"[Environment]::SetEnvironmentVariable('Path', $newPath, 'User');" ^
"Write-Host ' [OK] PATH cleaned.'"
echo.
echo ============================================
echo InterfaceX has been uninstalled.
echo ============================================
echo.
echo Open a new terminal for PATH changes to take effect.
echo.
pause