B
bbembi_de
Hello everyone,
I have a C# program that runs a batch from the command line.
I use the following code for that:
String arguments = "/C CALL batchfile.bat";
ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe");
startInfo.Arguments = arguments;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
Process p = Process.Start(startInfo);
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
p.WaitForExit();
This works just fine.
But as soon as I use a OpenFilerDialog in my Program the batch won't
work any more.
OpenFileDialog fileDlg = new OpenFileDialog();
fileDlg .Filter = "PDF|*.pdf|Word|*.doc|All|*.*" ;
fileDlg .FilterIndex = 1 ;
if(fileDlg .ShowDialog() == DialogResult.OK)
{
Stream myStream = null;
if((myStream = fileDlg .OpenFile()) != null)
{
...
myStream.Close();
}
}
Any ideas?
Thanks in advance.
Greetings juergen
I have a C# program that runs a batch from the command line.
I use the following code for that:
String arguments = "/C CALL batchfile.bat";
ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe");
startInfo.Arguments = arguments;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
Process p = Process.Start(startInfo);
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
p.WaitForExit();
This works just fine.
But as soon as I use a OpenFilerDialog in my Program the batch won't
work any more.
OpenFileDialog fileDlg = new OpenFileDialog();
fileDlg .Filter = "PDF|*.pdf|Word|*.doc|All|*.*" ;
fileDlg .FilterIndex = 1 ;
if(fileDlg .ShowDialog() == DialogResult.OK)
{
Stream myStream = null;
if((myStream = fileDlg .OpenFile()) != null)
{
...
myStream.Close();
}
}
Any ideas?
Thanks in advance.
Greetings juergen