Skip to content

Commit

Permalink
2023-11-23
Browse files Browse the repository at this point in the history
  • Loading branch information
YDeltagon committed Nov 23, 2023
1 parent 3f70121 commit dc838a5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion OPTY.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
:: 2023-11-23 : Add Logs
:: Change-logs : Found on Readme.md GitHub


@echo off
REM set variables
set current_version=01.0.5
set current_version=01.0.6
set GitHubRawLink=https://raw.githubusercontent.com/YDeltagon/OPTY/master/resources/
set GitHubLatestLink=https://github.com/YDeltagon/OPTY/releases/latest/download/
REM Set variables for logs
Expand All @@ -15,13 +16,15 @@ set logs="%~dp0\logs_%date%_%current_time%.txt"
REM Check if running as administrator
net session >nul 2>&1
if %errorlevel% == 0 (
echo %date% %time% : Admin >> %logs%
set admin=1
echo.
echo Running as administrator
echo.
timeout /t 1
goto shortcut
) else (
echo %date% %time% : Non-Admin >> %logs%
set admin=0
echo.
echo Not running as administrator
Expand All @@ -35,6 +38,7 @@ if %errorlevel% == 0 (
REM Check if running from C:\OPTY_by-YannD\OPTY.bat if not copy it to C:\OPTY_by-YannD\OPTY.bat and create a shortcut on desktop
:shortcut
if not "%~dp0" == "C:\OPTY_by-YannD\" (
echo %date% %time% : Creta shurtcut >> %logs%
md "C:\OPTY_by-YannD"
xcopy /y %~dp0OPTY.bat C:\OPTY_by-YannD
curl -o "%~dp0Shortcut_OPTY.ps1" -LJO %GitHubRawLink%Shortcut_OPTY.ps1
Expand All @@ -58,13 +62,15 @@ echo Check GitHub ping...
echo.
ping -n 1 -l 8 github.com | find "TTL="
if %errorlevel%==0 (
echo %date% %time% : Ping GitHub réussi >> %logs%
color 20
echo.
echo Ping check successful.
echo.
timeout /t 1
goto update_opty
) else (
echo %date% %time% : Ping GitHub raté >> %logs%
color 40
echo.
echo Ping check failed, retrying...
Expand Down Expand Up @@ -117,6 +123,7 @@ if /i "%choice%"=="N" goto update_found_and_not_accepted

REM If user accept update, download new OPTY.bat and replace the old one
:update_found_and_accepted
echo %date% %time% : update_found_and_accepted >> %logs%
cls
color 02
echo.
Expand All @@ -131,6 +138,7 @@ exit

REM If user don't accept update, exit
:update_found_and_not_accepted
echo %date% %time% : update_found_and_not_accepted >> %logs%
cls
color 04
echo.
Expand All @@ -143,6 +151,7 @@ call "Menu.bat"

REM If no update is available, continue
:update_not_available
echo %date% %time% : update_not_available >> %logs%
color 30
cls
echo.
Expand Down

0 comments on commit dc838a5

Please sign in to comment.