Hi, Raf
you can do this. Recently people discussed here redirection and capture of
dos commands results - Shell() -? posts.
Thanks to Henry Craven - you can try this sample code - just change called
program and arguments:
Dim ProcID As Integer
Dim sSource As String = "D:\Data\Test"
Dim sDest As String = "D:\VB"
Dim sShell As String = "E:\winnt\System32\xcopy.exe"
Dim s As String = ""
'Try
Dim p As New Process
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.Arguments = "D:\Data\Test D:\VB /e /d /h /o /v"
p.StartInfo.WorkingDirectory = "E:\winnt\system32"
p.StartInfo.FileName = "xcopy"
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
Dim sinput As String = ""
Do Until sinput = "-1"
sb.Append(sr.ReadLine() & ControlChars.CrLf)
sinput = sr.Read
Loop
Dim sw As New IO.StreamWriter("C:\test2.txt")
sw.Write(sb.ToString)
Me.Close()
--
Henry Craven
"Raf" <No****@noserver.no> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
Hello to the pros,
I have to create an application that performs a "Ping" to an IP-address.
The result (successfull or not successfull)
should be captured by the application and should be shown to the user.
I know that you can perform dos-commands with the SHELL-command.
But is there a possibility to catch the result of this ping-command if I
do it like this.
Does anyone have some suggestions?
Thanks in advance,
Regards,
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.667 / Virus Database: 429 - Release Date: 23-04-04