@echo off
call check-for-admin
if %ERRORLEVEL% neq 0 exit /b

set OPT=..\optional
set SOFTWARE=..\software
set EXE=vlc-setup.exe
set STARTMENU="%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs"

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

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

echo installing ...
cd %SOFTWARE%
@echo on
%EXE% /L=1033 /S
@echo off
cd %OPT%

echo removing VLC Desktop link ...
del /F "%PUBLIC%\Desktop\VLC media player.lnk" 2>nul

echo moving VLC startmenu shortcut ...
move /Y %STARTMENU%\"VideoLAN\VLC media player.lnk" %STARTMENU%

echo removing VLC startmenu folder ...
rd /S /Q %STARTMENU%\"VideoLAN" 2>nul

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

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

rem set filetypes ...
if EXIST ..\scripts\set-filetypes.cmd (
  call ..\scripts\set-filetypes.cmd
)

pause

