Getting command prompt result into textbox

K

kimiraikkonen

Hello,
I have a textbox named "textbox1" and a button named "button1"

How can i retrieve the console (cmd) data into textbox?

For example when i run Shell("cmd.exe /k dir c:\",AppWinStyle.Hide)
when pressed button1, i want the result is displayed into textbox.

Thanks
 
M

Michel Posseth [MCP]

instead of using shell use the process class

then

p.Start
dim reader as streamreader = p.standardoutput
p.waitforexit
messagebox.show(reader.readtoend)

hth

Michel
 
K

kimiraikkonen

Set it as parameters in your constructor and use the values.

Cor

"kimiraikkonen" <[email protected]> schreef in bericht






- Show quoted text -

Could you define more?

I'm newbie. When i use system.process.diagnostics.start("cmd.exe /k
dir c:"), i get "cannot find specified file" error while debuggin. If
i use Shell("cmd.exe /k dir c:\",AppWinStyle.Hide), no problems for
running, but i cannot get the results as texts into my textbox.
 
K

kimiraikkonen

instead of using shell use the process class

then

p.Start
dim reader as streamreader = p.standardoutput
p.waitforexit
messagebox.show(reader.readtoend)

hth

Michel

"kimiraikkonen" <[email protected]> schreef in bericht






- Show quoted text -

Did it but got error : "standard output has not been redirected"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top