0
votes

I am trying to write a VBScript to log in to PUTTY and execute bunch of commands. I am trying to take the UserID and Password for login from the Input box and then pass it as a variable for login.

But I am not able to pass UserName and Passwrd properly. Please suggest.

Dim UserName
Dim Passwrd


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


Set shell = WScript.CreateObject("WScript.Shell")
pcmd = "putty.exe -ssh [email protected] -pw Passwrd"
Set exec = shell.Exec(pcmd)
Set pout = exec.StdOut
1

1 Answers

1
votes

You need to use string concatenation (&) to combine your variable values with your string literal:

pcmd = "putty.exe -ssh " & UserName & "@10.177.104.109 -pw " & Passwrd