2017-05-22 2 views
-2

IP 주소를 ping하고 ssh 섹션에 로그인 할 수있는 작은 프로그램을 만들려고합니다.Windows 양식으로 프로그램을 계속 실행하십시오.

나는 그 중 하나를 닫지 않고 핑 (ping) 변경 가능한 IP 주소를 유지할 수 있기를 원합니다.

ssh 섹션에서도 동일한 작업을 수행하고 싶습니다. 지금은 cmd를 종료하고 다른 주소로 ping을해야합니다.

Public Class Form1 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
     Dim ip As String = TextBox1.Text 
     Dim Command As String 
     Command = "putty.exe" & " " & "-ssh" & " " & "user" & "@" & ip & " " & "port" & " " & "-pw" & " " & "Password" 
     Shell($"cmd /K{Command}", 1, True) 

    End Sub 

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 
     Dim textvar As String = TextBox2.Text 
     Dim Command As String 
     Command = "Ping" & " " & textvar & " " & "-t " 
     Shell("cmd /k" & Command, 1, True) 
    End Sub 
End Class 
+1

[** Ping it yourself? **] (https://stackoverflow.com/a/40820084/3740093) –

답변

0

문제점을 해결할 수 없지만 코드 정리에 도움이 될 수 있습니다.

보다는 왜 그냥 간격과 함께 문자열을 넣지 마십시오

& " " & 

를 사용

. 그러면 다음과 같이 보일 것입니다 :
Command = "putty.exe -sh [email protected]" & ip & " port -pw Password" Shell($"cmd /K{Command}", 1, True)

정확히 동일한 일을하지만 많은 문자가 없으며 자신의 겸허 한 의견을 쉽게 읽습니다.

관련 문제