@echo off

set EXE=..\software\telegram-setup.exe
set STARTMENU_USER="%APPDATA%\Microsoft\Windows\Start Menu\Programs"

if NOT EXIST %EXE% (
  echo ERROR: %EXE% not found!
  exit /b
)

echo ####### %0 #######

echo installing Telegram Desktop Client ...
start /wait %EXE% /silent /norestart %EXE%

echo moving Telegram startmenu shortcut ...
move /Y %STARTMENU_USER%\"Telegram Desktop\Telegram.lnk" %STARTMENU_USER%

echo removing Telegram startmenu folder ...
rd /S /Q %STARTMENU_USER%\"Telegram Desktop" 2>nul

rem refresh desktop (W10 style)
ie4uinit.exe -show

echo ####### %0 #######
pause