I have a windows application, which is started running .bat file. This .bat file calls different things before launching the .exe. The problem is, that no matter what I do, I can get that .exe running, but as soon as the script ends, the application ends as well. I think the problem has something to do with the fact, that the .exe needs to launched via that .bat file. Here's something I have already tried with python:
subprocess.Popen(['cd','path\\to\\the\\script', '&&', 'start.bat' ], shell=True, text=True | subprocess.DETACHED_PROCESS )
time.sleep(10)
As soon as the sleep runs out, the launched .exe closes. I have also tried with different subprocess parameters, such as subprocess.CREATE_NEW_PROCESS_GROUP
but no luck.
I have also tried:
os.system('cd "path\\to\\the\\script" && "start.bat"')
And the same thing. I have already tried answers found from here, but no luck.
So is there some other way to launch that .bat file and somehow leave it "truly", because I think the problem is, that when the .bat file has done it's job, it exits and this somehow messes things up.
Creating infinite loop in python after calling the .bat doesn't sound like a good solution either just to keep the calling process running.
No, I can not just call the .exe directly.
ADDITION: The .exe that I launch, must stay on basically forever.