install and uninstall bat

This commit is contained in:
MeexReay 2025-04-21 20:23:45 +03:00
parent e55d5a7a55
commit 2a3473853b
3 changed files with 67 additions and 0 deletions

View File

@ -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

30
install.bat Normal file
View File

@ -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

35
uninstall.bat Normal file
View File

@ -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