问题
I'm trying to execute the following octave sh file in php using the exec command running in Windows 2008. This command works in Unix but I don't know why it doesn't work in Windows. Seems that the working directory of Octave is C:\Windows\system32\config\systemprofile Please advice.
exec("octave ./d_test.sh");
回答1:
Solved :) I edited the octaverc in 'c:\software\Octave\Octave3.6.2_gcc4.6.2\share\octave\site\m\startup' with
addpath("C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\test");
addpath("C:\\Windows\\system32\\config\\systemprofile")
##cd(getenv('USERPROFILE'))
回答2:
You're better off just figuring out where octave is and calling it using that absolute path, ex. exec("C:\Octave-3.6.1\bin\octave.exe ./d_test.sh");
.
来源:https://stackoverflow.com/questions/13586263/php-exec-octave-sh-in-windows