How to call the Nsh command in a custom application

How to call the Nsh command in a custom application, just as in the windows call cmd command,
such as:

The mavlink shell does this. You should be able to use an instance of MavlinkShell ( in your application. The MavlinkShell class itself does not have anything to do with mavlink, it’s just a class that allows you to interact with a nuttx shell via C++.

The current NuttX code also supports the standard system function. The only thing that is non-standard about the system() function is that it invokes NSH not /bin/sh.

So you can do just what you want to do using just the code snippet that you gave as an example.

The system function is not available if you are using the is you are using an old version of NuttX.