I want to run a complex m-file using GNU Octave 5.2 on Windows 10. I stripped it down to a very simple example that also does not work:
C:\test\start_test.bat:
call C:\Tools\Octave\mingw64\bin\octave-cli.exe C:\test\write_file.m
Rem call C:\Tools\Octave\mingw64\bin\octave.bat C:\test\write_file.m
... and C:\test\write_file.m to get some debug output since I do not know if the task did really run:
runtime = strftime ("%Y-%m-%d-%H-%M-%S", localtime (time ()));
disp('write file-1 with relative path' );
fileID = fopen(['run-',runtime,'-1.txt'],'w');
fprintf(fileID,'foo');
fclose(fileID);
disp('write file-2 with absolute path');
fileID = fopen(['C:\test\run-',runtime,'-2.txt'],'w');
fprintf(fileID,'foo');
fclose(fileID);
disp('... done');
If I run the bath file it on the windows command line (using the same user as in the task scheduler) it works. The Windows user is a unprivileged user. I have no problems running other exe or python scripts within bat files and also run octave m-files using older Windows versions. In the task scheduler I currently use no trigger, I just want to run the task with the bat file manually and tried these possibilities but always get a return value of (0x1) and no test files are written:
- run with highest priviledges
- do not run the bat file but enter the path of octave directly in the "action" tab
- change "call" in the bat file to "start" or nothing (just the plain command)
A similar topic started by me with the answers does not help.