Vlc
VLC (VideoLAN Client) is a multimedia player. It plays a very wide range of audio and video and DVD.
VLC is packaged using the NSIS:_Nullsoft_Scriptable_Install_System which means you can use the standard ISIS switches to aid installation.
Contents
VLC for all
A combination of all mentioned tips and tricks in the long list of package flavours further down the page.
<?xml version="1.0" encoding="UTF-8"?>
<packages:packages
xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd" >
<!-- VLC simple install ; for 32-bit and 64-bit hosts -->
<package
id='vlc'
name='VideoLAN Client'
revision='%version%-20130706'
priority='10'
reboot='false' >
<variable name="version" value="2.1.5" />
<variable name="PKG_DESTINATION" value="%ProgramFiles(x86)%\VideoLAN" architecture="x64"/>
<variable name="PKG_DESTINATION" value="%ProgramFiles%\VideoLAN" architecture="x86"/>
<check type='uninstall' condition='versionequalto' path='VLC media player' value='%version%' />
<install include="remove"/>
<install cmd='%COMSPEC% /C start /wait "VLC" "%SOFTWARE%\VLC\vlc-%version%-win32.exe" /S /NCRC'/>
<upgrade include="install"/>
<remove cmd='%COMSPEC% /c if exist "%PKG_DESTINATION%\VLC\uninstall.exe" "%PKG_DESTINATION%\VLC\uninstall.exe" /S _?=%PKG_DESTINATION%\VLC'/>
<remove cmd='%COMSPEC% /C if exist "%PKG_DESTINATION%" rmdir /S /Q "%PKG_DESTINATION%"'/>
</package>
</packages:packages>
Native method by TGellan
This install method evolved from the Advanced method by SkyBeam and the Alternative method without forking. Changed to be more flexible for other countries; added variables. e.g. German users set DocaSet="Dokumente und Einstellungen" and ApplData="Anwendungsdaten" Revision should match VLC revision; downgrade section needed
<?xml version="1.0" encoding="UTF-8"?>
<package id='VLC' name='VideoLAN Client' revision='%version%' priority='40' reboot='false' >
<check type='uninstall' condition='exists' path='VLC media player %version%' />
<variable name="version" value="1.1.9" />
<variable name="DocaSet" value="c:\Documents and Settings"/>
<variable name="ApplData" value="Application Data"/>
<!-- Uninstall if necessary and install new version -->
<install cmd='%COMSPEC% /c if exist "%ProgramFiles%\VideoLAN\VLC\uninstall.exe" "%ProgramFiles%\VideoLAN\VLC\uninstall.exe" /S _?=%ProgramFiles%\VideoLAN\VLC'/>
<install cmd='%COMSPEC% /C if exist "%ProgramFiles%\VideoLAN\VLC" rmdir /S /Q "%ProgramFiles%\VideoLAN"'/>
<install cmd='%COMSPEC% /C start /wait "VLC" "%SOFTWARE%\VLC\vlc-%version%-win32.exe" /S /NCRC /D="%ProgramFiles%"'/>
<!-- Remove desktop shortcut. WARNING: 'Desktop' directory is for English Windows localization. Replace as needed. -->
<install cmd='%COMSPEC% /C del /F /Q "%ALLUSERSPROFILE%\Desktop\VLC media player**"'/>
<!-- In order to remove the question screen on the first start, vlcrc needs to be configured and copied to %ApplData% folder for every user -->
<install cmd='%COMSPEC% /C for /d %a in ("\%DocaSet%\*.*") do mkdir "%a\%ApplData%\vlc"'>
<exit code='any' />
</install>
<install cmd='%COMSPEC% /C for /d %a in ("%DocaSet%\*.*") do copy /y "%SOFTWARE%\VLC\vlcrc." "%a\%ApplData%\vlc\."' />
<upgrade cmd='%COMSPEC% /c if exist "%ProgramFiles%\VideoLAN\VLC\uninstall.exe" "%ProgramFiles%\VideoLAN\VLC\uninstall.exe" /S _?=%ProgramFiles%\VideoLAN\VLC'/>
<upgrade cmd='%COMSPEC% /C if exist "%ProgramFiles%\VideoLAN\VLC" rmdir /S /Q "%ProgramFiles%\VideoLAN"'/>
<upgrade cmd='%COMSPEC% /C start /wait "VLC" "%SOFTWARE%\VLC\vlc-%version%-win32.exe" /S /NCRC /D="%ProgramFiles%"'/>
<upgrade cmd='%COMSPEC% /C del /F /Q "%ALLUSERSPROFILE%\Desktop\VLC media player**"'/>
<upgrade cmd='%COMSPEC% /C for /d %a in ("%DocaSet%\*.*") do mkdir "%a\%ApplData%\vlc"'>
<exit code='any' />
</upgrade>
<upgrade cmd='%COMSPEC% /C for /d %a in ("%DocaSet%\*.*") do copy /y "%SOFTWARE%\VLC\vlcrc." "%a\%ApplData%\vlc\."' />
<downgrade cmd='%COMSPEC% /c if exist "%ProgramFiles%\VideoLAN\VLC\uninstall.exe" "%ProgramFiles%\VideoLAN\VLC\uninstall.exe" /S _?=%ProgramFiles%\VideoLAN\VLC'/>
<downgrade cmd='%COMSPEC% /C if exist "%ProgramFiles%\VideoLAN\VLC" rmdir /S /Q "%ProgramFiles%\VideoLAN"'/>
<downgrade cmd='%COMSPEC% /C start /wait "VLC" "%SOFTWARE%\VLC\vlc-%version%-win32.exe" /S /NCRC /D="%ProgramFiles%"'/>
<downgrade cmd='%COMSPEC% /C del /F /Q "%ALLUSERSPROFILE%\Desktop\VLC media player**"'/>
<downgrade cmd='%COMSPEC% /C for /d %a in ("%DocaSet%\*.*") do mkdir "%a\%ApplData%\vlc"'>
<exit code='any' />
</downgrade>
<downgrade cmd='%COMSPEC% /C for /d %a in ("%DocaSet%\*.*") do copy /y "%SOFTWARE%\VLC\vlcrc." "%a\%ApplData%\vlc\."' />
<remove cmd='%COMSPEC% /c if exist "%ProgramFiles%\VideoLAN\VLC\uninstall.exe" "%ProgramFiles%\VideoLAN\VLC\uninstall.exe" /S _?=%ProgramFiles%\VideoLAN\VLC'/>
<remove cmd='%COMSPEC% /C if exist "%ProgramFiles%\VideoLAN\VLC" rmdir /S /Q "%ProgramFiles%\VideoLAN"'/>
</package>
The package silently uninstalls a previous version (or the actual in case the wpkg.xml is not present) and then installs the 1.1.1 version. Afterwards a preconfigured vlcrc is copied to any user account.
Minor problem: New users on the PC will not get the vlcrc automatically, thus will still be presented with the question screen on first start.
Simple Method
This install method removes the desktop shortcut (the path may have to be changed to your localized name).
<?xml version="1.0" encoding="UTF-8"?>
<packages>
<package
id='VLC'
name='VideoLAN Client'
revision='%version%'
priority='40'
reboot='false' >
<variable name="version" value="2.1.2" />
<variable name="SOFTWARE" value="\\lesa-win01\apps"/>
<check type='uninstall' condition='exists' path='VLC media player %version%' />
<install cmd='"%SOFTWARE%\vlc\vlc-%version%-win32.exe" /S' />
<!--<install cmd='%CMD% /c del "%ALLUSERSPROFILE%\Desktop\VLC media player.lnk"' />-->
<remove cmd='"%PROGRAMFILES%\VideoLAN\VLC\uninstall.exe" /S' />
</package>
</packages>
Upgrade is also possible, but there are issues. See the advanced method for how to achieve this.
Advanced method by SkyBeam
VLC is a bit tricky because upgrading (installation if an installed version is already installed) is not fully unattended. It interactively asks the user if the existing version should be uninstalled first. As already mentioned above a solution would be to remove the previous version first before installing the VLC update. However also this fails since uninstall.exe forks a new process while the parent exits immediately. So if this happens too quickly then the install program still asks for confirmation.
So I did a workaround for that:
<?xml version="1.0" encoding="utf-8" ?>
<packages>
<package id='VLC' name='VideoLAN Client' revision='1' priority='50' reboot='false' >
<!-- VLC media player -->
<check type='uninstall' condition='exists' path='VLC media player 0.9.6' />
<install cmd='"%SOFTWARE%\VLC\unattended.cmd"' />
<remove cmd='"%SOFTWARE%\VLC\unattended-uninstall.cmd"' />
<upgrade cmd='"%SOFTWARE%\VLC\unattended.cmd"' />
</package>
</packages>
This method requires the following scripts to perform some more actions:
unattended.cmd
@echo off
set BINARY=vlc-0.9.6-win32.exe
echo Installing VLC Media Player
set INSTALLER_LOC=%~dp0
set EXIT_CODE=0
set PROG_FILES=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set PROG_FILES=%ProgramFiles(x86)%
echo - Removing previous version "%INSTALLER_LOC%unattended-uninstall.cmd"
call "%INSTALLER_LOC%unattended-uninstall.cmd"
echo - Installing player
start /wait "VLC" "%INSTALLER_LOC%%BINARY%" /S /NCRC /D="%PROG_FILES%"
set EXIT_CODE=%ERRORLEVEL%
call "%INSTALLER_LOC%cleanup.cmd"
exit /B %EXIT_CODE%
As you can see it calls unattended-uninstall.cmd prior to installation (any time!). The evaluation of PROG_FILES assures that it installs the 32-bit VLC always to the correct program files directory also on 64-bit systems.
unattended-uninstall.cmd
@echo off
echo Removing VLC media plyer
set PROG_FILES=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set PROG_FILES=%ProgramFiles(x86)%
set INSTALLER_LOC=%~dp0
set VLANDIR=%PROG_FILES%\VideoLAN
set UNINSTALLER=%VLANDIR%\VLC\uninstall.exe
set OPTIONS=/S
if not exist "%UNINSTALLER%" goto good_end
start /wait "VLC uninstall" "%UNINSTALLER%" %OPTIONS%
REM Unfortunately the uninstaller seems to fork a child process and the parent
REM process exits immediately. So give it some time to uninstall
for /L %%C IN (1,1,30) DO (
if not exist "%UNINSTALLER%" goto good_end
ping -n 2 127.0.0.1 > NUL
)
:bad_end
exit /B 1
:good_end
if exist "%VLANDIR%" rmdir /s /q "%VLANDIR%"
exit /B 0
As this script is called by unattended.cmd also when VLC is probably not installed it first checks if there is an uninstallation to be done. If not it just skips the uninstall, but still checks to see if the uninstaller totally cleaned up after itself.
As described above the uninstaller forks a child process and exits immediately. So there is a need to wait for the uninstaller to complete. I am simply checking if the uninstaller still exists. If yes I wait for another second.
In order to prevent an endless-loop the uninstallation will stop after a maximum of 30 seconds.
cleanup.cmd
@echo off
echo Removing unnecessary shortcuts
del /F /Q "%ALLUSERSPROFILE%\Desktop\VLC media player**"
del /F /Q "%PUBLIC%\Desktop\VLC media player**"
exit /B 0
This has been tested on Windows Vista x64.
Alternative method without forking
As described in the NSIS Wiki, there is a command line argument to prevent the uninstaller from backgrounding. It cannot delete itself in this case, though so you need to do that separately. Thus an alternative uninstall command sequence is:
<uninstall cmd='"%ProgramFiles%\VideoLAN\VLC\uninstall.exe /S _?=%ProgramFiles%\VideoLAN\VLC'/>
<uninstall cmd='%COMSPEC% /C rmdir /S /Q "%ProgramFiles%\VideoLAN"'/>
Note that there must not be spaces around the path that follows _?=