Question Locked

Batch File

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

4 replies

by deadly ernest

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.

by bizzo

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

by matteaton75

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.

This discussion is closed to new replies.