From 53d9c95a8cd46bbd36e8d66e6e10705865ec6af7 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Fri, 17 Jan 2020 06:47:17 +0100 Subject: [PATCH] install: provide a basic uninstall script for Windows --- Makefile | 1 + UNINSTALL.bat | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 UNINSTALL.bat diff --git a/Makefile b/Makefile index 67b9b9d9..54da3fed 100644 --- a/Makefile +++ b/Makefile @@ -513,6 +513,7 @@ dist-win: modulecmd.tcl ChangeLog README version.inc pkgdoc cp doc/build/modulefile.txt $(DIST_WIN_PREFIX)/doc/ $(MAKE) -C init dist-win DIST_WIN_PREFIX=../$(DIST_WIN_PREFIX) cp INSTALL.bat $(DIST_WIN_PREFIX)/ + cp UNINSTALL.bat $(DIST_WIN_PREFIX)/ zip -r $(DIST_WIN_PREFIX).zip $(DIST_WIN_PREFIX) rm -rf $(DIST_WIN_PREFIX) diff --git a/UNINSTALL.bat b/UNINSTALL.bat new file mode 100644 index 00000000..29a4a4da --- /dev/null +++ b/UNINSTALL.bat @@ -0,0 +1,21 @@ +@echo off + +:: installation path can be passed as argument +if [%1]==[] ( + set "installpath=%ProgramFiles%\Environment Modules" +) else ( + set "installpath=%1" +) + +:: remove bin directory from system path +set "binpath=%installpath%\bin" +setlocal enableextensions enabledelayedexpansion +setx /M PATH "!PATH:%binpath%;=!" +if errorlevel 1 ( exit /b 1 ) + +:: remove installation directory and content +rd /s /q "%installpath%" +:: quit on error if directory still exists +if exist "%installpath%" ( exit /b 2 ) + +:: vim:set tabstop=3 shiftwidth=3 expandtab autoindent: