I'm opening bat file using processing executable file. all it does is
start Exe2.exe
and then looks for files until they are created. that bat is located in a specific folder which also has Exe2.exe. When I open it by double clicking, it works as intended but whenever I use
try {
p1 = r.exec("cmd /c start " + Path + "/open.bat");
}
catch(Exception c) {
}
it opens bat file and I get error "Windows cannot find Exe2.exe" and in console this is what it runs C:\Users\syste\Downloads\processing-3.5.4> start Exe2.exe
the starting path is different from where open.bat file is. It's start from where processing is saved. If there's a way to have it start from correct folder or somehow pass the path with processing. I don't want to hardcode path into it manually since i want it to run on different computers
open.bat content:
start Exe2.exe
cls
@ECHO OFF
SET LookForFile="answer.txt"
:CheckForFile
IF EXIST %LookForFile% GOTO FoundIt
GOTO CheckForFile
:FoundIt
echo the number is:
more answer.txt
del "answer.txt"
GOTO CheckForFile
simple sketch to reproduce:
String Path;
Runtime r = Runtime.getRuntime();
Process p1;
void setup(){
Path = sketchPath()+"/lib";
try {
p1 = r.exec("cmd /c start " + Path + "/open.bat");
}
catch(Exception c) {
}
}
There's a folder called "lib" inside sketches folder which has open.bat and Exe2.exe files