-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwas.cmd
113 lines (102 loc) · 2.95 KB
/
was.cmd
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@echo off
call :PrintLogo
goto :CheckAdmin
:CheckAdmin
net session >nul 2>&1
if %errorLevel% == 0 goto :CheckWinget
echo [91mIt looks like I wasn't launched with admin privileges[0m
echo [91mPlease relaunch setup using start.bat or run this script as administrator to continue.[0m
echo.
echo Press any key to exit...
pause>nul
exit 1
:CheckWinget
winget -v >nul 2>nul
if errorlevel 1 (
goto :WingetMissing
) else (
goto :CheckNode
)
:CheckNode
node -v >nul 2>nul
if errorlevel 1 (
goto :NodeMissing
) else (
goto :CheckModules
)
:CheckModules
if exist .\node_modules\ (
goto :LaunchSetup
) else (
goto :ModulesMissing
)
:WingetMissing
call :PrintLogo
echo [91mIt looks like the Windows Package Manager (WinGet) is not installed on this system.[0m
echo [93mWinGet is included in Windows 10 1709 and later, and is required to proceed with setup.[0m
echo.
echo [96mIf you need to install WinGet, you can do so from the link below.[0m
echo [1mhttps://github.com/microsoft/winget-cli[0m
echo.
echo Press any key to exit...
pause>nul
exit 1
:NodeMissing
call :PrintLogo
echo [91mIt appears that Node.js is not installed[0m
call :AskQuestion "[32mThis tool will install the latest release of Node.js in order to continue setup. Is this okay?[0m"
if "%AskResult%"=="Yes" goto :InstallNode
call :PrintLogo
echo [91mSetup cannot proceed without Node.js. Please install Node.js and try again.[0m
echo Press any key to exit...
pause>nul
exit 1
:ModulesMissing
call :PrintLogo
echo [91mDependency modules are missing.[0m
echo [32mFixing this automatically, please wait...[0m
echo.
call npm install
goto :CheckModules
:InstallNode
call :PrintLogo
echo [32mInstalling Node.js...[0m
echo.
winget install --accept-package-agreements --accept-source-agreements -e --id OpenJS.NodeJS
call .\scripts\RefreshEnv.cmd
goto :CheckNode
:LaunchSetup
call :PrintLogo
echo [32m[1mAll checks passed! Launching AutoWin Setup...[0m
timeout 1 > nul
node main.js
exit 0
:AskQuestion
setlocal
set "prompt=%~1"
:QuestionPrompt
set /P response="%prompt% (Y/N)? "
if /I "%response%" EQU "Y" (
endlocal & set "AskResult=Yes"
) else if /I "%response%" EQU "N" (
endlocal & set "AskResult=No"
) else (
call :PrintLogo
echo [91mThat answer is invalid. Please type Y or N to make a selection.[0m
goto :QuestionPrompt
)
goto :eof
:PrintLogo
title Paradox's AutoWin Setup
cls
setlocal
echo [96m[1m~~~ ParadoxEpoch's Auto Windows Setup ~~~[0m
echo [1m ___ _ _ _ _ __ __ _
echo / _ \__ _ _ __ __ _ __^| ^| _____ _( )__ /_\ _ _^| ^|_ ___/ / /\ \ (_)_ __
echo / /_)/ _` ^| '__/ _` ^|/ _` ^|/ _ \ \/ // __^| //_\\^| ^| ^| ^| __/ _ \ \/ \/ / ^| '_ \
echo / ___/ (_^| ^| ^| ^| (_^| ^| (_^| ^| (_) ^> ^< \__ \ / _ \ ^|_^| ^| ^|^| (_) \ /\ /^| ^| ^| ^| ^|
echo \/ \__,_^|_^| \__,_^|\__,_^|\___/_/\_\^|___/ \_/ \_/\__,_^|\__\___/ \/ \/ ^|_^|_^| ^|_^|[0m
echo.
rem echo [96m[1m%~1[0m
rem echo.
endlocal