SnippetCollection
Forums  
Links
 
Support
 


snippetCollection.com Forum Index FAQ Memberlist Search Usergroups Profile Log in to check your private messages Log in Register
Welcome to SnippetCollection.com, a friendly and fast growing community of programmers, coders, web application developers and more. You are currently viewing our forums as a guest!

This message will go away once you are registered. Also, by registering you will have access to all post topics, communicate privately with other members (PM), respond to polls and access other special features. Registration is fast, simple and absoultely free so please Click Here to join our community

Enjoy our great collection of snippets and tutorials!

Log in
Username:
Password:

 

Our Sponsors
           
Want to list your business here. Contact us.
 Run a command line and wait for results View next topic
View previous topic
Post new topic Reply to topic
Author Message
mangu



Joined: 08 Mar 2006
Posts: 12

PostPosted: Sat Mar 18, 2006 6:59 pm Reply with quoteBack to top

Snippet shows how to execute a command line and wait for the process to terminate and return results.

Code:
    Private Sub Button2_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles Button2.Click
        Dim psi As New _
            System.Diagnostics.ProcessStartInfo("C:\listfiles.bat")
        psi.RedirectStandardOutput = True
        psi.WindowStyle = ProcessWindowStyle.Hidden
        psi.UseShellExecute = False
        Dim listFiles As System.Diagnostics.Process
        listFiles = System.Diagnostics.Process.Start(psi)
        Dim myOutput As System.IO.StreamReader _
            = listFiles.StandardOutput
        listFiles.WaitForExit(2000)
        If listFiles.HasExited Then
            Dim output As String = myOutput.ReadToEnd
            Debug.WriteLine(output)
        End If
    End Sub
Display posts from previous:      
Post new topic Reply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme
All times are GMT