0
有很多程序的,所以如果我知道它的GUID值如何卸載使用msiexec.exe的從C#如何使用MSIEXEC與程序GUID傳遞用C#參數傳遞給卸載程序
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();
}
如果您只需要調用msiexec的正確方法,那麼這不是真正的C#問題,是嗎?它是'msiexec/x {guid}'https://support.microsoft.com/en-us/kb/296067 – hometoast
我想用c#調用msiecec併發送卸載值作爲參數 – toorroot
所以使用字符串連接!另外,給我們一個「路徑」可能的例子。 –