B
Bala Nagarajan
Hello,
I am having issues when i use the Systsem.Diagnostics.Process
namespace to start a process. The problem is that i am able to succeed in
starting a process (an exe) only few times in a row from a windows
application before it fails throwing the following exception. (The exe i am
trying to run is in the same directory as the application.)
System.ComponentModel.Win32Exception
The system cannot find the file specified
System.ComponentModel.Win32Exception: The system cannot find the file
specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startInfo)
at System.Diagnostics.Process.Start()
I have no idea why it would succeed the first few times and fail then. I am
posting the code i am am using.
System.Diagnostics.Process normComm = new System.Diagnostics.Process();
string pathEXE = "myprog.exe";
System.Diagnostics.ProcessStartInfo startInfo = new
System.Diagnostics.ProcessStartInfo(Environment.CurrentDirectory + @"\" +
pathEXE);
string args = "argument";
startInfo.WorkingDirectory = Environment.CurrentDirectory;
startInfo.Arguments = args;
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
normComm.StartInfo = startInfo;
try
{
normComm.Start(); //exception here
}
Any thoughts???Any help will be greatly appaerciated as i am unable to get a
breakthrough on this issue.
Thanks
Bala
I am having issues when i use the Systsem.Diagnostics.Process
namespace to start a process. The problem is that i am able to succeed in
starting a process (an exe) only few times in a row from a windows
application before it fails throwing the following exception. (The exe i am
trying to run is in the same directory as the application.)
System.ComponentModel.Win32Exception
The system cannot find the file specified
System.ComponentModel.Win32Exception: The system cannot find the file
specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startInfo)
at System.Diagnostics.Process.Start()
I have no idea why it would succeed the first few times and fail then. I am
posting the code i am am using.
System.Diagnostics.Process normComm = new System.Diagnostics.Process();
string pathEXE = "myprog.exe";
System.Diagnostics.ProcessStartInfo startInfo = new
System.Diagnostics.ProcessStartInfo(Environment.CurrentDirectory + @"\" +
pathEXE);
string args = "argument";
startInfo.WorkingDirectory = Environment.CurrentDirectory;
startInfo.Arguments = args;
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
normComm.StartInfo = startInfo;
try
{
normComm.Start(); //exception here
}
Any thoughts???Any help will be greatly appaerciated as i am unable to get a
breakthrough on this issue.
Thanks
Bala