@echo off
rem Caramell CRM - masaustu kisayolu (program penceresi gibi acilir)
set URL=http://crm.caramellerp.com
set D=%LOCALAPPDATA%\CaramellCRM
mkdir "%D%" 2>nul
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { Invoke-WebRequest -UseBasicParsing '%URL%/kur/caramell.ico' -OutFile '%D%\caramell.ico' } catch { }"
set B=
if exist "%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe" set B=%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe
if exist "%ProgramFiles%\Microsoft\Edge\Application\msedge.exe" set B=%ProgramFiles%\Microsoft\Edge\Application\msedge.exe
if exist "%ProgramFiles%\Google\Chrome\Application\chrome.exe" set B=%ProgramFiles%\Google\Chrome\Application\chrome.exe
if exist "%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe" set B=%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe
if exist "%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe" set B=%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe
if "%B%"=="" (
  echo Edge veya Chrome bulunamadi.
  pause
  exit /b 1
)
powershell -NoProfile -ExecutionPolicy Bypass -Command "$s=(New-Object -ComObject WScript.Shell).CreateShortcut([Environment]::GetFolderPath('Desktop')+'\Caramell CRM.lnk'); $s.TargetPath='%B%'; $s.Arguments='--app=%URL%/ --user-data-dir=\"%D%\profil\" --window-size=1400,900 --no-first-run'; $s.IconLocation='%D%\caramell.ico'; $s.Description='Caramell CRM'; $s.WorkingDirectory='%D%'; $s.Save()"
echo.
echo Masaustune "Caramell CRM" kisayolu eklendi. Cift tiklayinca program penceresi olarak acilir.
pause
