Search code examples
windowscommand-promptteraterm

TeraTerm execution through the Windows command prompt


I have some basic simple two character commands to be executed in TeraTerm.

Is there a way to execute the same TeraTerm commands through a Windows command prompt? This will overcome my dependency to open TeraTerm and then running, commands. I can directly write some .bat file to execute my short commands.


Solution

  • Assuming that your commands are for teraterm, and not for the OS of your device connected via teraterm, you can save your commands into a .ttl file (using notepad or whatever). You can still make it work if the commands are for the OS (using a command line or whatever in the shell of the OS program connected), but you will have to make extra commands to navigate to it.

    Using the .ttl file, you can make a .bat file that does two things:

    cd C:\Program Files\teraterm
    TTPMacro C:\[point to .ttl file]
    

    This won't prevent teraterm from opening, because if you script involves you interfacing with teraterm at all, it'll open unless you add /V after TTPMcro. However, it will be a hands free experience.

    You can find out more about deploying the macro here: https://ttssh2.osdn.jp/manual/en/macro/

    And a list of all the commands here: https://ttssh2.osdn.jp/manual/en/macro/command/index.html

    And if you need special characters for navigation (ctrl+s, etc), the ASCII code table is here: https://ttssh2.osdn.jp/manual/en/macro/appendixes/ascii.html

    Hope that helps!


    If it's only several basic commands, you can make it without the ttl file by using TTermPro in lieu of TTPMacro.

    cd C:\Program Files\teraterm
    TTERMPRO /C=1 (connect thru serial com 1)
    TTERMPRO etc etc
    

    The syntax for command line using TTERMPRO can be found here: https://ttssh2.osdn.jp/manual/en/commandline/teraterm.html