本文介绍了从WINE中运行的程序执行Shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用WINE在Linux上运行的Windows程序.

I have a windows program running on Linux using WINE.

如何从Windows程序调用Linux Shell命令?

How can I call Linux shell commands from the windows program?

推荐答案

user1182474的注释正确. Wine不会隔离它运行的程序. (它试图隐藏它,但不是很彻底.)我完全无法使用Google. Psen在下面的评论更正确,并引用了FAQ. (请注意,要使其正常工作,您可能需要通过Wine驱动器映射获得程序的目录.或者,请参阅匿名复制者的回答.)

==旧答案==

Wine隔离运行的程序.如果所有应用程序均按预期工作,则它们会呈现与Windows不可区分的环境.不幸的是,出于您的目的,这意味着您无法访问主机OS(Linux)的功能.我的意思是,您可以修补Wine来做到这一点,但是我觉得这将是更多的工作,而不是值得的.

Wine isolates the programs it runs. The applications are, if all works as intended, presented with an environment indistinguishable from Windows. Unfortunately for your purposes, that means that you can't access the features of the host OS (Linux). I mean, you could patch Wine to do that, but I get the impression that it would be more work than it's worth.

有希望! Cygwin是Windows的类Unix环境.您可以在Wine中安装Cygwin,然后使用Cygwin运行您的Shell脚本. (显然,使用'winetricks cygwin'安装是最简单的)调用Cygwin的bash shell(在某些Wine程序中),如下所示:

There is hope! Cygwin is a Unix-like environment for Windows. You could install Cygwin in Wine, and use Cygwin to run your shell script. (Apparently, installing with 'winetricks cygwin' is easiest) Invoke Cygwin's bash shell (inside some Wine program) like this:

c:\cygwin\bin\bash  myscript

当然,将c:\ cygwin更改为安装位置.

Of course, change c:\cygwin to wherever you install it.

这篇关于从WINE中运行的程序执行Shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 22:28