How to unstall a applicaiton with c#

  • Thread starter Thread starter ad
  • Start date Start date
Thanks,
I want to uninstall programs wich registerd in windows


Mark Rae said:
[top-posting corrected]
Sorry!
I mean uninstall.

Can you explain a bit more about what you're trying to do...

Are you saying that you've created an application in C# and want to know
how to create an installation / uninstallation routine for it...?

Or are you saying that you want to uninstall other applications with
C#...?
 
I have find the usage of msiexec.

We can use msiexec /x to uninstall program.

But msiexec /x must followed with package.

How can I uninstall the programs registered in the "add/move program" of
control panel?
 
ad pisze:
How can I uninstall the programs registered in the "add/move program" of
control panel?

How do you know which program do you want to uninstall? I assume that
you have a name that is displayed in the Add or Remove Programs applet?

It turns out that you can read the entire uninstall command from Windows
registry (this will also work for applications that were not created
with Windows Installer compatible installation tools).

You should programmatically search all the registry keys under:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Current Version\Uninstall

When you find a key, whose value DisplayName matches name of the
application you want to uninstall, read the value UninstallString from
the same registry key and start command described by this value using
System.Diagnostics.Process class.

Best regards!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top