使用任意PATH环境安装MathLink程序 [英] Install MathLink program with arbitrary PATH environment
问题描述
可以使用安装[]
启动具有自定义 PATH
环境变量的MathLink程序
Is it possible to use Install[]
to start a MathLink program with a custom PATH
environment variable?
我正在尝试使用 mEngine 将Mathematica连接到Windows上的MATLAB。只有当 PATH
环境变量包含MATLAB库的路径时,才会启动 mEngine.exe
。是否可以修改PATH以启动此程序 ,而不需要修改系统路径?或者有另一种方法来启动 mEngine.exe
?
I am trying to use mEngine to connect Mathematica to MATLAB on Windows. It only works if mEngine.exe
is launched when the PATH
environment variable includes the path to the MATLAB libraries. Is it possible to modify the PATH for launching this program only, without needing to modify the system path? Or is there another way to launch mEngine.exe
?
推荐答案
acl的解决方案将mEngine.exe包装在一个批处理文件中,并临时修改PATH,可以正常工作:
@acl's solution to wrap mEngine.exe in a batch file, and temporarily modify the PATH from there, works correctly:
我将其用作 mEngine.bat
:
set PATH=c:\path\to\matlab\bin\win32;%PATH%
start mEngine.exe %*
-
*%
确保所有命令行参数传递到mEngine.exe
-
开始
是必要的,以防止命令窗口保持打开,直到mEngine.exe
终止 *%
ensures that all command line arguments are passed on tomEngine.exe
start
is necessary to prevent the command window from staying open untilmEngine.exe
terminates
可以使用安装[mEngine.bat]
开始。
由于内核与 mEngine.exe
通信所需的所有信息都通过安装[]
作为命令行参数,我们需要做的只是la unch mEngine.exe
带有这些参数。 安装[]
不需要知道 mEngine.exe
的位置,重要的是进程使用正确的命令行参数启动,由%*
确保。
Since all the information that is needed for the kernel to communicate with mEngine.exe
is passed by Install[]
as command line arguments, all we need to do is launch mEngine.exe
with these arguments. It is not necessary for Install[]
to know the location of mEngine.exe
, the important thing is that the process gets launched with the correct command line arguments, which is ensured by %*
.
这篇关于使用任意PATH环境安装MathLink程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!