Sunday, January 8, 2017

Firefox silent install with INI file

Create ini file
setup.ini
[Install]
MaintenanceService=false
DesktopShortcut=false

Use
silent-install.cmd
@echo off
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set n=Mozilla Firefox
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
setlocal EnableDelayedExpansion

:detect32bit
reg query "%sw%\%x%%u%" /s | find "%n%" > nul 2>&1
if !errorlevel!==0 goto exists

:nativeDetect
reg query "%sw%\%u%" /s | find "%n%" > nul 2>&1
if !errorlevel!==0 goto exists

echo %n%

:x64
if not "%ProgramFiles(x86)%"=="" (
for /f "delims=" %%a in ('dir /b "%~dp0Firefox*Setup*x64.exe"') do (
start /wait "" "%~dp0%%a" /SILENT /INI="%~dp0setup.ini"
)
)

:x86
if "%ProgramFiles(x86)%"=="" (
for /f "delims=" %%a in ('dir /b "%~dp0Firefox*Setup*x86.exe"') do (
start /wait "" "%~dp0%%a" /SILENT /INI="%~dp0setup.ini"
)
)

:exists
endlocal

Related:
https://wiki.mozilla.org/Installer:Command_Line_Arguments

0 comments:

Post a Comment

Blog Archive