-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.cmd
More file actions
executable file
·126 lines (111 loc) · 3.83 KB
/
install.cmd
File metadata and controls
executable file
·126 lines (111 loc) · 3.83 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@echo off
REM --------------------------copyright c 2025 Usman Ghani (usmandev24) ----------------------
REM -----------------------------------------------------------------------------------------
REM Note: Internet connection is required for the first-time installation and app execution.
REM ------------------------------------------------------------------------------------------
REM Store the original working directory
SET "OriginalDir=%CD%"
REM If relaunched with directory argument, restore it
IF NOT "%1"=="" (
cd /d "%1"
SET "OriginalDir=%1"
)
ECHO Working directory: %CD%
REM Check if Node.js and npm are available
where node >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
where npm >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
ECHO Node.js and npm are already installed.
GOTO AfterInstall
) ELSE (
ECHO npm not found.
GOTO InstallNode
)
) ELSE (
ECHO Node.js not found.
GOTO InstallNode
)
:InstallNode
REM Test internet connection
ping google.com -n 1 >nul
IF %ERRORLEVEL% NEQ 0 (
ECHO.
ECHO -------------------------------------------
ECHO Internet connection not detected.
ECHO Please connect to the internet and try again.
ECHO -------------------------------------------
ECHO.
timeout /t 5 >nul
exit /b 1
)
REM Check for admin privileges
net session >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
ECHO Administrator privileges are required. Relaunching as Administrator...
REM Pass the original directory as an argument
powershell -Command "Start-Process cmd -ArgumentList '/c %~f0 \"%OriginalDir%\"' -Verb RunAs"
exit /b
)
ECHO File Shifter requires Node.js to run.
ECHO Checking for winget...
where winget >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
ECHO -------------------------------------------------------------------------------------------
ECHO winget not found. Please ensure winget is installed on your system.
ECHO You can install winget via the Microsoft Store or Windows Package Manager.
ECHO
ECHO OR Manually download Node.js from nodejs website and install it. And Than run this install file.
ECHO
ECHO ---------------------------------------------------------------------------------------------
timeout /t 10 >nul
exit /b 1
)
ECHO Installing Node.js LTS version using winget...
winget install --id OpenJS.NodeJS.LTS --silent --accept-package-agreements --accept-source-agreements
IF %ERRORLEVEL% NEQ 0 (
ECHO Node.js LTS installation failed.
timeout /t 5 >nul
exit /b 1
)
ECHO Node.js LTS installation completed successfully.
REM Refresh environment variables
SET "PATH=%PATH%;%ProgramFiles%\nodejs\"
:AfterInstall
REM Ensure working directory is restored
cd /d "%OriginalDir%"
timeout /t 2 >nul
REM Create app.bat using sequential redirection for reliability
ECHO Creating App.bat...
echo @echo off > App.bat
echo REM --------------------------copyright 2025 Usman Ghani ^(usmandev24^) ------------------------ >> App.bat
echo REM --------------Note: Run from Command Prompt --------------------------------------------- >> App.bat
echo. >> app.bat
echo ECHO To stop the app, press Ctrl ^+ C. >> App.bat
echo call npm start >> App.bat
echo ECHO Exiting... >> App.bat
echo timeout /t 5 ^>nul >> App.bat
echo exit /b 0 >> App.bat
REM Verify app.bat creation
IF EXIST App.bat (
ECHO App.bat created successfully.
) ELSE (
ECHO Failed to create App.bat. Check permissions or disk space in %CD%.
pause
exit /b 1
)
ECHO Running npm install...
call npm install --omit=dev
IF %ERRORLEVEL% NEQ 0 (
ECHO Error occurred during npm install. Check your connection and try again.
ECHO Exiting in 3 seconds...
timeout /t 3 >nul
exit /b 1
)
ECHO Installation completed successfully.
ECHO.
ECHO ---------------- Run "App" to start File Shifter ------------
ECHO.
ECHO Setup finished. Exiting in 10 seconds...
timeout /t 10 >nul
exit /b 0