Debian Codegraph @

script/INSTALL.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 :: create installation directory
11 md "%installpath%"
12 :: quit if directory not created
13 if not exist "%installpath%" ( exit /b 1 )
14
15 :: install files
16 xcopy /Y /S /F "%~dp0\*" "%installpath%\"
17 :: quit on error
18 if errorlevel 1 ( exit /b 2 )
19
20 :: add bin directory to system path if not done yet
21 set "binpath=%installpath%\bin"
22 set FIND=%SYSTEMROOT%\system32\find
23 echo %PATH% | %FIND% /i "%binpath:"=%">nul || set "NEWPATH=%binpath%;%PATH%"
24 if not "%NEWPATH%" == "" (
25 set "PATH=%NEWPATH%"
26 :: 'reg add' is used instead of 'setx /M' as the latter silently
27 :: truncates the value it persists to 1024 characters
28 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH /t REG_EXPAND_SZ /d "%NEWPATH%" /f
29 )
30 if errorlevel 1 ( exit /b 3 )
31
32 :: vim:set tabstop=3 shiftwidth=3 expandtab autoindent: