G
George Lake
Ok,
I tested it in VB and returns nothing. Output is nothing.
I am using impersonation (as a domain admin).
Dim p As New Process
' #tells operating system not to use a shell;
p.StartInfo.UseShellExecute = False
'#allow me to capture stdout, i.e. results
p.StartInfo.RedirectStandardOutput = True
'Say DOS Command is [EXEPath] CONNECT anotherargument
p.StartInfo.Arguments = "CONNECT anotherargument"
p.StartInfo.FileName = "qwinsta.exe"
'#do not show MSDOS window
p.StartInfo.CreateNoWindow = True
'#do it!
p.Start()
Dim _processID As System.Int32 = p.Id
'#capture results
Dim output As String = p.StandardOutput.ReadToEnd()
' this is the output from the
p.WaitForExit()
p.Close()
I tested it in VB and returns nothing. Output is nothing.
I am using impersonation (as a domain admin).
Dim p As New Process
' #tells operating system not to use a shell;
p.StartInfo.UseShellExecute = False
'#allow me to capture stdout, i.e. results
p.StartInfo.RedirectStandardOutput = True
'Say DOS Command is [EXEPath] CONNECT anotherargument
p.StartInfo.Arguments = "CONNECT anotherargument"
p.StartInfo.FileName = "qwinsta.exe"
'#do not show MSDOS window
p.StartInfo.CreateNoWindow = True
'#do it!
p.Start()
Dim _processID As System.Int32 = p.Id
'#capture results
Dim output As String = p.StandardOutput.ReadToEnd()
' this is the output from the
p.WaitForExit()
p.Close()
Swanand Mokashi said:Here is a sample in C# -- you can use it in business layer and the output
below can be shown on the ASP.NET page
//-----------------Start
/ #start a new process
Process p = new Process();
// #tells operating system not to use a shell;
p.StartInfo.UseShellExecute = false;
//#allow me to capture stdout, i.e. results
p.StartInfo.RedirectStandardOutput = true;
//Say DOS Command is [EXEPath] CONNECT anotherargument
p.StartInfo.Arguments = "CONNECT anotherargument";
p.StartInfo.FileName =[EXEPath];
//#do not show MSDOS window
p.StartInfo.CreateNoWindow = true;
//#do it!
p.Start();
System.Int32 _processID = p.Id;
//#capture results
string output = p.StandardOutput.ReadToEnd(); // this is the output from
the command
//#wait for all results.
p.WaitForExit();
p.Close();
//-----------------End
HTH
--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)
http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...
http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
George Lake said:ASP.NET