rasti.hil@hilandco.com +41 79 367-9677

Wednesday, 3 February 2010

Running putty in a perl script


my $PUTTY = 'C:\Program Files\PuTTY\putty.exe';
my $sessionName = 'putty_session_name';
my $cmd = "start \"\" \"$PUTTY\" -load \"$sessionName\"";
system($cmd); #running command

4 comments:

Madhankumar Mahalingam said...

Hi, I need to pass username and password as arguments too putty. Is it possible???????

Madhan

Zsuzsi Vadasz said...

Hi,
Sorry for late response. In your case line nr 3 should look like this:

my $cmd = "start \"\" \"$PUTTY\" -load \"$sessionName\" -l your_username -pw your_password";

Francesco said...

Hi,

you might be able to help me too :)

I am in the process of writing a perl script that provides hyperlinks to ssh putty session from a host file (contains device name, ip, ssh version, etc etc).

Could you help me as I do not know the flags to populate the IP address field or the protocol version (will require telnet, ssh V1 &V2).

I need this as this script will reside on a terminal session for all users and the putty sessions will not be saved.

Thanks

Franc

Zsuzsi Vadasz said...

Hi Francesco,

This link may help you:
http://the.earth.li/~sgtatham/putty/0.53/htmldoc/Chapter3.html#3.7.3.13