मैं एक स्ट्रिंग के रूप प्रक्रिया प्रतिक्रिया प्राप्त करने के लिए इसलिए मैं अपने कोड में विभिन्न जगह में उपयोग कर सकते हैं कोशिश कर रहा हूँ, यह समाधान है कि मैं अब तक है:"सिस्टम निर्दिष्ट फाइल नहीं ढूंढ सकता" प्रक्रिया पर त्रुटि। स्टार्ट();
const string ex1 = @"C:\Projects\MyProgram.exe ";
const string ex2 = @"C:\Projects\ProgramXmlConfig.xml";
Process process = new Process();
process.StartInfo.WorkingDirectory = @"C:\Projects";
process.StartInfo.FileName = "MyProgram.exe ";
process.StartInfo.Arguments = ex2;
process.StartInfo.Password = new System.Security.SecureString();
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
try
{
process.Start();
StreamReader reader = process.StandardOutput;
string output = reader.ReadToEnd();
}
catch (Exception exception)
{
AddComment(exception.ToString());
}
लेकिन जब मैं इस मैं चल रहा हूँ मिलती है:
"The system cannot find the file specified" error in process.Start(); without process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true;
कोड ठीक चलता है, लेकिन यह सिर्फ खुले कंसोल विंडो और सभी प्रक्रिया प्रतिक्रिया वहाँ Trow है तो मैं स्ट्रिंग के रूप में उपयोग नहीं कर सकते।
किसी को पता कारण है कि मैं इस त्रुटि या शायद मेरी समस्या के लिए एक अलग समाधान हो रही है?
यह काम किया! धन्यवाद ! –
@DariaShalimov अगर यह आपके सवाल का जवाब इस सवाल का जवाब – Jamaxack
के रूप में चिह्नित है, मैं ऐसा कर सकते हैं कैसे? –