service.bat 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. @echo off && setlocal enabledelayedexpansion
  2. title 4dmega install
  3. color 0a
  4. echo ---Installation completed---
  5. set DATA_PATH=%1
  6. set USER_DATA=%DATA_PATH%\USER_DATA
  7. set MYSQL_HOME=%DATA_PATH%\mysql
  8. set TOOLS_HOME=%DATA_PATH%\tools
  9. set MONGODB_HOME=%DATA_PATH%\mongodb
  10. set appName=laser
  11. %MYSQL_HOME%\bin\mysql -P3307 -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'laser'";
  12. %MYSQL_HOME%\bin\mysql -P3307 -u root -plaser -e "CREATE DATABASE IF NOT EXISTS `laser` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ";
  13. echo start db tables
  14. if exist %USER_DATA%\lite.sql (
  15. echo "file exists"
  16. %MYSQL_HOME%\bin\mysql.exe -P3307 -u root -plaser laser < %USER_DATA%\lite.sql
  17. del %USER_DATA%\lite.sql
  18. ) else (
  19. if exist %MYSQL_HOME%\sqlfile\fdkk_laser.sql (
  20. echo "file exists"
  21. %MYSQL_HOME%\bin\mysql.exe -P3307 -u root -plaser laser < %MYSQL_HOME%\sqlfile\fdkk_laser.sql
  22. ) else (
  23. echo "file no exists"
  24. )
  25. )
  26. echo ---Installation mysql completed---
  27. if exist %USER_DATA%\mon\ (
  28. echo "file exists"
  29. %MONGODB_HOME%\bin\mongorestore.exe --host 127.0.0.1 --port 29031 --gzip %USER_DATA%\mon
  30. rd /s /q %USER_DATA%\mon
  31. ) else (
  32. echo "file no exists"
  33. %MONGODB_HOME%\bin\mongorestore.exe --host 127.0.0.1 --port 29031 --gzip %MONGODB_HOME%\script
  34. )
  35. rd /s /q %USER_DATA%
  36. rd /s /q "%APPDATA%\%appName%"
  37. ping -n 3 127.1>nul