-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_in_autopilot_mode.bat
49 lines (40 loc) · 1.51 KB
/
run_in_autopilot_mode.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
@echo off
REM Check if python3 is available
python3 --version >nul 2>nul
if %errorlevel% equ 0 (
set PYTHON_COMMAND=python3
) else (
REM Search for python.exe in user's directory (AppData)
for /f "delims=" %%i in ('dir /b /s "%APPDATA%\Python\Python*" ^| findstr /i /r "python[.]exe$"') do (
set PYTHON_COMMAND=%%i
goto :found_python
)
REM Search for python.exe in Program Files directory
for /f "delims=" %%i in ('dir /b /s "C:\Program Files\Python*" ^| findstr /i /r "python[.]exe$"') do (
set PYTHON_COMMAND=%%i
goto :found_python
)
REM Search for python.exe in local programs directory (AppData)
for /f "delims=" %%i in ('dir /b /s "%LOCALAPPDATA%\Programs\Python\Python*" ^| findstr /i /r "python[.]exe$"') do (
set PYTHON_COMMAND=%%i
goto :found_python
)
REM If Python is not found, display error message and exit
echo Error: Python interpreter not found.
echo Please install Python and make sure it is added to the system PATH.
echo.
echo After your confirmation the script will stop and the console may be closed.
pause
exit /b 1
)
REM Label to jump to when Python is found
:found_python
REM If Python interpreter is found, continue with script execution
if defined PYTHON_COMMAND (
REM Execute the main Python script
%PYTHON_COMMAND% autopilot.py
)
REM Display message and wait for user input to close the console
echo.
echo After your confirmation the script will stop and the console may be closed.
pause