473,473 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Process standard output

Dim pr As New System.Diagnostics.Process()
Dim output as string

pr.StartInfo.FileName = "notepad.exe"
pr.StartInfo.UseShellExecute = False
pr.StartInfo.RedirectStandardOutput = True
pr.Start()
pr.WaitForExit()
Output = pr.StandardOutput.ReadToEnd

With the above code you should get on output variable
anything you wrote on notepad before you close it. I
couldn't make it works. Did I miss something? I read a lot
and I could'nt found an answer. Please I need the solution
or other source of information.

Thanks, Veronica
Jul 21 '05 #1
1 1510
The problem might be that you need to read the StdOut before the WaitForExit
(this is explained in the MSDN documentation) otherwise the pipe can fill up
and hang both apps. What exactly is happening with your program? Is it
hanging or are you just getting nothing in Output?

"Veronica" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Dim pr As New System.Diagnostics.Process()
Dim output as string

pr.StartInfo.FileName = "notepad.exe"
pr.StartInfo.UseShellExecute = False
pr.StartInfo.RedirectStandardOutput = True
pr.Start()
pr.WaitForExit()
Output = pr.StandardOutput.ReadToEnd

With the above code you should get on output variable
anything you wrote on notepad before you close it. I
couldn't make it works. Did I miss something? I read a lot
and I could'nt found an answer. Please I need the solution
or other source of information.

Thanks, Veronica

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
2
by: mwazir | last post by:
Hi all, I have reposted this question from dotnet.general as I have been advised that this is a more appropriate forum for this question. Apologies for the repost. I have a process thats...
3
by: Bo | last post by:
In my asp.net webservice application, I need to launch a DOS process as authorized users. To impersonate users, I use <impersonation = true> in my webconfig. I can't use Diagnostics.Process.Start,...
2
by: Brian | last post by:
I'm running a dos program via System.Diagnostics.Process. The dos program is very picky about filenames and such, and so I want to show the output to the user so they can verify it did what it...
3
by: iforsyth | last post by:
Hi. Running an app with System.Diagnostics.Process process with: Sample code: myproc = New System.Diagnostics.Process() strPgm = "myapp.exe" strArgs = "" myproc.StartInfo = New
2
by: mwazir | last post by:
Hi all, I have a process thats starts in my application and only terminates when my application is terminated. I want to write the output and the errors of this process to a seperate log file....
4
by: Andy | last post by:
I am calling out to an executable using the System.Diagnostics.Process methods and specifically attempting to trap for errors (at least trying to learn how to trap for errors). I arranged the data...
1
by: stemp1ar | last post by:
I am wondering if it possible to open a single process and run multiple commands on that process and check standard error and standard out after each command? Has anyone done something similar...
1
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a C# application in which I start another process which produces output to stdout and stderr. In fact, that process is the uSoft VS2005 C/C++ compiler itself! I would like to...
2
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I'm trying to run a process and catch it's output and display it in a richTextBox. the process I'm running, runs some other processes, I'm using Thread to run this process, my problem is,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.