The ONLY way I have found around this so far is to use the following
command as the last line of each batch file 'Exit %errorlevel%'.
I have tried setting the FileName property of my Proces object to the
batch file itself and launching it through 'CMD /C', niether work.
Here is basically what I am doing:
System.Diagnostics.Process oProcess = new
System.Diagnostics.Process();
oProcess.StartInfo.CreateNoWindow = false;
oProcess.StartInfo.UseShellExecute = false;
oProcess.EnableRaisingEvents = false;
oProcess.StartInfo.FileName = "TempCommands.bat";
oProcess.Start();
oProcess.WaitForExit();
if (oProcess.ExitCode != 0)
{
// NEVER GETS HERE!!!!
}
I would think that the error code is zero because the command line
process executed successfully, which is what is really calling the batch
file.
Instead, I would process the output from the batch file, and process the
code yourself through the StandardError, StandardInput, StandardOutput
properties.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nicholas...@exisconsulting.com
"Vance Kessler" <vkes...@peachtree.com> wrote in message
news:aeaf260b.03042...@posting.google.com...
And I cannot really process the output of the batch file because it
sends out A LOT of output (potentially to both StdOut and StdErr).
Oh, and I guess you figured out some important information that I had
failed to mention, I am running this on Win2000 and WinXP.
"Nicholas Paldino [.NET/C# MVP]" <nicholas...@exisconsulting.com> wrote in message news:<ucPadvaC...@TK2MSFTNGP11.phx.gbl>...
openvpn --management-query-passwords --cd "C:\Program Files\OpenVPN
\config" --management-hold --management 127.0.0.1 7536 --config "C:
\Program Files\OpenVPN\config\client.ovpn" --auth-user-pass
then i have to open one more command and execute this command
telnet
open localhost 7536
username Auth manoj
password Auth manoj
then u can see some thing happening in first command prompt
then i have to open 3rd command prompt and execute this one ipconfig
then it returns ip of the serve that should be display in text file
can any help it out
pls reply me to manoj...@gmail.com
You could try to use the RedirectStandardXXXX properties of the
ProcessStartInfo. It might work but it's not that easy (I think).
Additionally you could use a third party telnet client. nSoft has one and
I'm pretty sure that you can find some free ones.
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"manoj" <manoj...@gmail.com> wrote in message
news:e19292fc-19d9-4462...@k2g2000hse.googlegroups.com...