-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.bat
More file actions
117 lines (108 loc) · 2.82 KB
/
run.bat
File metadata and controls
117 lines (108 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
@echo off
chcp 65001 >/dev/null 2>&1
title LAN Port Scanner - Auto Install
echo.
echo ========================================
echo LAN Port Scanner v1.0
echo Auto Install and Start
echo ========================================
echo.
REM Check Python installation
python --version >/dev/null 2>&1
if errorlevel 1 (
echo [ERROR] Python not detected
echo.
echo Please install Python 3.7 or higher
echo Download: https://www.python.org/downloads/
echo.
echo Make sure to check "Add Python to PATH" during installation
pause
exit /b 1
)
echo [OK] Python detected
python --version
echo.
REM Check if virtual environment exists
if not exist "venv" (
echo [INFO] First run, creating virtual environment...
python -m venv venv
if errorlevel 1 (
echo [ERROR] Failed to create virtual environment
echo.
echo Please ensure Python is fully installed with venv module
pause
exit /b 1
)
echo [OK] Virtual environment created
echo.
) else (
echo [OK] Virtual environment exists
echo.
)
REM Activate virtual environment
echo [INFO] Activating virtual environment...
call venv\Scripts\activate.bat
if errorlevel 1 (
echo [ERROR] Failed to activate virtual environment
pause
exit /b 1
)
echo [OK] Virtual environment activated
echo.
REM Check if dependencies are installed
python -c "import tabulate" >/dev/null 2>&1
if errorlevel 1 (
echo [INFO] Installing dependencies...
echo.
python -m pip install --upgrade pip
pip install -r requirements.txt
if errorlevel 1 (
echo.
echo [ERROR] Failed to install dependencies
echo.
echo Possible causes:
echo 1. Network connection issues
echo 2. Outdated pip version
echo 3. Insufficient permissions
echo.
echo Solutions:
echo 1. Check network connection
echo 2. Run: python -m pip install --upgrade pip
echo 3. Run this script as administrator
pause
exit /b 1
)
echo.
echo [OK] Dependencies installed
echo.
) else (
echo [OK] Dependencies already installed
echo.
)
REM Start application
echo ========================================
echo Starting GUI...
echo ========================================
echo.
python app.py
REM Check exit status
if errorlevel 1 (
echo.
echo ========================================
echo [ERROR] Application error
echo ========================================
echo.
echo Possible causes:
echo 1. Missing dependencies
echo 2. Incompatible Python version
echo 3. GUI environment issues
echo.
echo Solutions:
echo 1. Delete venv folder and run again
echo 2. Ensure Python 3.7+
echo 3. Try CLI mode: python cli.py --help
echo.
pause
)
REM Keep window open on error
if errorlevel 1 pause