Running an .EXE file with an Input file with a command via matlab

8 visualizaciones (últimos 30 días)
Hello,
I have a code problem. The purpose is to run an .exe file via command.
I have find the command which is system('file.exe &').
But this file needs an input file ( a .txt file (the name of this file is ab.txt) in cmd file) in order to run.
I have tried these commands but it is no works :
status = system(sprintf('file.exe "%s"',ab.txt));
Could anyone help me?
  2 comentarios
Mario Malic
Mario Malic el 8 de Mzo. de 2020
Try to do it using CMD, if you are able to do it in there just put what you've written in system()
pasquale maris
pasquale maris el 21 de Jun. de 2022
to run the system command you need to create a unique string with a space bewteen exe and arguments:
A=('C:\Users\*\Documents\...exefilename.exe');
B=('C:\Users\*\Documents\path or agument');
Status = system([A ' ' B]);

Iniciar sesión para comentar.

Respuesta aceptada

Jeff Miller
Jeff Miller el 9 de Mzo. de 2020
Editada: Jeff Miller el 4 de Abr. de 2020
sprintf might be overkill here. Maybe just:
status = system('file.exe ab.txt')
If file.exe is not on the Windows path, you might need to include the information about where it is, e.g.
status = system('C:\Software\Bin\file.exe ab.txt')

Más respuestas (0)

Categorías

Más información sobre Software Development Tools en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by