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

조회 수: 9 (최근 30일)
Ivan Mich
Ivan Mich 2020년 3월 8일
댓글: pasquale maris 2022년 6월 21일
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
Mario Malic
Mario Malic 2020년 3월 8일
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 2022년 6월 21일
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]);

댓글을 달려면 로그인하십시오.

채택된 답변

Jeff Miller
Jeff Miller 2020년 3월 9일
편집: Jeff Miller 2020년 4월 4일
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')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by