START.BAT 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. @echo off
  2. chcp 65001 >nul
  3. setlocal enabledelayedexpansion
  4. echo ========================================
  5. echo Starting Auto Android Controller
  6. echo ========================================
  7. echo.
  8. REM Get the directory where this batch file is located
  9. cd /d "%~dp0"
  10. REM Check if npm is available
  11. echo [1/3] Checking npm...
  12. where npm >nul 2>&1
  13. if errorlevel 1 (
  14. echo Error: npm is not found in PATH
  15. echo.
  16. echo Please ensure Node.js is installed and npm is in your system PATH.
  17. echo You can download Node.js from: https://nodejs.org/
  18. echo.
  19. echo If Node.js is installed but npm is not in PATH, you may need to:
  20. echo 1. Restart your computer after installing Node.js
  21. echo 2. Or add Node.js to your system PATH manually
  22. echo.
  23. pause
  24. exit /b 1
  25. )
  26. echo npm is available
  27. echo.
  28. REM Check if node_modules exists and key dependencies are installed
  29. echo [2/3] Checking dependencies...
  30. if not exist "node_modules" (
  31. echo Warning: node_modules not found. Installing dependencies...
  32. call npm install
  33. if errorlevel 1 (
  34. echo Error: Failed to install dependencies
  35. pause
  36. exit /b 1
  37. )
  38. ) else (
  39. echo Dependencies directory found
  40. REM Check if key dependencies are properly installed
  41. set "NEED_REINSTALL=0"
  42. if not exist "node_modules\concurrently\dist\bin\concurrently.js" (
  43. echo Warning: concurrently module appears incomplete
  44. set "NEED_REINSTALL=1"
  45. )
  46. if not exist "node_modules\rxjs\dist\cjs\index.js" (
  47. echo Warning: rxjs module appears incomplete
  48. set "NEED_REINSTALL=1"
  49. )
  50. if not exist "node_modules\electron\package.json" (
  51. echo Warning: electron module appears incomplete
  52. set "NEED_REINSTALL=1"
  53. )
  54. if "!NEED_REINSTALL!"=="1" (
  55. echo Warning: Key dependencies appear incomplete. Reinstalling...
  56. call npm install
  57. if errorlevel 1 (
  58. echo Error: Failed to reinstall dependencies
  59. pause
  60. exit /b 1
  61. )
  62. echo Dependencies reinstalled successfully
  63. ) else (
  64. echo Dependencies verified
  65. )
  66. )
  67. echo.
  68. REM Start the application
  69. echo [3/3] Starting application...
  70. echo.
  71. call npm run electron:dev
  72. if errorlevel 1 (
  73. echo.
  74. echo Error: Failed to start application
  75. pause
  76. exit /b 1
  77. )