x86 exe, static registry key,
UninstallString with quotes calls another process

This method applies to Picasa, Notepad++

silent-install.cmd
@echo off
setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=Picasa 3
set n=Picasa 3
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
for /f "tokens=*" %%a in ('dir /b "%~dp0picasa3*.exe"') do (
echo %n%
start /wait "" "%~dp0%%a" /S /L
)
) else echo %n% already installed!
endlocal
silent-uninstall.cmd
@echo off
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k=Picasa 3
for /f delims^=^"^ tokens^=2 %%a in ('^
reg query "%sw%\Wow6432Node\%u%\%k%" /v UninstallString ^|
find "UninstallString"') do (
start /wait "" "%%a" /S
setlocal EnableDelayedExpansion
:recheck
reg query "%sw%\Wow6432Node\%u%\%k%" > nul 2>&1
if !errorlevel!==0 goto recheck
endlocal
)
Check out more from