Read/Send Data From Command Line app
Hi
Im writing a small utill for my self basicly to see if it can be done, but ive ran into a small problem, Im using Plink for a ssh connection whilst i can successfuly connect to the remote box with some thing like this:
VB Code:
Dim Location as String
Dim commands as String
Dim username as String
Dim serverip as String
Dim password as String
username = txtUserName.Text
serverip = txtServer.Text
Location = "C:\plink"
commands = " -ssh -pw " + password & username + "@" + serverip
password = txtPassword.text
Shell Location + commands
This connects and sends password with no problems how ever i choose to hide the command prompt as i dont know how to implement it into my app (yet :) and may not want to use the cli at all) now that the connection is working i would like away of reading whats comming from the remote host plus the ability to send data to the remote host too.
The problem is i cannot seem to find away of reading or sending data to and from the reomte server. I did think about using winsock.getdata and senddata but im not too sure if this would work and if it did how to get it to do that with the connection already working, could some one please help me to see a way of been able to read and send data Please.
Thanks for the time
Ixl2
Re: Read/Send Data From Command Line app
You could pipe the results into a file. Use > to overwrite, or >> to append.
Then you'd have to read it back into your app.
VB Code:
Option Explicit
Private Sub Form_Load()
Shell ("C:\Windows\System32\cmd.exe /c " & _
"C:\Windows\System32\ipconfig >> d:\myip.txt"), vbHide
End Sub
Re: Read/Send Data From Command Line app
Thanks for the repliy.
Is that the only way? i was hoping to be able to store the information that came from plink into a veriable of some sort then have that displayed in my app is there a way to display cmd inside my app? kind of like incorperate it.
Re: Read/Send Data From Command Line app
Just read the file, and display it.
Re: Read/Send Data From Command Line app
Quote:
Originally Posted by Ixl2
Thanks for the repliy.
Is that the only way? i was hoping to be able to store the information that came from plink into a veriable of some sort then have that displayed in my app is there a way to display cmd inside my app? kind of like incorperate it.
If it is creating an text file, then just read the contents of that text file into a multline textbox or a listbox in your app.
Re: Read/Send Data From Command Line app
Hi
Well thanks for the repliys truly greatful :D, how ever im not keen on the idea of putting the info into a text file and then reading the result, so i think its time to buy one of the activex/dll ssh classes ive seen.
Any way thanks for the help.