Click here to Skip to main content
16,013,338 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Prevent Logoff in Vb.net Pin
Dave Kreskowiak16-Oct-07 12:29
mveDave Kreskowiak16-Oct-07 12:29 
GeneralRe: Prevent Logoff in Vb.net Pin
Patrick Etc.16-Oct-07 15:03
Patrick Etc.16-Oct-07 15:03 
GeneralRe: Prevent Logoff in Vb.net Pin
Legion988917-Oct-07 4:49
Legion988917-Oct-07 4:49 
QuestionGet array from DGV column Pin
cstrader23215-Oct-07 11:46
cstrader23215-Oct-07 11:46 
AnswerRe: Get array from DGV column Pin
Dave Kreskowiak15-Oct-07 12:20
mveDave Kreskowiak15-Oct-07 12:20 
QuestionHow can I send command line and read the responses? Pin
ATC15-Oct-07 10:04
ATC15-Oct-07 10:04 
AnswerRe: How can I send command line and read the responses? Pin
Dave Kreskowiak15-Oct-07 10:09
mveDave Kreskowiak15-Oct-07 10:09 
AnswerRe: How can I send command line and read the responses? Pin
DigiOz Multimedia15-Oct-07 10:18
DigiOz Multimedia15-Oct-07 10:18 
ATC wrote:
I have to execute an application (ie: c:\applications\task1.exe). I have to send some different commands and wait for the responses. Some responses are fast and has only few lines, some will take long time to execute but response every second with a dot until it completed

I would line to send command line through VB environment (might be with Shell (...) command?), but able to capture the responses without waiting it completed (to monitor its processes)

Anyone can show me how to do it?


Here is an example, which executes the "cmd.exe" (command line executable), gets a directory listing, and displays the result in a messagebox:

VB
Dim ps1 As New Process
ps1.StartInfo.FileName = "cmd.exe"
ps1.StartInfo.WindowStyle = ProcessWindowStyle.Normal
ps1.StartInfo.CreateNoWindow = False
ps1.StartInfo.UseShellExecute = False
ps1.StartInfo.RedirectStandardOutput = True
ps1.StartInfo.RedirectStandardInput = True
ps1.Start()

Dim s As String
Dim sIn As StreamWriter = ps1.StandardInput
Dim sOut As StreamReader = ps1.StandardOutput
sIn.AutoFlush = True

sIn.Write("dir /p" & System.Environment.NewLine)
s = sOut.ReadToEnd()
MessageBox.Show(s)


Don't forget to "Imports System.IO" for this. I hope this helps. Smile | :)



Pete Soheil
DigiOz Multimedia
http://www.digioz.com

GeneralRe: How can I send command line and read the responses? Pin
ATC15-Oct-07 10:29
ATC15-Oct-07 10:29 
GeneralRe: How can I send command line and read the responses? Pin
DigiOz Multimedia15-Oct-07 10:35
DigiOz Multimedia15-Oct-07 10:35 
GeneralRe: How can I send command line and read the responses? [modified] Pin
ATC16-Oct-07 4:24
ATC16-Oct-07 4:24 
GeneralRe: How can I send command line and read the responses? Pin
DigiOz Multimedia16-Oct-07 9:04
DigiOz Multimedia16-Oct-07 9:04 
GeneralRe: How can I send command line and read the responses? Pin
ATC16-Oct-07 9:42
ATC16-Oct-07 9:42 
Questionadding .cpp file in vb.net Pin
manni_n15-Oct-07 8:44
manni_n15-Oct-07 8:44 
AnswerRe: adding .cpp file in vb.net Pin
DigiOz Multimedia15-Oct-07 9:57
DigiOz Multimedia15-Oct-07 9:57 
QuestionSet Default Download Manager ? Pin
Dan Suthar15-Oct-07 6:28
professionalDan Suthar15-Oct-07 6:28 
AnswerRe: Set Default Download Manager ? Pin
Dave Kreskowiak15-Oct-07 10:07
mveDave Kreskowiak15-Oct-07 10:07 
GeneralRe: Set Default Download Manager ? Pin
Dan Suthar15-Oct-07 14:52
professionalDan Suthar15-Oct-07 14:52 
GeneralRe: Set Default Download Manager ? Pin
Dave Kreskowiak15-Oct-07 17:24
mveDave Kreskowiak15-Oct-07 17:24 
GeneralRe: Set Default Download Manager ? Pin
Dan Suthar15-Oct-07 18:03
professionalDan Suthar15-Oct-07 18:03 
GeneralRe: Set Default Download Manager ? Pin
Dave Kreskowiak16-Oct-07 1:11
mveDave Kreskowiak16-Oct-07 1:11 
GeneralRe: Set Default Download Manager ? Pin
Dan Suthar16-Oct-07 5:55
professionalDan Suthar16-Oct-07 5:55 
QuestionDarkness windows when change the opacity value Pin
haggenx15-Oct-07 6:09
haggenx15-Oct-07 6:09 
AnswerRe: Darkness windows when change the opacity value Pin
Dan Suthar15-Oct-07 6:37
professionalDan Suthar15-Oct-07 6:37 
GeneralRe: Darkness windows when change the opacity value Pin
haggenx16-Oct-07 8:10
haggenx16-Oct-07 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.