Run programm in background without using "start"
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello everyone!
My question is related to this one. I am trying to run my program in the background using the system command. However, if I understood correctly, when I add "start /b" to the command it does not wait for the other program to finish before continuing with the other operations.
Here is the input line for system that starts the program and waits for it to finish, however, opens in the foreground:
"energyPLAN.exe" -i "energyPlan Data\Data\Portugal_2050_tmp.txt" -ascii "Outputs\Portugal_2050_out"
"energyPLAN.exe" is the program, "energyPlan Data\Data\Portugal_2050_tmp.txt" is the input file and "Outputs\Portugal_2050_out" the output file.
This is the line that starts the program in the background, but does not wait for energyPLAN.exe to finish:
start /b "title" "energyPLAN.exe" -i "energyPlan Data\Data\Portugal_2050_tmp.txt" -ascii "Outputs\Portugal_2050_out"
What is the correct input that starts the program in the background but waits for it to finish?
Thanks in advance!
댓글 수: 2
dpb
2018년 9월 9일
What that does is shell to the command interpreter which then starts yet another session in which the executable is executed (without a console owing to /B) while the first shell exits.
Try /WAIT
답변 (1개)
Walter Roberson
2018년 9월 9일
There is no way to do that using system().
You can use .NET to start processes that run in the background.
댓글 수: 12
Guillaume
2018년 9월 10일
Don't redirect the standard output and input then! If you do need to redirect the standard output or input then I think you're out of luck.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
