Mobaxterm, "Execute Command" Configuration

15.7k Views Asked by At

I have a to ask about Mobaxterm, I see that I can configure to my sessions, commands in the field execute command on the settings, but I can't send an enter. I need to execute commands like a cd, or an sh, and also send an enter, but the system don't get any of my options like a \n or \r\n or other that I've found on the web.

There is a way to configure the mobaxterm like the secure CRT, where I can send commands and enter, or expect some text and send the next command?

2

There are 2 best solutions below

0
On

You can create a custom macro where you specify the order of commands. Use the different options there such as Keystroke and press the Return key to get the enter function captured and used in the macro.

See this post for details and credit - https://stackoverflow.com/a/48019517

0
On

From the MobaXterm User Manual entry about Execute Command:

Specified command will be executed on the remote server after connect. You can specify multiple commands and separate them with ";" or "&&".

For instance:

pwd; ls -al; date; uname -a

This should be enough for simple commands, like ls, cd, ... For more complex uses ("expect some text"), I suggest to write a (Unix format) script and invoke it launching MobaXterm with

MobaXterm <script_file>

For more info, see also: https://blog.mobatek.net/post/mobaxterm-command-lines/