-1

How do i launch external executables using python scripting ? I would like to launch putty.exe which is installed in a specific directory, say C drive in the folder named "putty". I am executing the script Test.py from the command prompt D:\python>Test.py.

I am currently executing the following which is not working import os; print os.system('putty.exe')

Razor
  • 39
  • 1
  • 6
  • 1
    You can use subprocess and pass the ip using str.format, you can also add the path to putty to your PATH in your environment variables then just calling putty will work – Padraic Cunningham Jun 17 '15 at 12:19
  • 1
    You can use subprocess, you can also add the path to putty to your PATH in your environment variables then just calling putty will work. You may also find this useful http://superuser.com/questions/515601/how-to-run-a-command-file-in-putty-using-automatic-login-in-a-command-prompt – Padraic Cunningham Jun 17 '15 at 12:24

2 Answers2

1

Use a command line option to load a saved session with the right IP address

   The `-load' option causes PuTTY to load configuration details out
   of a saved session. If these details include a host name, then this
   option is all you need to make PuTTY start a session.

   You need double quotes around the session name if it contains
   spaces.

   If you want to create a Windows shortcut to start a PuTTY saved
   session, this is the option you should use: your shortcut should
   call something like

     d:\path\to\putty.exe -load "my session"

   (Note that PuTTY itself supports an alternative form of this option,
   for backwards compatibility. If you execute `putty @sessionname' it
   will have the same effect as `putty -load "sessionname"'. With the
   `@' form, no double quotes are required, and the `@' sign must be
   the very first thing on the command line. This form of the option is
   deprecated.)
Jacques de Hooge
  • 6,750
  • 2
  • 28
  • 45
-1

You may try this:

os.system ('C:/putty/putty.exe')
ZdaR
  • 22,343
  • 7
  • 66
  • 87
Jacques de Hooge
  • 6,750
  • 2
  • 28
  • 45
  • But, how to i automate to enter the ip address in the address field in this putty executable ? – Razor Jun 17 '15 at 12:12