user3565150
user3565150

Reputation: 914

Opening an application on a LAN desktop using Python

After installing Cygwin on a windows LAN desktop, I can successfully connect through ssh using my below Python script:

 ssh.connect('135.24.237.142',username = 'cyg_server',password =    
 'sandforce')
 stdin,stdout,stderr = ssh.exec_command("pwd")
 stdout.readlines()
 [u'/var/empty\n']

As a continuation, I would like to open an application on this desktop using Python script. For example I need to run the application: "C:\Program Files (x86)\Tensilica\Xtensa OCD Daemon 9.0.3"" in the LAN desktop.

Please help how do I do this using ssh.

Regards, Amitra

Upvotes: 0

Views: 151

Answers (1)

Stephen Lin
Stephen Lin

Reputation: 4912

You can write this in the script called test.py.

#!/usr/bin/python
# -*- coding: utf-8 -*-

#test.py
import os
# you can change cmd to any command you want
cmd = "C:\\Program Files (x86)\\Tensilica\\Xtensa OCD Daemon 9.0.3"
os.system(cmd)

Then invoke it via ssh.

ssh.connect('135.24.237.142',username = 'cyg_server',password = 'sandforce')
stdin,stdout,stderr = ssh.exec_command("python test.py")

Upvotes: 1

Related Questions