-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRun.cmd
More file actions
89 lines (82 loc) · 2.14 KB
/
Copy pathRun.cmd
File metadata and controls
89 lines (82 loc) · 2.14 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@echo off
setlocal enabledelayedexpansion
:: Check if Python is installed
set "PYTHON_INSTALLED=1"
where python >nul 2>nul
if %errorlevel% neq 0 (
where py >nul 2>nul
if %errorlevel% neq 0 (
set "PYTHON_INSTALLED=0"
)
)
:: Check if Git is installed
set "GIT_INSTALLED=1"
where git >nul 2>nul
if %errorlevel% neq 0 (
set "GIT_INSTALLED=0"
)
:: If both are installed, run the script immediately
if %PYTHON_INSTALLED%==1 if %GIT_INSTALLED%==1 (
goto :RUN_SCRIPT
)
:: CASE 1: Both missing
if %PYTHON_INSTALLED%==0 if %GIT_INSTALLED%==0 (
echo ❌ Python and Git are not installed.
set /p install="Would you like to install both now? (y/n): "
if /i "!install!"=="y" (
echo Installing Python and Git...
winget install Python.Python.3 --silent
winget install Git.Git --silent
echo.
echo Please restart your terminal or computer so the new paths are recognized.
pause
exit /b
) else (
echo Cannot run script without Python and Git.
pause
exit /b
)
)
:: CASE 2: Python missing
if %PYTHON_INSTALLED%==0 (
echo ❌ Python is not installed.
set /p install="Would you like to install Python now? (y/n): "
if /i "!install!"=="y" (
echo Installing Python...
winget install Python.Python.3 --silent
echo.
echo Please restart your terminal or computer so Python is recognized.
pause
exit /b
) else (
echo Cannot run script without Python.
pause
exit /b
)
)
:: CASE 3: Git missing
if %GIT_INSTALLED%==0 (
echo ❌ Git is not installed.
set /p install="Would you like to install Git now? (y/n): "
if /i "!install!"=="y" (
echo Installing Git...
winget install Git.Git --silent
echo.
echo Please restart your terminal or computer so Git is recognized.
pause
exit /b
) else (
echo Cannot run script without Git.
pause
exit /b
)
)
:RUN_SCRIPT
:: Run Python using the available command
where py >nul 2>nul
if %errorlevel%==0 (
py GitRepoCloner.py
) else (
python GitRepoCloner.py
)
pause