@echo off && setlocal enabledelayedexpansion title 4dmega install color 0a echo ---Installation java completed--- setx /M FDMGEA_HOME "%~dp0%\" setx /M JAVA_HOME "%~dp0%jdk1.8" setx /M MYSQL_HOME "%~dp0%mysql" setx /M REDIS_HOME "%~dp0%redis" setx /M 4DKK_HOME "%~dp0%CGAII" setx /M MONGODB_HOME "%~dp0%mongodb" setx /M CLASS_PATH "%%JAVA_HOME%%\lib\tools.jar;%%JAVA_HOME%%\lib\dt.jar" setx /M PATH "%PATH%;%%JAVA_HOME%%\bin;%%MYSQL_HOME%%\bin;%%MONGODB_HOME%%\bin;%%REDIS_HOME%%;%%4DKK_HOME%%;%%4DKK_HOME%%\lib;" echo ---Installation db start--- cd /d %~dp0 set basePath=%~dp0 set JAVA_HOME=%~dp0%jdk1.8 set MYSQL_HOME=%~dp0%mysql set REDIS_HOME=%~dp0%redis set MONGODB_HOME=%~dp0%mongodb set BIN_HOME=%~dp0%bin set USER_DATA=%~dp0USER_DATA echo start config mysql service echo %cd% if exist %MYSQL_HOME%\bin\mysqld.exe ( >%MYSQL_HOME%\my.ini echo [mysqld] >>%MYSQL_HOME%\my.ini echo port=3307 >>%MYSQL_HOME%\my.ini echo basedir= %MYSQL_HOME:\=\\% >>%MYSQL_HOME%\my.ini echo datadir= %MYSQL_HOME:\=\\%\\data >>%MYSQL_HOME%\my.ini echo log-error=%MYSQL_HOME:\=\\%\\logs.log >>%MYSQL_HOME%\my.ini echo max_connections=200 >>%MYSQL_HOME%\my.ini echo max_connect_errors=10 >>%MYSQL_HOME%\my.ini echo character-set-server=utf8mb4 >>%MYSQL_HOME%\my.ini echo default-storage-engine=INNODB >>%MYSQL_HOME%\my.ini echo default_authentication_plugin=mysql_native_password >>%MYSQL_HOME%\my.ini echo local_infile=ON >>%MYSQL_HOME%\my.ini echo. >>%MYSQL_HOME%\my.ini echo [mysql] >>%MYSQL_HOME%\my.ini echo default-character-set=utf8mb4 >>%MYSQL_HOME%\my.ini echo local_infile=ON >>%MYSQL_HOME%\my.ini echo [client] >>%MYSQL_HOME%\my.ini echo port=3307 >>%MYSQL_HOME%\my.ini echo default-character-set=utf8mb4 >>%MYSQL_HOME%\my.ini echo. %MYSQL_HOME%\bin\mysqld --initialize-insecure --lower-case-table-names=1 echo start install mysql %MYSQL_HOME%\bin\mysqld --install lasermysql | find "successfully" && echo successfully mysql echo. echo start mysql service net start lasermysql echo. %MYSQL_HOME%\bin\mysql -P3307 -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'laser'"; %MYSQL_HOME%\bin\mysql -P3307 -u root -plaser -e "CREATE DATABASE IF NOT EXISTS `laser` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci "; echo start db tables if exist %USER_DATA%\lite.sql ( echo "file exists" %MYSQL_HOME%\bin\mysql.exe -P3307 -u root -plaser laser < %USER_DATA%\lite.sql del %USER_DATA%\lite.sql ) else ( echo "file no exists" %MYSQL_HOME%\bin\mysql.exe -P3307 -u root -plaser laser < %MYSQL_HOME%\sqlfile\fdkk_laser.sql ) echo ---Installation mysql completed--- ) echo ---Installation redis start--- "%REDIS_HOME%\redis-server.exe" --service-install "%REDIS_HOME%\redis.windows.conf" --service-name laserredis --loglevel verbose net start laserredis sc config laserredis start=auto net stop laserredis net start laserredis echo ---Installation redis completed--- ping -n 3 127.1>nul echo ---Installation mongo start--- echo %cd% cd .> %MONGODB_HOME%\mongo.conf echo port=29031 >> %MONGODB_HOME%\mongo.conf echo dbpath=%MONGODB_HOME%\db >> %MONGODB_HOME%\mongo.conf echo logpath=%MONGODB_HOME%\logs\mongo.log >> %MONGODB_HOME%\mongo.conf echo logappend=true >> %MONGODB_HOME%\mongo.conf echo maxConns=1000 >> %MONGODB_HOME%\mongo.conf sc delete lasermongodb sc create lasermongodb binpath= "%MONGODB_HOME%\bin\mongod.exe --config %MONGODB_HOME%\mongo.conf --service" start= auto net start lasermongodb if exist %USER_DATA%\mon\ ( echo "file exists" %MONGODB_HOME%\bin\mongorestore.exe --host 127.0.0.1 --port 29031 --gzip %USER_DATA%\mon rd /s /q %USER_DATA%\mon ) echo ---Installation mongo completed--- echo ---Installation config start--- md %cd%\4DKK_PROGRAM_DATA\ md %cd%\4DKK_PROGRAM_STATIC\ echo ---Installation db completed--- if exist %USER_DATA%\static\ ( xcopy /y /s /f /h %USER_DATA%\static\* %basePath%4DKK_PROGRAM_STATIC rd /s /q %USER_DATA%\static ) if exist %USER_DATA%\pro\ ( xcopy /y /s /f /h %USER_DATA%\pro\* %basePath%4DKK_PROGRAM_DATA rd /s /q %USER_DATA%\pro ) cd .>%BIN_HOME%\resources\static\setting.json echo { > %BIN_HOME%\resources\static\setting.json echo "sceneConfig": "config.json", >> %BIN_HOME%\resources\static\setting.json echo "sceheKey": "id", >> %BIN_HOME%\resources\static\setting.json echo "sceneBundle": "./build.zip", >> %BIN_HOME%\resources\static\setting.json echo "sceneBundleDir": "capture", >> %BIN_HOME%\resources\static\setting.json echo "buildModelPath": "%basePath%4DKK_PROGRAM_DATA\", >> %BIN_HOME%\resources\static\setting.json echo "javaPort":9000, >> %BIN_HOME%\resources\static\setting.json echo "profilePath": "%basePath%4DKK_PROGRAM_STATIC\", >> %BIN_HOME%\resources\static\setting.json echo "buildCallPath": "%basePath%CGAII" , >> %BIN_HOME%\resources\static\setting.json echo "binPath": "%BIN_HOME%\resources\static" >> %BIN_HOME%\resources\static\setting.json echo } >> %BIN_HOME%\resources\static\setting.json set /a i=0 for /f "delims=" %%i in ('findstr /n .* %BIN_HOME%\resources\static\setting.json' ) do ( set "a=%%i" set "a=!a:*:=!" set "b=!a:\=\\!" echo.!b!>>%BIN_HOME%\resources\static\setting-b.json ) del %BIN_HOME%\resources\static\setting.json ren %BIN_HOME%\resources\static\setting-b.json setting.json echo ---Installation config completed--- echo ---Installation all completed--- rd /s /q %USER_DATA% ping -n 3 127.1>nul del %0