Simple script for calling putty.exe

R

radoslav.filipov

Hi All,

I try to create a simple python script with wmi module for starting
putty.exe at my computer /echo %OS% -> Windows_NT/.

The script is located at the Desktop of my computer. When I have
putty.exe at the Desktop the script is working, but when I move
putty.exe to another directory - > PUTTY_HOME="D:\Documents and
Settings\Administrator\My Documents\putty" it is not. The directory
where putty.exe resides is included in the Path environment variable.

Below you can find the result of my script line by line.

In [11]: a = os.getenv("PUTTY_HOME")

In [12]: a
Out[12]: 'D:\\Documents and Settings\\Administrator\\My Documents\
\putty'

In [13]: os.chdir(a)

In [14]: os.getcwd()
Out[14]: 'D:\\Documents and Settings\\Administrator\\My Documents\
\putty'
(without putty.exe on my desktop)
In [17]: process_id, result = c.Win32_Process.Create
(CommandLine="putty.exe")

In [18]: for process in c.Win32_Process (name="putty.exe"):
....: print process.ProcessId
....:
(with putty.exe on my desktop)
In [19]: process_id, result = c.Win32_Process.Create
(CommandLine="putty.exe")

In [20]: for process in c.Win32_Process (name="putty.exe"):
....: print process.ProcessId
....:
5876

In [21]:

I want to keep the putty.exe under PUTTY_HOME, and have the script
working in the same time.

Probably the decision of the problem is trivial , but I can not find
it.

Thank you in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top