2016-04-12 13 views
0

i kendi guid değerini biliyorsanız ben C#C# ile bir argüman iletilmesi programı guid ile msiexec kullanarak Program kaldır Nasıl

public void msi(string path) 
    { 
     //get msiexec.exe /X{GUID} from path 
     int slash = path.IndexOf(@"/"); 
     //get the substring as /I{GUID} 
     String value = path.Substring(slash, (path.Length) - slash); 
     MessageBox.Show(value); 
     Process process = new Process(); 
     process.StartInfo.FileName = @"msiexec.exe"; 

     process.StartInfo.Arguments = string.Format(value);//Error is in this line 
     //`i just want to know how to pass the agrument to msiexec from c#` 


     process.StartInfo.UseShellExecute = false; 
     process.StartInfo.RedirectStandardInput = true; 
     process.StartInfo.RedirectStandardOutput = true; 
     process.StartInfo.RedirectStandardError = true; 
     process.StartInfo.CreateNoWindow = false; 
     process.Start(); 
     process.WaitForExit(); 

    } 
+2

için çalışıyor? Msiexec/x {guid} 'https://support.microsoft.com/tr-tr/kb/296067 – hometoast

+0

msiecec ile C# 'ı çağırmak ve kaldırma değerini – toorroot

+0

argüman olarak göndermek istiyorum. Ayrıca, bize yolun ne olabileceğine dair bir örnek verin. –

cevap

0

sayesinde herkesten msiexec.exe kullanarak kaldırabilirsiniz nasıl bu programın çok var destek için bu kod, sen msiexec çağırmak için doğru yolu gereken tüm, o zaman bu gerçekten C# soru değilse bana

 Process p = new Process(); 
     p.StartInfo.FileName = "msiexec.exe"; 
     //The argument that you want to give 
     p.StartInfo.Arguments = "/X{0784DF00-13E1-40D1-8BC4-E081AD2DA509}"; 
     p.Start(); 
İlgili konular