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

9 vues (au cours des 30 derniers jours)
Michel Flauran
Michel Flauran le 30 Oct 2019
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

Réponses (0)

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by