Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- title Initializing... please wait...
- setlocal EnableDelayedExpansion
- mode con:cols=105 lines=35
- color 07
- cls
- :init_paths
- REM Initialize paths
- cls
- set PATH_ROOT=%~dp0
- set PATH_DATA=data_test
- set PATH_BATS=%PATH_DATA%\bat
- set PATH_EXEC=%PATH_DATA%\exe
- set PATH_TEMP=%PATH_DATA%\tmp
- set SELF_VER0=v4.0
- set SELF_EXEC=update.exe
- set SELF_ZIPS=update.zip
- set BATS_OFFL=%PATH_DATA%\connect.bat
- set BATS_UPDA=%PATH_DATA%\update.bat
- set BATS_INIT=%PATH_BATS%\init.bat
- set BATS_VER0=%PATH_BATS%\ver.txt
- set BATS_ZIPS=%PATH_TEMP%\bat.zip
- set EXEC_UZIP=%PATH_EXEC%\unzip.exe
- set EXEC_WGET=%PATH_EXEC%\wget.exe
- set EXEC_VER0=%PATH_EXEC%\ver.txt
- set EXEC_ZIPS=%PATH_TEMP%\exe.zip
- set UPDA_SELF=1
- set UPDA_BATS=1
- set UPDA_EXEC=1
- if exist "%PATH_TEMP%" rmdir /S /Q "%PATH_TEMP%"
- if not exist "%PATH_DATA%" mkdir "%PATH_DATA%"
- if not exist "%PATH_BATS%" mkdir "%PATH_BATS%"
- if not exist "%PATH_EXEC%" mkdir "%PATH_EXEC%"
- if not exist "%PATH_TEMP%" mkdir "%PATH_TEMP%"
- if exist "%SELF_EXEC%" del /F /Q "%SELF_EXEC%" >nul
- if exist "%SELF_ZIPS%" del /F /Q "%SELF_ZIPS%" >nul
- move /Y "unzip.exe" "%EXEC_UZIP%"
- move /Y "wget.exe" "%EXEC_WGET%"
- :init_inet
- REM This is the url of the download server
- set DOWN_SERV=http://dmlizard.en-t.de/
- REM This value is to determine offline mode
- set OFFL_MODE=1
- REM Initialize internet access
- cls
- %EXEC_WGET% -q -O"%BATS_OFFL%" "%DOWN_SERV%/connect.bat"
- call %BATS_OFFL%
- del /F /Q %BATS_OFFL%
- if "%OFFL_MODE%"=="1" goto init_start
- :init_update
- REM Download latest bats and executables
- cls
- echo.
- %EXEC_WGET% -q -O"%BATS_UPDA%" "%DOWN_SERV%/update_test.bat"
- call %BATS_UPDA%
- if "%SELF_VER0%"=="%SELF_VER1%" set UPDA_SELF=0
- if exist "%BATS_VER0%" for /F "tokens=* delims=" %%i in ('type "%BATS_VER0%"') do (
- if "%%i"=="%BATS_VER1%" set UPDA_BATS=0
- )
- if exist "%EXEC_VER0%" for /F "tokens=* delims=" %%i in ('type "%EXEC_VER0%"') do (
- if "%%i"=="%EXEC_VER1%" set UPDA_EXEC=0
- )
- if "%UPDA_SELF%"=="1" (
- echo Updates for DMLizard available [%SELF_VER1%]...
- echo.
- echo Downloading newest DMLizard [%SELF_SIZE%]...
- %EXEC_WGET% -q -O"%SELF_ZIPS%" "%SELF_LINK%"
- echo Installing newest DMLizard...
- %EXEC_UZIP% -q -o "%SELF_ZIPS%"
- ping -n 2 127.0.0.1 >nul
- rmdir /S /Q "%PATH_DATA%" 2>nul >nul
- rmdir /S /Q "%PATH_DATA%" 2>nul >nul
- start "Update" "%SELF_EXEC%"
- exit
- )
- if "%UPDA_BATS%"=="1" (
- echo Updates for BAT files available [%BATS_VER1%]...
- echo.
- echo Downloading newest BAT files [%BATS_SIZE%]...
- %EXEC_WGET% -q -O"%BATS_ZIPS%" "%BATS_LINK%"
- echo Installing newest BAT files...
- %EXEC_UZIP% -q -o "%BATS_ZIPS%" -d "%PATH_BATS%"
- echo Updating BAT files done.
- echo.
- )
- if "%UPDA_EXEC%"=="1" (
- echo Updates for EXE files available [%EXEC_VER1%]...
- echo.
- echo Downloading newest EXE files [%EXEC_SIZE%]...
- %EXEC_WGET% -q -O"%EXEC_ZIPS%" "%EXEC_LINK%"
- echo Installing newest EXE files...
- %EXEC_UZIP% -q -o "%EXEC_ZIPS%" -d "%PATH_EXEC%"
- echo Updating EXE files done.
- echo.
- )
- if "%UPDA_BATS%"=="1" goto init_paths
- if "%UPDA_EXEC%"=="1" goto init_paths
- :init_start
- REM Calling init routine
- cls
- if not exist "%BATS_INIT%" goto init_fail
- call %BATS_INIT%
- exit
- :init_fail
- echo.
- echo Missing at least one required file. Please establish an internet connection and restart DMLizard.
- echo DMLizard will automatically download the required files then.
- echo.
- echo If nothing else helps, delete everything but the DMLizard executable and try again later.
- echo.
- pause
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement