-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAny Version Python Remove From Windows.bat
More file actions
52 lines (45 loc) · 1.76 KB
/
Any Version Python Remove From Windows.bat
File metadata and controls
52 lines (45 loc) · 1.76 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
@echo off
title Removing Python Completely...
echo ============================================
echo Python Complete Removal Script
echo ============================================
echo.
:: Stop Python related processes
echo Killing Python processes...
taskkill /F /IM python.exe >nul 2>&1
taskkill /F /IM python3.exe >nul 2>&1
taskkill /F /IM py.exe >nul 2>&1
:: Uninstall Python from Programs
echo Uninstalling Python from Installed Apps...
wmic product where "name like 'Python%%'" call uninstall /nointeractive >nul 2>&1
wmic product where "name like 'Python Launcher%%'" call uninstall /nointeractive >nul 2>&1
:: Delete common Python folders
echo Deleting Python folders...
rmdir /s /q "%LocalAppData%\Programs\Python" 2>nul
rmdir /s /q "%LocalAppData%\Python" 2>nul
rmdir /s /q "%AppData%\Python" 2>nul
rmdir /s /q "C:\Python27" 2>nul
rmdir /s /q "C:\Python37" 2>nul
rmdir /s /q "C:\Python38" 2>nul
rmdir /s /q "C:\Python39" 2>nul
rmdir /s /q "C:\Python310" 2>nul
rmdir /s /q "C:\Python311" 2>nul
rmdir /s /q "C:\Python312" 2>nul
rmdir /s /q "C:\Program Files\Python" 2>nul
rmdir /s /q "C:\Program Files (x86)\Python" 2>nul
:: Remove WindowsApps Python (Microsoft Store)
echo Removing Windows Store Python...
rmdir /s /q "%LocalAppData%\Microsoft\WindowsApps\Python*" 2>nul
:: Clean PATH variables
echo Cleaning PATH entries...
setx PATH "%PATH:Python=%" >nul
setx PATH "%PATH:py.exe=%" >nul
:: Remove python.exe shims from WindowsApps
del /f /q "%LocalAppData%\Microsoft\WindowsApps\python.exe" 2>nul
del /f /q "%LocalAppData%\Microsoft\WindowsApps\python3.exe" 2>nul
del /f /q "%LocalAppData%\Microsoft\WindowsApps\py.exe" 2>nul
echo.
echo ============================================
echo Python Has Been Completely Removed!
echo ============================================
pause