3

Currently I am trying to run bat files call_putty.bat and call_plink.bat, but it isn't excuting the input commands in -m E:\CREATE_ONT.txt

When I remove -m E:\CREATE_ONT.txt, the SSH session is established successfully .

Here is the script inside 2 files *.bat.

putty.exe -ssh -2 -P 1022 admin@192.168.1.10 -pw admin -m E:\CREATE_ONT.txt 

and

plink.exe -ssh -2 -P 1022 admin@192.168.1.10 -pw admin -m E:\CREATE_ONT.txt

In the CREAT_ONT.txt file is the code run when I manually copy and paste it into SSH session.

How do I resolve this issue?

Minh Nguyen
  • 41
  • 1
  • 3
  • Any error message? What's the `plink.exe` output? What's in PuTTY Event log? – Martin Prikryl Jul 19 '15 at 12:17
  • Hi. The `plink.exe` output is the putty window flash out and nothing happen. I can't see PuTTY Event log cause it disappear very fast. – Minh Nguyen Jul 19 '15 at 13:45
  • 1
    You have to run `plink.exe` from existing console window (typically `cmd.exe`). The PuTTY event log is in the PuTTY window title context menu. – Martin Prikryl Jul 19 '15 at 13:48
  • Thank Martin. When i applied this code `plink.exe -ssh -2 -P 1022 admin@192.168.1.10 -pw admin -m E:\CREATE_ONT.txt` directly to `cmd.exe` the error came out `FATAL ERROR: Server refused to start a shell/command` . Any advise how do I resolve this issue? – Minh Nguyen Jul 19 '15 at 13:55
  • Can you do this? `plink.exe -ssh -2 -P 1022 admin@192.168.1.10 -pw admin < E:\CREATE_ONT.txt` What the output will be? – Martin Prikryl Jul 19 '15 at 14:05
  • @MartinPrikryl I do as you said and this is the ouput: `Started a shell/command; Sent EOF message; Disconnected: All channels closed` – Minh Nguyen Jul 19 '15 at 14:19
  • OK and did it execute the command? Do you expect any output? – Martin Prikryl Jul 19 '15 at 14:28
  • @MartinPrikryl The command still won't execute. Nothing happen :( – Minh Nguyen Jul 19 '15 at 14:35
  • And if you type the same commands on `plink.exe` console? – Martin Prikryl Jul 19 '15 at 15:02
  • When i remove `< E:\CREATE_ONT.txt` the result of `plink.exe` is the SSH connection is established and the window console is won't disappear. I copy commands from file `CREATE_ONT.txt` and it run normaly. – Minh Nguyen Jul 19 '15 at 15:12
  • Did you check server log? (when using the `< E:\CREATE_ONT.txt`) – Martin Prikryl Jul 19 '15 at 15:22

0 Answers0