- Files shold be in present working directory
- Program(here xxx.exe) should set to environmental variable if it is not present in the present workind directory
How to execute files without specifying a path.
6 次查看(过去 30 天)
显示 更早的评论
As the title, I don't want to execute cmd in a specified or specific directory, but it can be executed no matter which directory I execute the file in.
How can it be modified?
out = fileread('1.txt');
cmd = ['xxx.exe', out];
system(cmd)
THX
0 个评论
回答(1 个)
Bhaskar R
2019-12-9
编辑:Bhaskar R
2019-12-9
You can but
Code
cmd = ['xxx.exe', ' ', '1.txt'];
system(cmd);
3 个评论
Walter Roberson
2019-12-9
You should add the directory containing the executable to the PATH environment variable.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Search Path 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!