Results 1 to 3 of 3

Thread: Getting a value back from a shell command$

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Question Getting a value back from a shell command$

    Ok,

    Suppose I send a file to another exe using a command$ (from within my program) - how do I get a string in return??

    Cheers,
    Vbnewbie.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Re: Getting a value back from a shell command$

    Oh, to clarify - the program being called is also made by me in VB.net...

  3. #3
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: Getting a value back from a shell command$

    VB Code:
    1. Dim y As New ProcessStartInfo("ipconfig", "/all")
    2.  
    3.         y.CreateNoWindow = True ' do not show a window
    4.         y.RedirectStandardOutput = True ' Needed to get the output
    5.         y.UseShellExecute = False
    6.  
    7.         Dim x As Process = Process.Start(y)
    8.  
    9.         x.StartInfo = New ProcessStartInfo("ipconfig", "/all")
    10.         Dim output As String = x.StandardOutput.ReadToEnd
    11.  
    12.  
    13.         MsgBox(output)
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width