-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmlviewer_wincon.bat
More file actions
executable file
·40 lines (34 loc) · 981 Bytes
/
mlviewer_wincon.bat
File metadata and controls
executable file
·40 lines (34 loc) · 981 Bytes
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
@echo off
REM Function to check Python version and set global variable
CALL :checkPythonVersion
IF "%PYTHON_CMD%"=="" (
echo Python 3.8 or higher is required.
exit /b 1
)
GOTO :main
:checkPythonVersion
python -c "import sys; sys.exit(0 if sys.version_info >= (3, 8) else 1);" >nul 2>&1
IF %ERRORLEVEL% == 0 SET PYTHON_CMD=python & GOTO :EOF
python3 -c "import sys; sys.exit(0 if sys.version_info >= (3, 8) else 1);" >nul 2>&1
IF %ERRORLEVEL% == 0 SET PYTHON_CMD=python3 & GOTO :EOF
SET PYTHON_CMD=
GOTO :EOF
:main
REM Check if the virtual environment already exists
IF NOT EXIST "venv" (
REM Create python virtual environment
%PYTHON_CMD% -m venv .\venv
REM Activate venv
.\venv\Scripts\activate.bat
REM Install requirements
pip install -r requirements.txt
REM Install capstone
pip install capstone
REM Run
%PYTHON_CMD% .\main.py
) ELSE (
REM Activate venv
.\venv\Scripts\activate.bat
REM Run
%PYTHON_CMD% .\main.py
)