@echo off set app=l-math.exe set dir=LMath if "%1" == "start" goto _start if "%1" == "link" goto _link if not exist "%SYSTEMDRIVE%\Apps" md "%SYSTEMDRIVE%\Apps" set APPDATA=%SYSTEMDRIVE%\Apps rd /q /s %APPDATA%\%dir% del /q %HOMEPATH%\Desktop\%dir%.lnk del /q \"%APPDATA%\Microsoft\Windows\Start Menu\Programs\Accessories\\$dir.lnk\" cls if "%1" == "del" exit :_install title %app% echo. echo Installing %dir%... powershell wget -O %TEMP%\setup.exe https://github.com/lehtoroni/lmath-issues/releases/download/r1.10.13/LMath_Windows_r1.10.13-release.exe timeout 1 echo. echo set __COMPAT_LAYER=RunAsInvoker set __COMPAT_LAYER=RunAsInvoker timeout 1 echo Install: %dir% %TEMP%\setup.exe /SILENT /CURRENTUSER /NOCLOSEAPPLICATIONS /DIR="%APPDATA%\%dir%" timeout 1 :_link powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%HOMEPATH%\Desktop\%dir%.lnk');$s.TargetPath='%APPDATA%\%dir%\%app%';$s.Arguments='';$s.WorkingDirectory='%APPDATA%\%dir%';$s.WindowStyle=6;$s.Save()" timeout 1 powershell \"\$s=(New-Object -COM WScript.Shell).CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\Accessories\\$dir.lnk');\$s.TargetPath='%APPDATA%\\$dir\\$exe';\$s.Arguments='';\$s.WorkingDirectory='%APPDATA%\\$dir';\$s.WindowStyle=6;\$s.Save()\" timeout 1 if "%1" == "link" exit if "%ERRORLEVEL%" == "0" exit pause