RE: Execute batch script on remote computer

T

Tim Golden

[py]

| I am trying to execute a batch script on a remote computer.
|
| The batch script looks like:
|
| @echo off
| start c:\python24\python.exe c:\a_script.py
|
|
| Here's the setup:
| Computer A (my computer), Computer B (the remote computer).
|
| So I map "W:" to Computer B and then copy the batch script to Computer
| B. Then from within Python on Computer A I run:
| import subprocess
| subprocess.Popen("W:\\foo.bat")
|
| However, when it runs it says it can't find c:\a_script.py. It seems
| to be trying to look
| at Computer A, not Computer B. How can I do this?

You're confusing a couple of things here. One is a
drive mapping, which presents the *filesystem* of a
remote computer as though it were local. The other
is a remote procedure call, which presents the
*processor* (and environment etc.) of a remote
computer as though it were local.

What you're doing has the effect of running a
remote *file* on a local *processor*.

You could run a remote script -- on the *remote*
processor -- under vanilla Windows using WMI, and
possibly using some other DCOM-based technology, such
as WSH. But you'd run into some security / environment
issues depending on just what your remote script was
trying to do.

You could also -- if you were prepared to invest in
some more software infrastructure -- employ Pyro
(http://pyro.sf.net), Corba, XML-RPC or any one of
several other RPC-type technologies.

Are you even more confused now than you were when
I started? ;)

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
 
P

py

WMI will work, i can create a new Win32_Process. XML_RCP would be
nice, but probably to much for what i need.

thanks.
 

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

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top