By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,009 Members | 1,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,009 IT Pros & Developers. It's quick & easy.

Spawning Another Process??

P: n/a
I'm trying to execute a DOS program from within VB.NET. Of course, I
used to simply use Shell(), but that doesn't seem to work even when I
import the VisualBasic namespace. Here's the code I'm using now:

Debug.WriteLine("in here")
System.Diagnostics.Process.Start("c:\NetCdf\ncdump .exe", " Test.nc >>
fromprog.txt")
Debug.WriteLine("in there")
Both diagnostic lines print out, and there is no error message, yet
the call to Process.Start seems to do nothing. If I go to the \NetCdf
directory and type:

ncdump test.nc >> fromprog.txt

I get the results I want, which is the info from test.nc dumped into
an ASCII text file. Does anyone have any idea why this won't work?

Thanks in advance for your help.
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
* ce****@chesapeakebay.net (Remulac) scripsit:
I'm trying to execute a DOS program from within VB.NET. Of course, I
used to simply use Shell(), but that doesn't seem to work even when I
import the VisualBasic namespace. Here's the code I'm using now:

Debug.WriteLine("in here")
System.Diagnostics.Process.Start("c:\NetCdf\ncdump .exe", " Test.nc >>
fromprog.txt")
Debug.WriteLine("in there")
Both diagnostic lines print out, and there is no error message, yet
the call to Process.Start seems to do nothing. If I go to the \NetCdf
directory and type:

ncdump test.nc >> fromprog.txt

I get the results I want, which is the info from test.nc dumped into
an ASCII text file. Does anyone have any idea why this won't work?


Start "cmd.exe" and pass the command to the command line:

<URL:http://dotnet.mvps.org/dotnet/samples/miscsamples/downloads/RedirectConsole.zip>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2

P: n/a
On 4 Jun 2004 07:25:38 -0700, Remulac wrote:

Debug.WriteLine("in here")
System.Diagnostics.Process.Start("c:\NetCdf\ncdump .exe", " Test.nc >>
fromprog.txt")
Debug.WriteLine("in there")
Both diagnostic lines print out, and there is no error message, yet
the call to Process.Start seems to do nothing. If I go to the \NetCdf
directory and type:

ncdump test.nc >> fromprog.txt


In addition to Herfrieds comments, have a look at the ProcessStartInfo
class, specifically the RedirectStandardOutput property.

Redirecting the output using the >> as you are trying to do is only
understood by the cmd.exe, not the ncdump.exe app.

--
Chris

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.