Jump to content

SSH using Plink / Putty


Recommended Posts

I have a CMD batch file that contains the following.

putty -i key.ppk -R 12345:localhost:22 user@mycompany.com -pw testing123

GOAL:  I'd like AutoIt script to run the same exact command above, but ASK for a number, and whatever  number is inputted in the response to automatically REPLACE the 12345 number above with the entered number by the user and run the command.  So when a user enters for example, 9876, then the scripts run the command below...

putty -i key.ppk -R 9876:localhost:22 user@mycompany.com -pw testing123

Thank you for any assistance.

Link to comment
Share on other sites

thx badcoder123 it works when I run the script, but I should of corrected my own CMD script.  

It is actually .\putty -i .\key.ppk -R 9876:localhost:22 user@mycompany.com -pw testing123  as you can see I have .\ prepending the command putty and key.ppk because I create an EXE that run my cmd script file with that content along with putty and the key.ppk file - all 3 files together in an EXE created by IEXPRESS.  IEXPRESS just happends to extract those 3 files together to a temporary directory and executes the batch file and calls those other 2 files; hence .\ prepend.  If I combine replace the cmd with your EXE based script, it doesn't execute.  I did this and it didn't work.  How do I ensure that when EXE that extracts this 3 files in temp dir that it calls them or refers to them.  Thank you.

$input = InputBox("Key", "Enter the numeric key.") Run(@ComSpec & " /c " & '.\putty -i .\key.ppk -R ' & $input & ':localhost:22 user@mycompany.com -pw testing123', "", @SW_SHOW) ;Change flag to @SW_HIDE

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...