- Java Robot Class to position on top of the command window and send the key/mouse sequence to close it;
- call taskmanager to kill the process
- instead of using system() use one of the activex / DCOM methods to create a process and send it a command line; you can then also kill off the process. I know this is possible, and I know someone showed how to create a process not long ago, but I am having difficulty finding the appropriate sequence at the moment.
close cmd window after executable
조회 수: 25(최근 30일)
I am running an external .bat file through matlab. The code is as follows:
fileName = uigetfile('*.*');
cmd = sprintf(program.bat "%s" &', fileName);
The user gets to pick which file is run through the .bat file and then it runs. The problem I am trying to solve, which I am not even sure it's possible, is to close the cmd window after it is done autonomously. The reason this is difficult is because after the program is done running, if you press enter, it prompts excel to open and displays the results in excel which I am trying to avoid. Thus, I don't think I can write a simple exit command. I also do not have access to the batch file to rewrite that code.
Walter Roberson 2016년 9월 27일
There are a few approaches: