Silent uninstall all version of VirtualBox

CatOnRug solve, automate, speed up
This will:
  • Uninstall VirtualBox on 64-bit or 32-bit Windows
  • Uninstall any version of VirtualBox 5
  • Uninstall applcation no matter in what custom directory it is installed
Here is the code:
@echo off
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set n=Oracle VM VirtualBox
setlocal EnableDelayedExpansion
for /f "tokens=7 delims=\" %%a in ('^
reg query "%sw%\%u%" /s ^| find "\Uninstall\"') do (
reg query "%sw%\%u%\%%a" /v DisplayName > nul 2>&1
if !errorlevel!==0 (
reg query "%sw%\%u%\%%a" /v DisplayName | findstr "%n%"
if !errorlevel!==0 (
echo %n% found
echo %%a | find "{"
if !errorlevel!==0 %systemroot%\system32\msiexec.exe /X %%a /qn
)
)
)
endlocal

No comments:

Post a Comment