My wpf application calls a python script to generate output which is later displayed in the UI. To avoid crashing of the application if python is not installed on user's system, I need to perform a check. Currently I have achieved that using the following
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"cmd.exe"; // Specify exe name.
start.Arguments = "python --version";
start.UseShellExecute = false;
start.RedirectStandardError = true;
using (Process process = Process.Start(start))
{
using (StreamReader reader = process.StandardError)
{
string result = reader.ReadToEnd();
MessageBox.Show(result);
}
}
This does the job but causes a momentary appearance of the cmd black window which is highly undesired. Is there a workaround to achieve this or a fix to avoid the appearance of the window?