-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.bat
55 lines (48 loc) · 1.27 KB
/
run.bat
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
@echo off
setlocal
:: Check if the shell is PowerShell
powershell -command "if ($Host.Name -eq 'ConsoleHost') { exit 0 } else { exit 1 }"
if %errorlevel%==0 (
echo Running in PowerShell
powershell -command "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force"
) else (
echo Running in Command Prompt
)
:: Check if Python is installed
python --version >nul 2>&1
if errorlevel 1 (
echo Python is not installed. Please install Python.
pause
exit /b 1
)
:: Check if virtual environment exists and activate it
if exist venv\Scripts\activate.bat (
call venv\Scripts\activate
) else (
echo Virtual environment does not exist.
choice /M "Do you want to set up a virtual environment? (Y/N)"
if errorlevel 2 (
echo Exiting without virtual environment.
pause
exit /b 1
) else (
python -m venv venv
call venv\Scripts\activate
)
)
:: Check if selenium is installed
python -c "import selenium" 2>nul
if errorlevel 1 (
echo Selenium is not installed. Installing requirements...
pip install -r requirements.txt
)
:: Navigate to src directory and run main Python script
cd src || (
echo "Failed to change directory to src."
pause
exit /b 1
)
echo Running main.py
python main.py
pause
endlocal