-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInstall-Redate.bat
74 lines (59 loc) · 2.73 KB
/
Install-Redate.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@echo off
REM Define variables
set "repoUrl=https://github.com/RoboXL/Redate-Windows/archive/refs/heads/main.zip"
set "tempDir=%TEMP%"
set "downloadPath=%tempDir%\Redate.zip"
set "extractPath=%tempDir%\Redate"
set "scriptPath=%extractPath%\Redate-Windows-main\Redate.bat"
set "updateScriptPath=%extractPath%\Redate-Windows-main\Update Redate.bat"
set "destinationFolder=%USERPROFILE%\Redate"
set "destinationPath=%destinationFolder%\Redate.bat"
set "updateScriptDestinationPath=%destinationFolder%\Update Redate.bat"
set "shortcutPath=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Redate.lnk"
set "updateShortcutPath=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Update Redate.lnk"
REM Prompt to confirm installation
echo ----------------------------
echo Redate-Windows installation
echo ----------------------------
echo:
echo Hey %username% This script will install Redate-Windows to the following location:
echo -----------------------------
echo %destinationFolder%
echo -----------------------------
echo:
set /p "choice=Do you want to continue with the installation? (Y/N): "
if /i "%choice%" neq "Y" exit
REM Download the repository zip file
echo:
echo --------------------------------------
powershell.exe -Command "(New-Object System.Net.WebClient).DownloadFile('%repoUrl%', '%downloadPath%')"
echo --------------------------------------
echo:
REM Extract the contents of the zip file
echo --------------------------------------
powershell.exe -Command "Expand-Archive -Path '%downloadPath%' -DestinationPath '%extractPath%' -Force"
echo --------------------------------------
echo:
REM Create the destination folder if it doesn't exist
mkdir "%destinationFolder%" 2>nul
REM Move the scripts to the desired locations
echo --------------------------------------
move /Y "%scriptPath%" "%destinationPath%"
echo --------------------------------------
echo:
echo --------------------------------------
move /Y "%updateScriptPath%" "%updateScriptDestinationPath%"
echo --------------------------------------
REM Create a shortcut in the Start Menu folder for UpdateX-Windows
powershell.exe -Command "$shell = New-Object -ComObject WScript.Shell; $shortcut = $shell.CreateShortcut('%shortcutPath%'); $shortcut.TargetPath = '%destinationPath%'; $shortcut.Save()"
REM Create a shortcut in the Start Menu folder for Update UpdateX.bat
powershell.exe -Command "$shell = New-Object -ComObject WScript.Shell; $shortcut = $shell.CreateShortcut('%updateShortcutPath%'); $shortcut.TargetPath = '%updateScriptDestinationPath%'; $shortcut.Save()"
REM Clean up temporary files
del "%downloadPath%" /F /Q
rmdir "%extractPath%" /S /Q
echo:
echo:----------------------------------------
echo: Redate-Windows installation completed.
echo:----------------------------------------
echo:
pause