Link to home
Start Free TrialLog in
Avatar of RobertoFreemano
RobertoFreemanoFlag for United Kingdom of Great Britain and Northern Ireland

asked on

textbox to CMD.exe vb.net (2003)

Hi Experts,

I've created a little notepad clone... What I want to do is to be able to write the word - 'ping' followed by 'UNC' and on carriage return... launch CMD.exe and be able to ping that UNC. or to be able to highlight the word 'ping unc' and click a button which will do the same.

I've created the winform with a textbox and a button. It also has a process which launches CMD.exe. But haven't managed to get the selected text to populate cmd.

I've tried console.writeline(textbox1.text)
console.Readline()

But didn't work  :(

Any ideas?
Roberto
I may increase points as I'm sure i have a few tweaks to add...
Avatar of RobertoFreemano
RobertoFreemano
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Just to add, it would be good if an ordinary word was typed and carriage returns - it would simply act like a text file... only the 'ping and a unc path is entered... if possible.

:)
Thanks cookre,

I will try that code out in a mo.

:)
Just to make myself a little clearer,

I'm aiming a producing a textbox in which I type in a specific string = "ping 192.168.0.1'... once i press spacebar, the string will become a link which if clicked, it would open a application like CMD.exe.

the word ping would have to be defind...
Thanks Cookre,

That worked, But is there a way of repeating that once a carriage-return is entered in the textbox?

If I type <ping 192.168.0.1>: it opens cmd.exe and pings that address, GREAT... but once I close cmd.exe and type a new line> ping 172.68.5.1 in the textbox... it refers back to the top line of the textbox = <ping 192.168.0.1>

Any ideas?

Roberto
Do a textbox.Clear() after running the command.
Hi Cookre,

That will clear the entire contents of the textbox... sorry, I should have mentioned that the textbox is multilined as I want to continue typing into it.

Is this possible?
Roberto
Also, is there a way keeping the CMD.exe shell open whilst going back to my form...

It seems to egg-timer on the form until the Shell is closed.

Regards,
Roberto
ASKER CERTIFIED SOLUTION
Avatar of cookre
cookre
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial