Launch cmd.exe & and an other .exe with a python script
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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)

(Image 2, last line is added manually, but it doesn't work)

0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!