Search code examples
batch-filecmdputtyhtk

Layout of command output executed automatically in PuTTY from a batch file is broken


I have followed this question to build a batch file to run the PuTTYwith my username and password: How to run a command file in PuTTY using automatic login in a command prompt?


@echo off
START putty.exe -ssh [domain] -l [username] -pw [password] -m code.txt
@echo

And the PuTTY will try to run the code.txt file, which have the following code:

HResults -p -e "???" sil -e "???" sp -L labels/test lib/words3 results/*.rec
read

It will show a matrix. I try to run the batch file, it is able to open PuTTY, login and run the command in text file. But the output in PuTTY terminal is a mess. The layout of output is fine, when I doing those things manually. Is that mean some kind of setting is missing? It's not making any sense a batch file will change the output of another application...... Thanks


Solution

  • The -m switch imply a non-interactive session. While, when logging in manually, an interactive mode is used by default.

    It may fundamentally affect output of some applications.

    Try forcing the interactive mode using the -t switch:

    START putty.exe -ssh [domain] -t -l [username] -pw [password] -m code.txt