Running External Command Prompt Through System Command Prompt

4 vues (au cours des 30 derniers jours)
Matlab12345
Matlab12345 le 19 Juil 2023
I am attempting to use Matlab to open a command prompt associated with a program installed on my computer, and execute a command in that window. The system function in Matlab only appears to control the Windows command prompt. Is there a way I can make Matlab directly open and issue commands in the external command prompt? Or is there a way to make Matlab open the Windows command prompt, and then have Windows open and run the external command prompt?

Réponse acceptée

Walter Roberson
Walter Roberson le 19 Juil 2023
This is a .NET facility for controlling processes.

Plus de réponses (1)

John Schilling
John Schilling le 13 Fév 2025
A possibly more direct answer to your question is you can open cmd with /k flag and pass commands at launch, then finish with & to spawn cmd as a window rather than having it tied to the Matlab command window.
eg.
system('cmd.exe /k echo "hello world" & ')

Catégories

En savoir plus sur Introduction to Installation and Licensing 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