-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-windows.bat
More file actions
42 lines (39 loc) · 1.66 KB
/
Copy pathstart-windows.bat
File metadata and controls
42 lines (39 loc) · 1.66 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
@echo off
rem IMAP Synchronizer launcher for Windows. Installs Python if missing, then runs the tool.
setlocal
cd /d "%~dp0"
rem Find a Python that actually runs. On a clean Windows, "python" may be the
rem Microsoft Store alias, which is found by "where" but only prints an error
rem (or opens the Store) when executed - so each candidate is test-run first.
set "PYCMD="
where py >nul 2>nul && set "PYCMD=py -3"
if defined PYCMD %PYCMD% -V >nul 2>nul || set "PYCMD="
if not defined PYCMD (
where python >nul 2>nul && set "PYCMD=python"
if defined PYCMD python -V >nul 2>nul || set "PYCMD="
)
if not defined PYCMD (
echo Python 3 was not found on this system.
where winget >nul 2>nul
if errorlevel 1 (
echo.
echo Downloading the official Python installer...
powershell -NoProfile -Command "[Net.ServicePointManager]::SecurityProtocol='Tls12'; Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.10/python-3.12.10-amd64.exe' -OutFile \"$env:TEMP\python-installer.exe\""
if errorlevel 1 (
echo Download failed. Please install Python 3 from https://www.python.org/downloads/
pause
exit /b 1
)
echo Installing Python 3 ^(this may take a minute^)...
"%TEMP%\python-installer.exe" /quiet InstallAllUsers=0 PrependPath=1 Include_test=0 Include_launcher=1
) else (
echo Installing Python 3 with winget...
winget install -e --id Python.Python.3.12 --accept-source-agreements --accept-package-agreements
)
echo.
echo Python installed. Please close this window and run this launcher again.
pause
exit /b 0
)
%PYCMD% imapsynchronizer.py
pause