-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdate Redate.bat
73 lines (53 loc) · 2.21 KB
/
Update 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
73
@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 "destinationFolder=%USERPROFILE%\Redate"
set "destinationPath=%destinationFolder%\Redate.bat"
set "shortcutPath=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Redate.lnk"
echo --------------------------------------------------------------------------------------------------
echo This script will Update Redate-Windows. In order to update the update script you have to reinstall
echo --------------------------------------------------------------------------------------------------
set /p "choice=Do you want to continue with the Update? (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:
cls
REM Extract the contents of the zip file
echo -----------------------------------------
powershell.exe -Command "Expand-Archive -Path '%downloadPath%' -DestinationPath '%extractPath%' -Force"
echo -----------------------------------------
echo:
cls
REM Create the destination folder if it doesn't exist
echo -----------------------------------------
mkdir "%destinationFolder%" 2>nul
echo -----------------------------------------
echo:
cls
REM Move the script to the desired location
move /Y "%scriptPath%" "%destinationPath%"
REM Create a shortcut in the Start Menu folder
powershell.exe -Command "$shell = New-Object -ComObject WScript.Shell; $shortcut = $shell.CreateShortcut('%shortcutPath%'); $shortcut.TargetPath = '%destinationPath%'; $shortcut.Save()"
cls
REM Clean up temporary files
del "%downloadPath%" /F /Q
rmdir "%extractPath%" /S /Q
cls
echo ----------------------------------------
echo Redate-Windows update completed.
echo ---------------------------------------
echo:
set /p proceed=Do you want to open Redate? [Type Y for yes and N for no] [y/n]
if /i "%proceed%"=="y" (
%destinationFolder%\Redate.bat
echo:
)
pause