Sai Sherlekar
Sai Sherlekar

Reputation: 1854

How to run uninstall.exe using .Net

I tried lots of things but i can not initiate uninstaller using .net

    Dim p As New Process
    Dim uninstallString As String = "C:\WINDOWS\ProCharge Plugin\uninstall.exe" & " /U:C:\Program Files\ProCharge Plugin\irunin.xml"
    p.StartInfo.Arguments = uninstallString           
    p.Start()

Upvotes: 0

Views: 225

Answers (1)

ChrisF
ChrisF

Reputation: 137158

You are including the application name as part of the Arguments.

Try the following:

Dim p As New Process
p.StartInfo.Arguments = "/U:""C:\Program Files\ProCharge Plugin\irunin.xml"""
p.Start("C:\WINDOWS\ProCharge Plugin\uninstall.exe")

Where you pass the name of the executable to the Start method.

Another alternative is to use the FileName property:

Dim p As New Process
p.StartInfo.FileName = "C:\WINDOWS\ProCharge Plugin\uninstall.exe"
p.StartInfo.Arguments = "/U:""C:\Program Files\ProCharge Plugin\irunin.xml"""
p.Start()

Check the MSDN page for more information on the various overloads.

Upvotes: 2

Related Questions