Syntax problem with command in cmd
5 views (last 30 days)
Show older comments
Hello, I am currently in the process of running something in cmd via matlab. I want to run the porgramm compose for a certain file.
The below line runs perfectly in cmd without any problem.
"C:\Program Files\Altair\2025\Compose2025\Compose_Console.bat" -e "filePath=C:/Users/pantm/OneDrive/Desktop/TEST_LCA_doublelane_0.h3d" -f "C:/Users/pantm/OneDrive/Desktop/get_stress.oml"
[Inserted commands in edit mode for clearer reading, editing...dpb]
"C:\Program Files\Altair\2025\Compose2025\Compose_Console.bat" -e "filePath=C:/Users/pantm/OneDrive/Desktop/TEST_LCA_doublelane_0.h3d" -f "C:/Users/pantm/OneDrive/Desktop/get_stress.oml"
When i run this from matlab system("C:\Program Files\Altair\2025\Compose2025\Compose_Console.bat" -e "filePath=C:/Users/pantm/OneDrive/Desktop/TEST_LCA_doublelane_0.h3d" -f "C:/Users/pantm/OneDrive/Desktop/get_stress.oml") it doesnt work, giving these errors Syntax error at line number 1 near character position 1
Error: 'filePath' is not defined at line number 17 in file get_stress.oml
system("C:\Program Files\Altair\2025\Compose2025\Compose_Console.bat" -e "filePath=C:/Users/pantm/OneDrive/Desktop/TEST_LCA_doublelane_0.h3d" -f "C:/Users/pantm/OneDrive/Desktop/get_stress.oml")
Syntax error at line number 1 near character position 1
Error: 'filePath' is not defined at line number 17 in file get_stress.oml
I think its a Syntax error in this and its about these ".
After I fix this problem I want to be able to define this middle part ("filePath=C:/Users/pantm/OneDrive/Desktop/TEST_LCA_doublelane_0.h3d" ) with something like sprintf so it changes dynamically.
"filePath=C:/Users/pantm/OneDrive/Desktop/TEST_LCA_doublelane_0.h3d"
0 Comments
Answers (1)
Walter Roberson
on 21 Apr 2025
system("C:\Program Files\Altair\2025\Compose2025\Compose_Console.bat" -e "filePath=C:/Users/pantm/OneDrive/Desktop/TEST_LCA_doublelane_0.h3d" -f "C:/Users/pantm/OneDrive/Desktop/get_stress.oml")
% ^ ^
You start and end a string literal, and then you have -e which would try to subtract a variable named e
You need
system('"C:\Program Files\Altair\2025\Compose2025\Compose_Console.bat" -e "filePath=C:/Users/pantm/OneDrive/Desktop/TEST_LCA_doublelane_0.h3d" -f "C:/Users/pantm/OneDrive/Desktop/get_stress.oml"')
0 Comments
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!