Hi I need to do "echo y | P:\tool\plink.exe -l user001 -pw pass001 -ssh hx-devx4 sh Assrde1/apps/infra/script/who_is_in dv66pw" because plink ask me if I want to Store the host key and I want the process to answer y.
But if I do
I got an error that the file don't exist.Code:Dim objProcessG As New System.Diagnostics.Process objProcessG.StartInfo.FileName = "echo y | P:\tool\plink.exe " objProcessG.StartInfo.Arguments = "-l user001 -pw pass001 -ssh hx-devx4 sh Assrde1/apps/infra/script/who_is_in dv66pw" objProcessG.StartInfo.UseShellExecute = False ' Set our event handler to asynchronously read the sort output. AddHandler objProcessG.OutputDataReceived, _ AddressOf SortOutputHandler objProcessG.StartInfo.RedirectStandardInput = True objProcessG.StartInfo.RedirectStandardOutput = True objProcessG.StartInfo.CreateNoWindow = True objProcessG.Start() ' Use a stream writer to synchronously write the sort input. Dim sortStreamWriter As StreamWriter = objProcessG.StandardInput ' Start the asynchronous read of the sort output stream. objProcessG.BeginOutputReadLine() Dim inputText As String = String.Empty Dim numInputLines As Integer = 0 sortStreamWriter.Close() objProcessG.WaitForExit() objProcessG.Close()


Reply With Quote

