From 2a3473853b64613032f469600d0c3ca0a2554c85 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Mon, 21 Apr 2025 20:23:45 +0300 Subject: [PATCH] install and uninstall bat --- Makefile | 2 ++ install.bat | 30 ++++++++++++++++++++++++++++++ uninstall.bat | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 install.bat create mode 100644 uninstall.bat diff --git a/Makefile b/Makefile index ab5b857..30c56a2 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,8 @@ build/windows-x86_64: mv $@/bin/* $@/ cp target/x86_64-pc-windows-gnu/release/bRAC.exe $@ rm -r $@/bin + cp install.bat $@ + cp uninstall.bat $@ build/linux-x86_64: mkdir -p build diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..a28aa3f --- /dev/null +++ b/install.bat @@ -0,0 +1,30 @@ +@echo off +net session >nul 2>&1 || ( + echo This script requires administrator privileges. + pause + exit /b +) + +set "DEST=C:\Program Files\bRAC" +mkdir "%DEST%" 2>nul +xcopy "." "%DEST%\" /E /I /H /Y >nul + +for /d %%u in ("C:\Users\*") do ( + if exist "%%u\AppData\Roaming\Microsoft\Windows\Desktop" ( + call :s "%%u\AppData\Roaming\Microsoft\Windows\Desktop\bRAC.lnk" "%DEST%\bRAC.exe" + ) else if exist "%%u\Desktop" ( + call :s "%%u\Desktop\bRAC.lnk" "%DEST%\bRAC.exe" + ) +) +exit /b + +:s +set "v=%TEMP%\_s.vbs" +> "%v%" echo Set o=CreateObject("WScript.Shell") +>>"%v%" echo Set l=o.CreateShortcut("%~1") +>>"%v%" echo l.TargetPath="%~2" +>>"%v%" echo l.WorkingDirectory="%~dp2" +>>"%v%" echo l.Save +wscript "%v%" >nul +del "%v%" >nul +exit /b \ No newline at end of file diff --git a/uninstall.bat b/uninstall.bat new file mode 100644 index 0000000..85c4a17 --- /dev/null +++ b/uninstall.bat @@ -0,0 +1,35 @@ +@echo off +net session >nul 2>&1 || ( + echo This script requires administrator privileges. + pause + exit /b +) + +set "TARGET=C:\Program Files\bRAC\bRAC.exe" + +for /d %%u in ("C:\Users\*") do ( + call :d "%%u\AppData\Roaming\Microsoft\Windows\Desktop" + call :d "%%u\Desktop" +) + +cd /d "%TEMP%" +rmdir /s /q "C:\Program Files\bRAC" +exit /b + +:d +if not exist "%~1" exit /b +for %%f in ("%~1\*.lnk") do ( + call :c "%%~f" +) +exit /b + +:c +set "v=%TEMP%\_c.vbs" +> "%v%" echo Set o=CreateObject("WScript.Shell") +>>"%v%" echo Set l=o.CreateShortcut("%~1") +>>"%v%" echo WScript.Echo l.TargetPath +for /f "usebackq delims=" %%t in (`wscript //nologo "%v%"`) do ( + if /I "%%t"=="%TARGET%" del /f /q "%~1" +) +del "%v%" >nul +exit /b