To execute a command with arguments, you have to use the Process.Start(string fileName, string argument)
overload and pass the arguments to the second parameters.
UninstallVSPackage = Process.Start(VSIXInstallerPath, "/u:GUID /quiet");
题
I am trying to run the process to uninstall a certain VS Extension with on a quite mode and it seems the arguments won't pass.
string VSIXInstallerPath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config", "VSIXInstallerLocation", null);
Process UninstallVSPackage = new Process();
UninstallVSPackage = Process.Start(VSIXInstallerPath + " " + (@"/u:GUID /quiet"));
And this is the error I get:
The system cannot find the file specified
When I run from Command Prompts it does work.
解决方案
To execute a command with arguments, you have to use the Process.Start(string fileName, string argument)
overload and pass the arguments to the second parameters.
UninstallVSPackage = Process.Start(VSIXInstallerPath, "/u:GUID /quiet");