从 *nix 在远程 Windows 机器上执行 exe 或 bat 文件 [英] Executing exe or bat file on remote windows machine from *nix

查看:46
本文介绍了从 *nix 在远程 Windows 机器上执行 exe 或 bat 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的 Linux 在云上的远程 Windows 机器上执行 bat 文件.bat 文件启动 selenium 服务器,然后运行我的 selenium 测试.我无法在该机器上启动 selenium RC 服务器.我尝试使用 Telnet,但问题是当 telnet 会话关闭时,RC 服务器端口也关闭.作为我的代码,我的代码必须启动服务器,因此我尝试使用 ANT telnet 任务,并且还以关闭端口的两种方式执行了 telnet 的 shell 脚本.

I am trying to execute a bat file on remote windows machine on cloud from my Linux. The bat files starts selenium server and then my selenium tests are run. I am not able to start selenium RC server on that machine. I tried with Telnet but the problem with it is when telnet session is closed the RC server port is also closed. As my code my code has to start the server so I tried with ANT telnet task and also executed shell script of telnet in both ways the port was closed.

我阅读了 Open SSH、psexec for linux 和 cygwin.但我不知道如何使用这些,它们是否会解决我的问题.

I read about Open SSH, psexec for linux and cygwin. But i am not getting how to use these and will they will solve my problem.

我试图启动一个服务来启动服务器,但在这种方法中,我没有让浏览器可见,所有测试都在后台运行,因为我的脚本需要屏幕截图浏览器可见性.

I have tried to start a service which will start the server but in this method i am not getting browser visible all tests are running in background as my script takes screen shot browser visibility is must.

现在我的问题是使用什么以及哪种更适合我的工作.我选择的代码应该由 shell、ant 或 php 执行.

Now my Question is what to use and which will be preferable for my job. and what ever i choose should be executed by code it may be by shell, ant or php.

提前致谢.

推荐答案

我更喜欢使用 cygwin 并使用 SSH 登录到 windows 机器执行命令.请注意,默认情况下,cygwin 没有安装 OpenSSH.

I prefer to use cygwin and use SSH to then log in to the windows machine to execute commands. Be aware that, by default, cygwin doesn't have OpenSSH installed.

在 Windows 机器上运行 SSH 后,您可以像这样从 Linux 机器在其上运行命令:

Once you have SSH working on the windows machine you can run a command on it from the Linux machine like this:

ssh user@windowsmachine 'mycommand.exe'

您还可以设置ssh authentication 密钥,这样您就无需输入每次输入密码.

You can also set up ssh authentication keys so that you don't need to enter a password each time.

这篇关于从 *nix 在远程 Windows 机器上执行 exe 或 bat 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆