Plee
Plee

Reputation: 591

PuTTY command line user input

I am trying to write a batch file to automate a PuTTY script. Right now the script successfully logs into the SSH server with this line

putty.exe -ssh user@ipaddress -pw password -m commands.txt > log.txt

My problem is that once it's logged in the server prompts me to hit "Ctrl+y to begin" afterwards it asks me to press "Enter". How would I imitate that in my commands.txt file?

Upvotes: 1

Views: 3539

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202088

Use Plink (PuTTY command-line tool).

It is a console application, hence it allows input redirection.

Create a text file that contains Ctrl+Y character followed by Enter character. I.e. 0x19 and 0x0A. And then follow with your commands.

Then you can do

plink -ssh user@ipaddress -pw password < input.txt

Upvotes: 2

Related Questions