473,432 Members | 1,340 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

ProcessStartInfo

Hi,

Can you let me know why this won't display the standard output on console?

Thanks

Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("ipconfig" );

myProcessStartInfo.Arguments="/all";

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.RedirectStandardOutput = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

StreamReader myStreamReader = myProcess.StandardOutput;

// Read the standard output of the spawned process.

string myString = myStreamReader.ReadLine();

Console.WriteLine(myString);

myProcess.Close();
Nov 15 '05 #1
1 7274
hi,
you just need to replace :
string myString = myStreamReader.ReadLine();
to
string myString = myStreamReader.ReadToEnd();

hope this helps.

--
gani
pls visit http://thedeveloperscorner.com.ph


"nospam" <he***@hotmail.com> wrote in message
news:FY********************@giganews.com...
Hi,

Can you let me know why this won't display the standard output on console?

Thanks

Process myProcess = new Process();

ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("ipconfig" );

myProcessStartInfo.Arguments="/all";

myProcessStartInfo.UseShellExecute = false;

myProcessStartInfo.RedirectStandardOutput = true;

myProcess.StartInfo = myProcessStartInfo;

myProcess.Start();

StreamReader myStreamReader = myProcess.StandardOutput;

// Read the standard output of the spawned process.

string myString = myStreamReader.ReadLine();

Console.WriteLine(myString);

myProcess.Close();

Nov 15 '05 #2

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

Similar topics

0
by: Stedak | last post by:
My application seems to freeze when Microsoft Office Document Imaging is set as the default for loading images. If the Windows Picture and Fax Viewer is used there is no problem. When I set a break...
0
by: Matt | last post by:
I am running a exe from command line in my application and when I use ProcessStartInfo it seems to duplicate all the commands within the function. for instance I write a file. Without my...
2
by: Eranga | last post by:
I have a windows application in C# which has the following method public void InitiateSession(string server,string userName, string passWd ) { //To start the command...
0
by: MadCrazyNewbie | last post by:
Hi Group, I have the following code, but not sure if this is write, I would like to be able with the View code, for the document to be opened eg. C:\test.Doc and with the PRint button for it to...
1
by: Philip Wagenaar | last post by:
How do I set the string "myPass" for ProcessStartInfo.Password? Dim instance As ProcessStartInfo instance.Password "myPass" 'This is no good because its System.Security.String instance.UserName...
1
by: Vinny Vinn | last post by:
I am using the following C# code to print a PDF to a network printer. The document prints in portrait mode, I would like the document to print in Landscape mode. Is there/What is the argument that...
1
by: porsch55 | last post by:
m_oProc = new Process(); ProcessStartInfo oInfo; oInfo = new ProcessStartInfo("\\\\" + sSourceServer + "\\" + Environment.SystemDirectory.Replace("C:", "C$") + "\\psexec.exe", " \...
1
by: sunny | last post by:
Hi all We have a pdf user manual which we open when client clicks on help button. some of our clients have the issue that it does not open the file and it says file not found. checked with...
2
by: =?Utf-8?B?TWljaGVsbGUgTWFiZWxsZQ==?= | last post by:
I have the code below. It will open and print the pdf file (test.pdf) to the printer. ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = true; startInfo.Verb =...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.