-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_networkmonitor.bat
More file actions
59 lines (49 loc) · 1.49 KB
/
run_networkmonitor.bat
File metadata and controls
59 lines (49 loc) · 1.49 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
@echo off
TITLE NetworkMonitor Debug Launcher
MODE CON: COLS=120 LINES=40
ECHO ========================================================
ECHO NetworkMonitor Debug Launcher
ECHO ========================================================
ECHO.
:: Check for admin privileges
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
ECHO Administrator privileges required!
ECHO Right-click on this batch file and select "Run as administrator"
PAUSE
EXIT /B 1
)
:: Set up the environment
SET PYTHONPATH=%~dp0
CD /D %~dp0
:: Activate virtual environment if it exists
IF EXIST "venv\Scripts\activate.bat" (
ECHO Activating virtual environment...
CALL venv\Scripts\activate.bat
) ELSE (
ECHO Virtual environment not found at venv\Scripts\activate.bat
ECHO Please ensure the virtual environment is set up correctly
PAUSE
EXIT /B 1
)
ECHO Running with administrator privileges
ECHO Logging to networkmonitor_debug_batch.log
ECHO.
:: Enable extended console output
SET PYTHONUNBUFFERED=1
SET PYTHONIOENCODING=UTF-8
:: Run the application with output going to both console and log file
python -u "%~dp0start_networkmonitor.py" 2>&1 | TEE networkmonitor_debug_batch.log
IF %ERRORLEVEL% NEQ 0 (
ECHO.
ECHO Application exited with error code: %ERRORLEVEL%
ECHO Check networkmonitor_debug_batch.log for details
TYPE networkmonitor_debug_batch.log
) ELSE (
ECHO Application exited successfully
)
:: Deactivate virtual environment
deactivate
ECHO.
ECHO Press any key to exit...
PAUSE >NUL