Debian Codegraph @

script/UNINSTALL.bat

raw
1 @echo off
2
3 :: installation path can be passed as argument
4 if [%1]==[] (
5 set "installpath=%ProgramFiles%\Environment Modules"
6 ) else (
7 set "installpath=%1"
8 )
9
10 :: remove bin directory from system path
11 set "binpath=%installpath%\bin"
12 setlocal enableextensions enabledelayedexpansion
13 set "NEWPATH=!PATH:%binpath%;=!"
14 if not "%NEWPATH%" == "%PATH%" (
15 set "PATH=%NEWPATH%"
16 :: 'reg add' is used instead of 'setx /M' as the latter silently
17 :: truncates the value it persists to 1024 characters
18 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH /t REG_EXPAND_SZ /d "%NEWPATH%" /f
19 )
20 if errorlevel 1 ( exit /b 1 )
21
22 :: remove installation directory and content
23 rd /s /q "%installpath%"
24 :: quit on error if directory still exists
25 if exist "%installpath%" ( exit /b 2 )
26
27 :: vim:set tabstop=3 shiftwidth=3 expandtab autoindent: