2

How to execute a batch file located on Windows remote system? Batch file should run on remote system.

3 Answers 3

4

Abhinav, For your problem I see RMI is the quickest possible solution

  1. Check out the basics from these links (1,2)
  2. Start the server from where you want to run the batch
  3. In the Remote object on the server side Use Runtime.getRuntime().exec() to run your batch.
  4. From the client machine give call to this remote object and method.
Sign up to request clarification or add additional context in comments.

1 Comment

I know this server method and also used this before but i want to do this without server
1

Another approach is to use SSH like sshj. This only requires the remote system to have SSH installed and is more secure than RMI.

Comments

1

You can use Jsch and Expect4j for executing commands on remote machine(window/Linux). Further more, if your system allows, transfer the batch file on remote machine using some FTP utility like Apache Commons Net and then execute commands that executes the script.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.