Launch cmd.exe & and an other .exe with a python script

조회 수: 2 (최근 30일)
Michel Flauran
Michel Flauran 2019년 10월 30일
Hi,
here is my problem : I would like to launch a window of a command prompt (see image 1), and put a specific line of command in it (which corresponds to "cmdLine" in the code). I know it's possible to use "system(cmdLine)" to execute the command, however when I do this, my Command Window on matlab is 'locked' (see image 2, I cannot launch the last command, which is "taskkill -f -im emprogui.exe"). That's why I would like to put the "cmdLine" command into a different window so I could be able to still use my Command Window.
Here is the code :
EMProPath = "D:\Keysight\EMPro2020Py3\win32_64\bin\empro.exe";
projectPath = "C:\Users\Myname\Desktop\Test\EMPRO\Model";
pythonPath = strcat("C:\Users\Myname\Desktop\Test\EMPRO\python_script_t.py");
cmdLine = strcat('"', EMProPath, '" "',projectPath, '" --bootscript="', pythonPath, '"');
system(cmdLine); % Need to be changed to use a cmd prompt instead of the Command Window of Matlab, I know that 'system("cmd.exe &")'
% opens a command prompt separately, so it might be looking close to something like this I guess (or not at all) :
% system(strcat("cmd.exe & ", cmdLine))
pause(10)
system('taskkill -f -im emprogui.exe')
(Image 1)
Capture3.PNG
(Image 2, last line is added manually, but it doesn't work)
Capture2.PNG

답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by