w10install/optional/install-purebasic.cmd
2023-08-13 14:42:56 +02:00

79 lines
1.9 KiB
Batchfile

@echo off
call check-for-admin
if %ERRORLEVEL% neq 0 exit /b
set T=%SystemDrive%\TEMP
set CONFIG=config\install-purebasic.txt
set STARTMENU="%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs"
rem licensed version (exe contains key!)
set EXE=..\company\purebasic-setup.exe
rem demo version (publically accessible)
set ZIP=..\software\purebasic.zip
echo ####### %0 #######
echo killing PureBasic processes...
taskkill /F /IM PureBasic.exe 2>nul
taskkill /F /IM pbcompiler.exe 2>nul
rem YES - this works. It is a "AND" construct...
if NOT EXIST %EXE% if NOT EXIST %ZIP% (
echo WARNING: no PureBasic zipfile or exe-installer found!
goto END
)
if EXIST %EXE% (
echo INFO: %EXE% found, installing licensed version ...
echo installing purebasic ...
start /wait %EXE% /LOADINF=%CONFIG% /NORESTART /NOCANCEL ^
/SILENT /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS
goto LINK
)
if EXIST %ZIP% (
echo INFO: %ZIP% found, installing demo version ...
7z e -y -aoa -o%T%\purebasic %ZIP%
move /Y %T%\purebasic\PureBasic*.exe %T%\purebasic\purebasic-setup.exe
echo installing purebasic ...
start /wait %T%\purebasic\purebasic-setup.exe ^
/LOADINF=%CONFIG% /NORESTART /NOCANCEL /SILENT /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS
echo cleanup ...
rd /S /Q %T%\purebasic 2>nul
goto LINK
)
:LINK
echo removing old desktop links ...
del /F /Q /A "%PUBLIC%\Desktop\PureBasic*.lnk" 2>nul
del /F /Q /A "%USERPROFILE%\Desktop\PureBasic*.lnk" 2>nul
echo copying new PureBasic link to public desktop ...
copy /Y %STARTMENU%\"PureBasic\PureBasic (x64).lnk" %PUBLIC%\Desktop\PureBasic.lnk
echo moving PureBasic startmenu shortcut ...
move /Y %STARTMENU%\"PureBasic\PureBasic (x64).lnk" %STARTMENU%\PureBasic.lnk
echo removing PureBasic startmenu folder ...
rd /S /Q %STARTMENU%\PureBasic 2>nul
rem refresh desktop (W10 style)
ie4uinit.exe -show
:END
echo ####### %0 #######
pause