I just tried to run a new process by resolving its location via PATH env. var. Since I use Qt this means I added
X:\folder\
to my PATH variable and in my starter application I am calling
QProcess::startDetached("test.exe")
which actually works.
However test.exe writes data to its working directory. This data ends up in the directory of the starter application instead of X:\folder\ which is not what I want.
I tested the behaviour directly in the windows command line by typing "test.exe" in the CLI and it is the same there (having the data written to the current directory).
Is there a way (in C++ or command line) to start a process using PATH while also using the directory found in PATH as working directory of the new process?
I could search PATH for my own, analyze the finding and start the program by another QProcess::startDetached() overload but I wonder if there is an easier way.