Renci SSH Problem
-
Hello Friend I am making a GUI for my vpn in visual basic and I am getting a problem when I am using ("perl something.pl" + somehting + something1 + something2) but when I am using ("perl something.pl something1value something2value") everything is working fine any solution please Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim IP As String = "xxx.xxx.xxx.xxx" Dim Username As String = "root" Dim Password As String = "mypassword" Dim cmd As Renci.SshNet.SshCommand Dim connInfo As New Renci.SshNet.PasswordConnectionInfo(IP, Username, Password) Dim sshClient As New Renci.SshNet.SshClient(connInfo) Dim something As String = TextBox1.Text Dim something1 As String = TextBox2.Text Dim something2 As String = TextBox3.Text sshClient.Connect() cmd = sshClient.RunCommand("perl something.pl" +something + something1 + something2) Label1.Text = cmd.Result End Sub End Class
-
Hello Friend I am making a GUI for my vpn in visual basic and I am getting a problem when I am using ("perl something.pl" + somehting + something1 + something2) but when I am using ("perl something.pl something1value something2value") everything is working fine any solution please Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim IP As String = "xxx.xxx.xxx.xxx" Dim Username As String = "root" Dim Password As String = "mypassword" Dim cmd As Renci.SshNet.SshCommand Dim connInfo As New Renci.SshNet.PasswordConnectionInfo(IP, Username, Password) Dim sshClient As New Renci.SshNet.SshClient(connInfo) Dim something As String = TextBox1.Text Dim something1 As String = TextBox2.Text Dim something2 As String = TextBox3.Text sshClient.Connect() cmd = sshClient.RunCommand("perl something.pl" +something + something1 + something2) Label1.Text = cmd.Result End Sub End Class
All of your textbox values are being smashed together. If the user types param1 in TextBox1 and param2 in TextBox2, your command line will look like this:
perl something.plparam1param2
You're not putting spaces between the command line parameters.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
All of your textbox values are being smashed together. If the user types param1 in TextBox1 and param2 in TextBox2, your command line will look like this:
perl something.plparam1param2
You're not putting spaces between the command line parameters.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
I appreciate your help but how to put spaces them because if I am giving spaces between the commands they are getting back in from once again.
cmd = sshClient.RunCommand("perl something.pl " + something + " " + something1 + " " something2)
Use the best guess
-
cmd = sshClient.RunCommand("perl something.pl " + something + " " + something1 + " " something2)
Use the best guess