-1

I know this might be a silly question. I want to login to putty and read the lines in putty window. The following code gets stuck at the readline.

Dim UserName
Dim Passwrd

UserName = InputBox("Please Enter Your UserID:")
Passwrd  = InputBox("Please Enter Your Password:")

Set shell = CreateObject("WScript.Shell")
pcmd = "C:\Putty\putty.exe -ssh"&" "&UserName & "@10.x.xx.x -pw" &" "&Passwrd 

Set exec = shell.Exec(pcmd)
Set pout = exec.StdOut
Dim strFromPutty 
Do
    strFromPutty = pout.ReadLine
    print strFromPutty
Loop While Not pout.AtEndOfStream
Abhisek Mishra
  • 269
  • 3
  • 15

1 Answers1

0

you may not be able to do that. The session might be a different process started by putty.

I propose to redirect it to a file and read it from there: Full answer here: Save PuTTY ouput to file from command-line

Bela Tamas Jozsa
  • 714
  • 5
  • 10