|
-
Nov 19th, 2005, 08:30 PM
#1
Thread Starter
Junior Member
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
-
Nov 21st, 2005, 09:24 PM
#2
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
-
Nov 22nd, 2005, 07:58 AM
#3
Thread Starter
Junior Member
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.
-
Nov 22nd, 2005, 12:49 PM
#4
Re: Read/Send Data From Command Line app
Just read the file, and display it.
-
Nov 22nd, 2005, 01:08 PM
#5
Re: Read/Send Data From Command Line app
 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.
-
Nov 22nd, 2005, 06:24 PM
#6
Thread Starter
Junior Member
Re: Read/Send Data From Command Line app
Hi
Well thanks for the repliys truly greatful , 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|