从Java在Windows服务器上运行远程命令的最佳方法?

时间:2021-12-15 00:12:53

Are there any existing solutions for remote execution of commands on a windows server from Java natively? psexec.exe is not an option since the java application has to be cross platform.

是否存在从Java本地在Windows服务器上远程执行命令的现有解决方案? psexec.exe不是一个选项,因为java应用程序必须是跨平台的。

Even a preexisting solution using Java RM would be sufficient.

即使是使用Java RM的预先存在的解决方案也足够了。

Currently, I'm using an SSH client library to ssh through java into a Windows server that's running the cygwin SSH daemon. Sadly the SSH daemon has some issues when it comes to quoting commands that go into a CMD (as opposed to bash) shell.

目前,我正在使用SSH客户端库将ssh通过java进入运行cygwin SSH守护进程的Windows服务器。遗憾的是,SSH守护进程在引用进入CMD(而不是bash)shell的命令方面存在一些问题。

2 个解决方案

#1


2  

Check out the Java RDP Client. Not really out of the box, but with little digging you should be able to trim it down to what you need.

查看Java RDP客户端。不是真的开箱即用,但只需挖掘一下你应该能够根据你的需要进行修剪。

Since it uses getopt, I would assume it's GPL'd.

由于它使用了getopt,我认为它是GPL。

#2


4  

It'll require some work, but the remoting library in Hudson has very good support for running commands and doing file operations over the network on remote computers.

这需要一些工作,但Hudson中的远程处理库非常好地支持在远程计算机上通过网络运行命令和执行文件操作。

see http://hudson.dev.java.net (you'll have to dive into the code)

请参阅http://hudson.dev.java.net(您将不得不深入研究代码)

#1


2  

Check out the Java RDP Client. Not really out of the box, but with little digging you should be able to trim it down to what you need.

查看Java RDP客户端。不是真的开箱即用,但只需挖掘一下你应该能够根据你的需要进行修剪。

Since it uses getopt, I would assume it's GPL'd.

由于它使用了getopt,我认为它是GPL。

#2


4  

It'll require some work, but the remoting library in Hudson has very good support for running commands and doing file operations over the network on remote computers.

这需要一些工作,但Hudson中的远程处理库非常好地支持在远程计算机上通过网络运行命令和执行文件操作。

see http://hudson.dev.java.net (you'll have to dive into the code)

请参阅http://hudson.dev.java.net(您将不得不深入研究代码)