Question

Locked

Batch File

By matteaton75 ·
Hi everyone,

I have a batch file on my local PC named call.bat that calls another batch file named copy.bat on a remote PC. When I initiate call.bat it accesses copy.bat correctly but runs the commands on my local PC instead of the remote PC. Is there anyway to make it run on the remote PC instead? Thanks in advance.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

I doubt anyone can answer that until AFTER

by Deadly Ernest In reply to Batch File

they see the code you have in the file call bat. As a guess, I'd say it needs to have code to activate the link to the other system and then code to access the system, then run the copy command.

Collapse -

Firstly

by Bizzo In reply to Batch File

Please rename your batch files. Having batch files called "call" and "copy" is only going to lead to confusion in the long run, as call and copy are reserved commands.

For example, if you're in the directory that has copy.bat in it, and you want to copy a file, it will probably call the batch file instead of copying a file. And similarly with "call".

Anyway, instead of running \\remote1\share1\copy.bat (which I assume you're doing) use psexec which will run the command remotely, e.g. psexec \\remote1 copy.bat

psexec is part of pstools and can be found here:

http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

Collapse -

Code

by matteaton75 In reply to Firstly

Bizzo and Ernest thanks for your quick responses. Right now I am just doing a test scenario, here are the batch files renamed:

Local Computer:
initiate.bat
CALL \\remotecomputer\complete.bat


Remote Computer
complete.bat
tskill notepad /a

My end goal, we have a user who is not good with computers so I am trying to make it easy for her to stop a program from running, copy a file to it, and then restart the program. The program runs on a remote PC.

Like I said when I run this it will kill notepad on the local PC. Once I get this part to work then I would add the rest of the code in. I will try out psexec in a bit. Thanks for your help.

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums