How to remove the application from the system using the command line
Suppose you have an application that was installed via MSI. And you only know the name of the application (in this case, only the first part of the name). To use the MSIEXEC command, it is required that you know the GUID, but all programs have different GUIDs; moreover, even different versions of the program may have different GUIDs. And here is the solution that Bill Lin's invented: he goes through the registry keys to get this very GUID, from which the DisplayName starts with a specific name.
Below is an example that removes all installed applications that start with “Windows Live ID Sign-in Assistant”
for / f "tokens = 7 delims = \" %% i in ('reg query HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ Uninstall ^ | FIND "{"') do
(
for / f "tokens = 2, *" %% j in ('reg query HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ %% i / v DisplayName') do
(
set dn = %% k
if "! dn: ~ 0.33!" == "Windows Live ID Sign-in Assistant"
(
echo Uninstalling Windows Live ID Sign-in Assistant
msiexec / promptrestart / qb / x %% i / L + * v% TEMP% \ wlidsvc.log
if% ERRORLEVEL% NEQ 0 echo Uninstallation failed. Check the log% TEMP% \ wlidsvc.log
)
)
)