-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.bat
More file actions
57 lines (49 loc) · 1.75 KB
/
uninstall.bat
File metadata and controls
57 lines (49 loc) · 1.75 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
:: Windows uninstaller script for PyNetDesign
:: This script removes associated Conda environments matching "pnd*"
:: Run: uninstall.bat from cmd
:: D. Anikiev, 2025-04-01
@echo off
set ENV_PATTERN=pnd
set ENV_FOUND=0
:: Check for Conda Installation
where conda >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo Conda is not installed or not found in the system PATH.
echo Please install Conda and make sure it's added to the system PATH.
pause
exit /b 1
)
:: Find environments matching the pattern "pnd*"
for /f "tokens=*" %%A in ('conda info --envs ^| findstr /r /c:"%ENV_PATTERN%.*"') do (
for /f "tokens=1" %%B in ("%%A") do (
set "ENV_NAME=%%B"
set "ENV_FOUND=1"
echo Found Conda environment: "%ENV_NAME%"
:: Ask user if they want to remove each environment
set /p CONFIRM="Do you want to remove environment %ENV_NAME%? (y/n): "
if /i "%CONFIRM%" == "y" (
:: Deactivate any active environment before removal
echo Deactivating any active Conda environment...
call conda deactivate
:: Remove the environment
echo Removing Conda environment %ENV_NAME%...
call conda remove -n %ENV_NAME% --all
if %ERRORLEVEL% equ 0 (
echo Conda environment %ENV_NAME% removed successfully.
) else (
echo Failed to remove Conda environment %ENV_NAME%. Please check the error messages above.
pause
exit /b 3
)
) else (
echo Skipping Conda environment %ENV_NAME%.
)
)
)
:: Check if no matching environments were found
if %ENV_FOUND% equ 0 (
echo No Conda environments matching "%ENV_PATTERN%*" were found.
) else (
echo Done!
)
pause